A web app for publishing to Gemini
Go to file
Hugh Rundle 5a4876b43d fix indexing and new page
- new "published" page shows afer publishing, instead of 'you already posted', which may look like an error.
- fixes logic for updating main index, which was totally broken!
2023-01-30 16:56:17 +11:00
static fix footer styling 2023-01-11 14:05:14 +11:00
templates add help page and page titles 2023-01-11 14:04:31 +11:00
.gitignore fix saveFile & remove dotenv 2023-01-11 13:30:52 +11:00
cli.js first commit 2023-01-04 11:17:41 +11:00
package-lock.json fix saveFile & remove dotenv 2023-01-11 13:30:52 +11:00
package.json fix saveFile & remove dotenv 2023-01-11 13:30:52 +11:00
README.md fix paths in readme 2023-01-13 09:08:04 +11:00
rundev_example add rundev example and systemd Unit file 2023-01-11 13:34:06 +11:00
server.js fix indexing and new page 2023-01-30 16:56:17 +11:00
soyuz-web.service add subdir to systemd example 2023-01-11 19:05:42 +11:00
utilities.js fix indexing and new page 2023-01-30 16:56:17 +11:00

Soyuz (Союз - 'union') connects the web and gemini.

This repository is for soyuz-web, an Express web application for publishing from the web to Gemini capsules.

There will soon be a sister-repository, soyuz-cli for publishing from the command line on Unix-like systems. You do not have to use soyuz-cli to use soyuz-web, and in multi-user systems, definitely shouldn't.

Soyuz is named after the Russian spacecraft.

Dependencies

  • sqlite3
  • nodejs

soyuz-web has only been tested on Mac and Linux.

Assumptions

Soyuz is simple web app for writing Gemini posts, not a Gemini server. It is assumed that:

  • you are using a Gemini server (e.g. Agate)
  • the server user running soyuz-web has access to read and write files in each Gemini 'capsule' (site).
  • 'world/other' has read access to the Gemini capsule(s)

The second point means that you can either:

  1. use soyuz-web for multiple users to publish Gemini posts, as long as they only use soyuz-web; or
  2. use soyuz-web for a single user, who can also publish via other means (e.g. rsync or soyuz-cli), as long as that user is running the soyuz-web service.

Configuration

Environment Variables required are:

  • SOYUZ_PORT (the port you want to run your app on)
  • GEMINI_PATH (root path for Gemini capsules)
  • SOYUZ_SESSION_SECRET (a random string or passphrase to secure session cookies)

You may set these however you like, but systemd is recommended. If you are contributing to the project, you can pick up envs in development via a simple rundev shell script by running npm run dev. You can find examples at soyuz-web.service and rundev_example. Do not copy the example SOYUZ_SESSION_SECRET!

Commands

  • npm start - start the Express app
  • npm run user-create USERNAME DIRECTORY - create a new user USERNAME with capsule files stored at DIRECTORY. The DIRECTORY is relative to GEMINI_PATH and should be the name of the directory used by the user's Gemini "capsule". This command will provide an initial password in plaintext that you can provide to the user.

e.g. npm run user-create Hugh gemini.example.com would create a new user Hugh and expect Hugh's Gemini capsule to be saved at $GEMINI_PATH/gemini.example.com

  • npm run password-reset USERNAME - reset the password for user USERNAME. This command will return the password in plaintext on the command line.

Setup

Create user (if not already created)

  1. Create a dedicated user to run the app: add user --disabled-login gemini
  2. Swith to user and home directory su gemini && cd /home/gemini

Install latest code and dependencies

  1. You must be running nodejs v18.x or higher
  2. Download: git clone https://github.com/hughrun/soyuz-web.git
  3. Install npm modules: npm install

Set up systemd unit files (optional)

  1. Edit the soyuz-web/soyuz-web.service file, checking you are using the port number, directory, and user you want, and have a strong session secret.
  2. Copy systemd unit file to where systemd expects to see it: cp soyuz-web/soyuz-web.service /etc/systemd/system/
  3. systemctl daemon-reload
  4. systemctl enable soyuz-web

Set up web server (e.g. nginx)

  1. Edit soyuz.nginx and replace example.com with your own domain. Check the port number matches your systemd file.
  2. cp soyuz.nginx /etc/nginx/sites-available/soyuz
  3. ln -s /etc/nginx/sites-available/soyuz /etc/nginx/sites-enabled/
  4. systemctl reload nginx

Secure your site with TLS from Lets Encrypt

  1. certbot --nginx

Start systemd service

  1. systemctl start soyuz-web

Create user

  1. npm run user-create sam example.com