diff --git a/docs/install/backup.md b/docs/install/backup.md index 09cf4a60..8b8f5e9d 100644 --- a/docs/install/backup.md +++ b/docs/install/backup.md @@ -8,16 +8,43 @@ parent: Install ## Backup -The following commands should be valid for every setup (docker/debian/sqlite/postgres) but check your installation directory first. -This includes database, configuration, custom user locales, logs, images and thumbnails. +The following commands should be valid for every setup (docker/debian/sqlite/postgres). +1. Move to gancio path ```bash -cd /opt/gancio/ # or /home/gancio or where your installation is -tar -czf gancio-$(date +%Y-%m-%d-%H%M%S)-backup.tgz \ - $(ls -d config.json uploads user_locale db.sqlite postgres data logs 2> /dev/null) +cd /opt/gancio/ # or where your installation is +``` + +1. Backup PostgreSQL (only required for non-docker PostgreSQL installation) +```bash +sudo -u postgres pg_dump -Fc gancio > gancio.dump +``` + +1. Archive database, configuration, custom user locales, logs, images and thumbnails +```bash +sudo tar -czf gancio-$(date +%Y-%m-%d-%H%M%S)-backup.tgz \ + $(ls -d config.json uploads user_locale db.sqlite gancio.dump postgres data logs 2> /dev/null) ``` -> warning "Permission denied" -> `postgres` directory could have different permission or owner, in this case you need to be root or use `sudo` instead. > info "Automatic backup" -> To periodically backup your data you should probably use something like [restic](https://restic.net) or [borg](https://www.borgbackup.org/) \ No newline at end of file +> To periodically backup your data you should probably use something like [restic](https://restic.net) or [borg](https://www.borgbackup.org/) + + +## Restore + +1. Install a clean gancio +1. Move to gancio path +```bash +cd /opt/gancio/ # or where your installation is +``` + +1. Extract your backup +```bash +tar xvf gancio-*-backup.tgz +``` + +1. Restore PostgreSQL database (only required for non-docker PostgreSQL installation) +``` +sudo -u postgres createdb gancio +sudo -u postgres pg_restore -d gancio gancio.dump +``` \ No newline at end of file diff --git a/docs/install/configuration.md b/docs/install/configuration.md index fd242480..da8d75da 100644 --- a/docs/install/configuration.md +++ b/docs/install/configuration.md @@ -16,22 +16,8 @@ The configuration file shoud be a `.json` or a `.js` file and could be specified 1. TOC {:toc} -- ### Title -The title will be in rss feed, in html head and in emails: - -`"title": "Gancio"` - -![title](../assets/title.png) - -- ### Description -`"description": "a shared agenda for local communities"` - -- ### BaseURL -URL where your site will be accessible (include http or https): -`"baseurl": "https://gancio.cisti.org"` - - ### Server -This probably support unix socket too :D +This probably support unix socket too ```json "server": { @@ -52,31 +38,6 @@ DB configuration, look [here](https://sequelize.org/master/class/lib/sequelize.j Where to save images `"upload_path": "./uploads"` -- ### SMTP -SMTP configuration. -Gancio should send emails at following events: -- the admin should receive emails of anon event (if enabled) to confirm them. -- the admin should receive emails of registration request (if enabled) to confirm them. -- an user should receive an email of registration requested. -- an user should receive an email of confirmed registration. -- an user should receive a confirmation email when subscribed directly by admin. - -```json -"smtp": { - "auth": { - "user": "", - "pass": "" - }, - "secure": true, - "host": "" - } -``` - -- ### Admin_email -Email of administrator. Note that email from gancio comes from this email and that -the SMTP configuration above should allow to use this address as from. - - - ### User locale Probably you want to modify some text for your specific community, that's why we thought the `user_locale` configuration: you can specify your version of @@ -96,34 +57,7 @@ and then point the `user_locale` configuration to that directory: "user_locale": "/opt/gancio/user_locale" ``` Watch [here](https://framagit.org/les/gancio/tree/master/locales) for a -list of strings you can override. -:warning: Note that a restart is needed when you change -user_locale's content. +list of strings you can override. - -## Default settings -```json -{ - "title": "Gancio", - "description": "A shared agenda for local communities", - "baseurl": "http://localhost:13120", - "server": { - "host": "127.0.0.1", - "port": 13120 - }, - "db": { - "dialect": "sqlite", - "storage": "./db.sqlite" - }, - "upload_path": "./", - "smtp": { - "auth": { - "user": "", - "pass": "" - }, - "secure": true, - "host": "" - }, - "admin_email": "", -} -``` +> warning "Restart needed" +> Note that a restart is needed when you change user_locale's content. diff --git a/docs/install/debian.md b/docs/install/debian.md index 36c5309e..9c5146b0 100644 --- a/docs/install/debian.md +++ b/docs/install/debian.md @@ -34,37 +34,27 @@ postgres=# grant all privileges on database gancio to gancio; 1. Create a user to run gancio from ```bash -sudo adduser gancio -su - gancio +sudo adduser --group --system --shell /bin/false --home /opt/gancio gancio ``` 1. Install Gancio ```bash -yarn global add --silent {{site.url}}/latest.tgz 2> /dev/null +sudo yarn global add --silent {{site.url}}/latest.tgz 2> /dev/null ``` -1. Launch interactive setup +1. Setup systemd service and reload systemd ```bash -$(yarn global bin)/gancio setup --config config.json +sudo wget http://gancio.org/gancio.service -O /etc/systemd/system/gancio.service +sudo service daemon-reload ``` -1. Start +1. Start gancio service (this should listen on port 13120) ```bash -$(yarn global bin)/gancio start --config config.json +sudo service gancio start ``` -1. Point your web browser to [http://localhost:13120](http://localhost:13120) or where you selected during setup. 1. [Setup nginx as a proxy]({% link install/nginx.md %}) -1. To deploy gancio in production you should use something like **[pm2](http://pm2.keymetrics.io/)**: - -```bash -sudo yarn global add pm2 -pm2 start gancio -- --config config.json - -# Run this command to run your application as a service and automatically restart after a reboot: -pm2 startup # read the output! -sudo pm2 startup -u gancio -``` +1. Point your web browser to your domain :tada: ## Upgrade @@ -76,5 +66,5 @@ sudo pm2 startup -u gancio yarn global remove gancio yarn cache clean yarn global add --silent {{site.url}}/latest.tgz 2> /dev/null -sudo service pm2 restart +sudo service gancio restart ``` diff --git a/docs/install/docker.md b/docs/install/docker.md index f8f2f199..2acd4802 100644 --- a/docs/install/docker.md +++ b/docs/install/docker.md @@ -16,6 +16,10 @@ nav_order: 2 - __You must have the following dependencies installed: Docker, Docker Compose and Nginx__ +```bash +sudo apt install docker docker-compose nginx +``` +or 1. [Install docker](https://docs.docker.com/engine/install/) 1. [Install docker-compose](https://docs.docker.com/compose/install/) 1. [Install nginx](https://nginx.org/en/docs/install.html) @@ -37,10 +41,9 @@ wget {{site.url}}{% link /docker/sqlite/docker-compose.yml %} ``` -1. Build docker image and launch interactive setup +1. Build docker image ``` docker-compose build -docker-compose run --rm gancio gancio setup --docker --db=sqlite ``` @@ -54,10 +57,9 @@ wget {{site.url}}{% link /docker/entrypoint.sh %} wget {{site.url}}{% link /docker/postgres/docker-compose.yml %} ``` -1. Build docker image and launch interactive setup +1. Build docker image ``` docker-compose build -docker-compose run --rm gancio gancio setup --docker --db=postgres ``` @@ -74,15 +76,9 @@ docker-compose up -d tail -f data/logs/gancio.log ``` -1. Navigate away from Gancio directory & into Nginx Directory -```bash -cd ~ -cd /etc/nginx/sites-available -``` - 1. [Setup nginx as a proxy]({% link install/nginx.md %}) -1. Point your web browser to [http://localhost:13120](http://localhost:13120) or where you specified during setup and enjoy :tada: +1. Point your web browser to your domain :tada: 1. Edit `data/config.json` and restart the container on your needs, see [Configuration]({% link install/configuration.md %}) for more details.