update docs

This commit is contained in:
les
2021-06-04 15:34:40 +02:00
parent 600caebf79
commit 6a3d138a6d
17 changed files with 376 additions and 130 deletions

23
docs/install/backup.md Normal file
View File

@@ -0,0 +1,23 @@
---
layout: default
title: Backup
permalink: /backup
nav_order: 5
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, images and thumbnails for every release.
```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)
```
> warning "Permission denied"
> `postgres` directory could be with different permission or owner so you'll probably 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/)

View File

@@ -0,0 +1,139 @@
---
layout: default
title: Configuration
permalink: /config
nav_order: 6
parent: Install
---
## Configuration
{: .no_toc }
Main `gancio` configuration is done with a configuration file.
This shoud be a `.json` or a `.js` file and could be specified using the `--config` flag.
- <small>eg. `gancio start --config ./config.json`</small>
- <small>eg. `pm2 start gancio start -- --config ~/config.json`</small>
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
```json
"server": {
"host": "localhost",
"port": 13120
}
```
- ### Database
DB configuration, look [here](https://sequelize.org/master/class/lib/sequelize.js~Sequelize.html#instance-constructor-constructor) for options.
```json
"db": {
"dialect": "sqlite",
"storage": "/tmp/db.sqlite"
}
```
- ### Upload path
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.
- ### Favicon
You could specify another favicon. This is also used as logo (top-left
corner):
`"favicon": "./favicon.ico"`
- ### 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
each string of **gancio** making a directory with your locales inside.
For example, let's say you want to modify the text inside the `/about`
page:
`mkdir /opt/gancio/user_locale`
put something like this in `/opt/gancio/user_locale/en.js` to override the about in
english:
```js
export default {
about: 'A new about'
}
```
and then point the `user_locale` configuration to that directory:
```json
"user_locale": "/opt/gancio/user_locale"
```
Watch [here](https://framagit.org/les/gancio/tree/master/locales) for a
list of strings you can override.
<small>:warning: Note that a restart is needed when you change
user_locale's content.</small>
- ### Secret
## Default settings
```json
{
"title": "Gancio",
"description": "A shared agenda for local communities",
"baseurl": "http://localhost:13120",
"server": {
"host": "0.0.0.0",
"port": 13120
},
"db": {
"dialect": "sqlite",
"storage": "/tmp/db.sqlite"
},
"upload_path": "./",
"favicon": "../dist/favicon.ico",
"smtp": {
"auth": {
"user": "",
"pass": ""
},
"secure": true,
"host": ""
},
"admin_email": "",
"secret": "notsosecret"
}
```

View File

@@ -1,7 +1,7 @@
---
layout: default
title: Debian
permalink: /install/debian
nav_order: 1
parent: Install
---
@@ -9,7 +9,7 @@ parent: Install
1. Install Node.js & yarn (**from root**)
```bash
curl -sL https://deb.nodesource.com/setup_12.x | bash -
curl -sL https://deb.nodesource.com/setup_16.x | bash -
apt-get install -y nodejs
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list
@@ -19,7 +19,7 @@ apt-get update && apt-get install yarn
1. Install Gancio
```bash
yarn global add gancio --prod
yarn global add --silent https://gancio.org/latest.tgz 2> /dev/null
```
1. Setup with postgreSQL __(optional as you can choose sqlite)__
@@ -62,8 +62,8 @@ pm2 startup # read the output!
sudo pm2 startup -u gancio
```
1. Upgrade
## Upgrade
```bash
sudo yarn global add gancio
sudo yarn global add --silent https://gancio.org/latest.tgz 2> /dev/null
sudo service pm2 restart
```

View File

@@ -3,6 +3,7 @@ layout: default
title: Docker
permalink: /install/docker
parent: Install
nav_order: 2
---
## Table of contents
{: .no_toc .text-delta }
@@ -11,15 +12,15 @@ parent: Install
{:toc}
## Initial setup
**You do not need to clone the full repo as we distribute gancio via npm.**
A Dockerfile and a docker-compose.yml are the only files needed.
- __Create a directory where everything related to gancio is stored (db, images, config)__
> info "Clone not needed"
> You do not need to clone the full repo, a `Dockerfile` and a `docker-compose.yml` are enough.
- __Create a directory where everything related to gancio is stored__
```bash
mkdir /opt/gancio
mkdir -p /opt/gancio/data
cd /opt/gancio
```
<small>note that you can choose a different directory.</small>
## Use sqlite
<div class='code-example bg-grey-lt-100' markdown="1">
@@ -29,13 +30,8 @@ wget https://gancio.org/docker/Dockerfile
wget https://gancio.org/docker/sqlite/docker-compose.yml
```
1. Create an empty db and config (**this is needed**)
```
touch config.json db.sqlite
mkdir user_locale
```
1. Build docker image and launch interactive setup in one step
1. Build docker image and launch interactive setup
```
docker-compose build
docker-compose run --rm gancio gancio setup --docker --db=sqlite
@@ -51,13 +47,7 @@ wget https://gancio.org/docker/Dockerfile
wget https://gancio.org/docker/postgres/docker-compose.yml
```
1. Create an empty configuration (**this is needed**)
```
touch config.json
mkdir user_locale
```
1. Build docker image and launch interactive setup in one step
1. Build docker image and launch interactive setup
```
docker-compose build
docker-compose run --rm gancio gancio setup --docker --db=postgres
@@ -72,20 +62,37 @@ docker-compose run --rm gancio gancio setup --docker --db=postgres
docker-compose up -d
```
1. Look at logs with
1. Look at logs
```bash
docker-compose logs
tail -f data/logs/gancio.log
```
1. [Setup nginx as a proxy](/install/nginx)
1. Point your web browser to [http://localhost:13120](http://localhost:13120) or where you specified during setup and enjoy :tada:
1. You can edit `config.json` file and restart the container on your needs, see [Configuration](/config) for more details.
1. Edit `data/config.json` and restart the container on your needs, see [Configuration](/config) for more details.
## Upgrade
> warning "Backup your data"
> Backup your data is generally a good thing to do and this is especially true before upgrading.
> Don't be lazy and [backup](/backup) your data!
> error "Upgrade from a version < 1.0"
> Since v1.0 our docker setup is changed and a new container has to be built:
>
> - `cd /opt/gancio`
> - [Backup your data](/backup)
> - Download new `Dockerfile` => `wget https://gancio.org/docker/Dockerfile`
> - Download new `docker-compose.yml` (modify DB to sqlite or postgres)-> `wget https://gancio.org/docker/<DB>/docker-compose.yml`
> - Build the new container `docker-compose build`
> - Extract your backup into `./data` => `mkdir data; tar xvzf gancio-<yourLastBackup>-backup.tgz -C data`
> - Stop your old container `docker-compose stop`
> - Start your new container `docker-compose up`
```bash
cd /opt/gancio
docker-compose up -d --no-deps --build

View File

@@ -7,7 +7,7 @@ nav_order: 2
has_toc: false
---
## Install (production)
## Install
- [Install on Debian](/install/debian)
- [Install using docker](/install/docker)