2024-10-19 13:28:53 +02:00
|
|
|
# 2024 update - docker setup
|
|
|
|
|
|
|
|
I'll update this file properly soon, but for now, instructions for deployment
|
|
|
|
using docker:
|
|
|
|
|
2024-10-19 23:27:31 +02:00
|
|
|
1. In `create-db.sql`, update the `vervis` DB user's password
|
|
|
|
2. Create and edit `config/settings.yml` based on
|
|
|
|
`config/settings-sample-prod.yml`, remember to set the same DB password here
|
|
|
|
3. In `docker-compose.yml`, update the database superuser password (it's the
|
|
|
|
password for the `postgres` superuser, not `vervis`)
|
|
|
|
4. Create initial state: `./prepare-state.sh`
|
|
|
|
5. Ready for launch! `docker-compose up -d`
|
2024-10-19 13:28:53 +02:00
|
|
|
|
|
|
|
---
|
|
|
|
|
2018-12-10 14:58:39 +01:00
|
|
|
Vervis is still in early development and the build process gets updates once in
|
|
|
|
a while, but this file tries to keep up and list the latest instructions for
|
|
|
|
running a Vervis instance.
|
2016-03-05 04:55:06 +01:00
|
|
|
|
2018-12-10 14:58:39 +01:00
|
|
|
At the time of writing, you can get a running Vervis instance if you follow the
|
|
|
|
steps below.
|
2016-01-28 15:15:54 +01:00
|
|
|
|
2019-11-13 14:26:26 +01:00
|
|
|
UPDATE: There is a binary build you can use instead of building from source. It
|
|
|
|
can be found [here](https://box.angeley.es/nextcloud/s/oWHmQDtWTAfPR4Z). If you
|
|
|
|
use it, verify the download using `sha256sum` and `gpg`, make sure the settings
|
2024-10-19 23:27:31 +02:00
|
|
|
in your `config/settings.yml` (see below) match the downloaded file paths, and run the
|
2019-11-13 14:26:26 +01:00
|
|
|
web app using `./bin/vervis` and not `stack run`. This may be confusing;
|
|
|
|
hopefully I'll make a nicer binary release soon :)
|
|
|
|
|
2022-09-27 06:49:17 +02:00
|
|
|
2022 UPDATE: The binary release is unavailable right now. But a docker image is
|
|
|
|
being prepared. More news soon.
|
|
|
|
|
2024-10-18 15:08:49 +02:00
|
|
|
2024 UPDATE: For production hosting and deployment with Docker, use the
|
|
|
|
`Dockerfile` and `docker-compose.yml` files in this repo's root directory.
|
|
|
|
|
2018-12-10 14:58:39 +01:00
|
|
|
# (1) System libraries
|
2018-11-29 23:01:12 +01:00
|
|
|
|
2018-05-12 11:42:00 +02:00
|
|
|
Install dependency library development packages. It's very likely you already
|
|
|
|
have them all installed, and if you're missing some, the build process will
|
|
|
|
inform you. But it's still nice to have a list here. The list below isn't a
|
|
|
|
complete list, it's just libraries that people have found missing while
|
|
|
|
building, and let me know.
|
|
|
|
|
2024-01-31 20:11:42 +01:00
|
|
|
- libgmp
|
|
|
|
- libpcre
|
2018-05-12 11:42:00 +02:00
|
|
|
- ZLib
|
2018-12-10 14:58:39 +01:00
|
|
|
- libssl
|
2024-01-31 20:11:42 +01:00
|
|
|
- PostgreSQL client library
|
2018-05-12 11:42:00 +02:00
|
|
|
|
|
|
|
On Debian based distros, installation can be done like this:
|
|
|
|
|
2024-01-31 20:11:42 +01:00
|
|
|
$ sudo apt install libpq-dev zlib1g-dev libssl-dev libpcre3-dev libgmp-dev
|
2018-12-10 14:58:39 +01:00
|
|
|
|
2023-04-29 12:40:44 +02:00
|
|
|
# (2) Haskell development tools
|
2018-05-12 11:42:00 +02:00
|
|
|
|
2023-04-29 12:40:44 +02:00
|
|
|
Go to the [GHCup website](https://www.haskell.org/ghcup) and follow the
|
|
|
|
instructions.
|
|
|
|
|
|
|
|
$ curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
|
2018-12-10 14:58:39 +01:00
|
|
|
|
|
|
|
# (3) Version control systems Darcs and Git
|
2018-03-24 16:09:22 +01:00
|
|
|
|
2023-05-25 12:54:03 +02:00
|
|
|
Install Darcs and Git. You can grab them from your distro, e.g.:
|
2018-03-24 16:09:22 +01:00
|
|
|
|
2023-05-25 12:54:03 +02:00
|
|
|
$ sudo apt install darcs git
|
2018-03-24 16:09:22 +01:00
|
|
|
|
2018-12-10 14:58:39 +01:00
|
|
|
# (4) The Vervis source code
|
|
|
|
|
2018-03-24 16:09:22 +01:00
|
|
|
Clone the Vervis repo:
|
|
|
|
|
2023-05-25 12:54:03 +02:00
|
|
|
$ git clone https://vervis.peers.community/repos/rjQ3E vervis
|
2016-01-28 15:15:54 +01:00
|
|
|
$ cd vervis
|
|
|
|
|
2018-12-10 14:58:39 +01:00
|
|
|
Clone dependency libraries:
|
2018-05-14 17:19:58 +02:00
|
|
|
|
2019-01-14 02:50:14 +01:00
|
|
|
$ ./update-deps.sh
|
2018-05-14 17:19:58 +02:00
|
|
|
|
2022-09-25 08:32:25 +02:00
|
|
|
# (5) Database
|
2016-03-07 01:33:59 +01:00
|
|
|
|
2016-03-06 12:58:48 +01:00
|
|
|
Install PostgreSQL. You'll need the server and the client library development
|
2019-04-16 18:39:12 +02:00
|
|
|
files. Note that PostgreSQL needs to be at least version 9.5.
|
2016-03-06 12:58:48 +01:00
|
|
|
|
2018-11-28 09:20:45 +01:00
|
|
|
$ sudo apt install postgresql libpq-dev
|
2016-03-06 12:58:48 +01:00
|
|
|
|
2018-04-01 00:29:00 +02:00
|
|
|
Switch to `postgres` system user:
|
2016-03-06 12:58:48 +01:00
|
|
|
|
2018-04-01 00:29:00 +02:00
|
|
|
$ sudo su - postgres
|
|
|
|
|
|
|
|
Create a PostgreSQL user.
|
|
|
|
|
|
|
|
With password:
|
|
|
|
|
|
|
|
$ createuser --no-createdb --no-createrole --no-superuser --encrypted --pwprompt vervis
|
|
|
|
|
|
|
|
No password (if you run Vervis as a user by the same name as the DB user):
|
|
|
|
|
|
|
|
$ createuser --no-createdb --no-createrole --no-superuser vervis
|
|
|
|
|
|
|
|
Create a PostgreSQL database:
|
|
|
|
|
|
|
|
$ createdb --encoding=UTF8 --owner=vervis vervis
|
2016-03-06 12:58:48 +01:00
|
|
|
|
2022-09-25 08:32:25 +02:00
|
|
|
# (6) Build Vervis
|
2016-03-06 12:58:48 +01:00
|
|
|
|
2022-09-25 08:32:25 +02:00
|
|
|
If you're building for a production deployment, set the `dev` flag to false in
|
|
|
|
`stack.yaml`:
|
|
|
|
|
|
|
|
flags:
|
|
|
|
vervis:
|
|
|
|
dev: false
|
2016-03-06 12:58:48 +01:00
|
|
|
|
2022-09-25 08:32:25 +02:00
|
|
|
Build. This will also automatically install the GHC Haskell compiler.
|
2018-12-10 14:58:39 +01:00
|
|
|
|
2024-08-21 19:23:54 +02:00
|
|
|
$ mkdir static
|
2022-09-25 08:32:25 +02:00
|
|
|
$ stack build
|
2018-12-10 14:58:39 +01:00
|
|
|
|
2022-09-25 08:32:25 +02:00
|
|
|
# (7) Configuration
|
2018-12-10 14:58:39 +01:00
|
|
|
|
2024-10-15 23:32:54 +02:00
|
|
|
Create a directory to hold mutable application state:
|
|
|
|
|
|
|
|
$ mkdir state
|
|
|
|
|
2022-09-25 08:32:25 +02:00
|
|
|
Generate a new SSH key with a blank password:
|
2018-12-10 14:58:39 +01:00
|
|
|
|
2024-10-16 00:00:15 +02:00
|
|
|
$ ssh-keygen -t rsa -m PEM -f state/ssh-host-key
|
2016-03-06 12:58:48 +01:00
|
|
|
|
2022-09-25 08:32:25 +02:00
|
|
|
Update the settings to specify correct database connection details and other
|
|
|
|
settings.
|
|
|
|
|
2024-10-19 13:28:53 +02:00
|
|
|
# Pick the right settings-sample-* file
|
2024-10-19 23:27:31 +02:00
|
|
|
$ cp config/settings-sample-dev.yaml config/settings.yml
|
|
|
|
$ vim config/settings.yml
|
2016-03-06 12:58:48 +01:00
|
|
|
|
2022-10-25 16:32:04 +02:00
|
|
|
Create a directory that will keep all the VCS repositories hosted by Vervis.
|
|
|
|
|
2024-10-15 23:32:54 +02:00
|
|
|
$ mkdir state/repos
|
2022-10-25 16:32:04 +02:00
|
|
|
|
2024-10-19 23:27:31 +02:00
|
|
|
Create a directory that will keep remote delivery state.
|
2023-05-25 00:17:14 +02:00
|
|
|
|
2024-10-15 23:32:54 +02:00
|
|
|
$ mkdir state/delivery-states
|
2023-05-25 00:17:14 +02:00
|
|
|
|
2018-12-10 14:58:39 +01:00
|
|
|
# (8) Development and deployment
|
|
|
|
|
2019-01-14 02:50:14 +01:00
|
|
|
To update your local clone of Vervis, run:
|
|
|
|
|
2023-05-25 12:54:03 +02:00
|
|
|
$ git pull
|
2019-01-14 02:50:14 +01:00
|
|
|
$ ./update-deps.sh
|
|
|
|
$ stack build
|
|
|
|
|
2018-10-25 22:28:06 +02:00
|
|
|
For convenience, at least on actual deployments, you may wish to run the Vervis
|
|
|
|
SSH server on port 22, so that people don't have to specify a custom port. For
|
|
|
|
that to work, the user that runs the Vervis server needs to get permission to
|
|
|
|
bind to ports below 1024. There are several ways to do that. One of them is to
|
|
|
|
use file capabilities to give the Vervis executable the permission to bind to
|
|
|
|
such ports (if you prefer not to trust the code, try one of the other methods,
|
|
|
|
such as sudo):
|
|
|
|
|
|
|
|
$ sudo setcap CAP_NET_BIND_SERVICE=+ep `stack exec which vervis`
|
|
|
|
|
2019-03-11 03:22:34 +01:00
|
|
|
Vervis uses various key files for cryptography and other data generation, and
|
|
|
|
once these key files are created, they shouldn't change. For some of them, it's
|
|
|
|
*critical* they don't change, because some usage or interpretation of data in
|
|
|
|
the PostgreSQL database depends on them. For this reason, by default, key file
|
|
|
|
loading happens as follows: When Vervis runs for the first time (this is
|
|
|
|
checked by detecting that the database is empty, no tables), it generates and
|
|
|
|
writes key files, and it's an error if any of them already exist. Otherwise, on
|
|
|
|
the next time(s) Vervis runs, it requires all key files to exist, and an error
|
|
|
|
is raised if any are missing.
|
|
|
|
|
|
|
|
If you're running Vervis for the first time, i.e. the database is still empty,
|
|
|
|
and for some reason you'd like Vervis to load some existing key files, while
|
|
|
|
generating the rest, run this:
|
|
|
|
|
|
|
|
$ touch _keyfile_import_existing
|
|
|
|
|
2016-03-06 12:58:48 +01:00
|
|
|
Run.
|
|
|
|
|
2024-10-19 23:27:31 +02:00
|
|
|
$ stack run -- config/settings.yml
|
2016-01-28 15:15:54 +01:00
|
|
|
|
2019-07-23 22:36:50 +02:00
|
|
|
By default, Vervis is configured with User Registration disabled. This is to
|
|
|
|
prevent any automatic spambot registration for bots that may be monitoring the
|
|
|
|
Federated Network. In order to enable user registration on your instance,
|
|
|
|
change "registration: false" to "registration: "true" in the config/
|
|
|
|
settings.yml file. Also, the maximum # of accounts is limited to 3. You
|
|
|
|
can increase/decrease this setting to change the maximum. If you do not wish
|
|
|
|
to have a limit, you can comment out this line entirely.
|
|
|
|
|
2019-03-11 03:22:34 +01:00
|
|
|
When you update Vervis to a newer version, it's possible the software now uses
|
|
|
|
some new key files, and Vervis will raise an error about those key files
|
|
|
|
missing in the filesystem. You can ask Vervis to generate missing files, and
|
|
|
|
load the rest as usual:
|
|
|
|
|
|
|
|
$ touch _keyfile_write_missing
|
2019-11-12 14:58:16 +01:00
|
|
|
$ stack run
|
2019-03-11 03:22:34 +01:00
|
|
|
|
2018-03-24 16:09:22 +01:00
|
|
|
Browse to `http://localhost:3000` and have fun!
|
|
|
|
|
|
|
|
`yesod devel` is another way to run the application, useful for rapid
|
|
|
|
development, but I haven't been using it and I'm not sure it works, possibly I
|
|
|
|
broke something along the way. But feel free to try!
|
2018-12-10 14:58:39 +01:00
|
|
|
|
|
|
|
I have a little script for deploying Vervis on my server. I just haven't
|
|
|
|
published it yet and haven't explained how it works. If you're interested, ask
|
|
|
|
me about it, and it will motivate me to write about it sooner :)
|