Merge branch 'master' into recurrent_events

This commit is contained in:
lesion 2019-07-17 11:05:13 +02:00
commit 599bc11057
13 changed files with 240 additions and 14 deletions

7
docker/Dockerfile Normal file
View file

@ -0,0 +1,7 @@
FROM node:latest
EXPOSE 13120
WORKDIR /
#COPY config/default.json /data/gancio/config/gancio_config.json
RUN yarn global add gancio
#ENTRYPOINT ["gancio", "--config", "/gancio/config.json"]
#CMD ["gancio", "start", "--config", "/data/gancio/gancio_config.json"]

BIN
docker/db.sqlite Normal file

Binary file not shown.

33
docker/docker-compose.yml Normal file
View file

@ -0,0 +1,33 @@
version: '3'
services:
db:
image: postgres
container_name: postgres
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
- db:/var/lib/postgres
- /etc/localtime:/etc/localtime:ro
environment:
- POSTGRES_USER=gancio
- POSTGRES_DB=gancio
- POSTGRES_PASSWORD=gancio
restart: always
ports:
- 5432:5432
gancio:
build: .
image: node:latest
container_name: gancio
command: gancio start /gancio/config.json
volumes:
- ./db.sqlite:/gancio/db.sqlite
- ./config.json:/gancio/config.json
- ./uploads:/gancio/uploads
depends_on:
- db
ports:
- 13120:13120
volumes:
db:
gancio:

0
docker/init.db Normal file
View file

View file

@ -17,8 +17,8 @@ title: Gancio
email: gancio@cisti.org
description: >- # this means to ignore newlines until "baseurl:"
A shared agenda for local communities
baseurl: "" # the subpath of your site, e.g. /blog
url: "" # the base hostname & protocol for your site, e.g. http://example.com
baseurl: "/gancio" # the subpath of your site, e.g. /blog
url: "https://prove.fugadalcontrollo.org" # the base hostname & protocol for your site, e.g. http://example.com
#twitter_username: jekyllrb
#github_username: jekyll

View file

@ -12,7 +12,7 @@ permalink: /
A shared agenda for local communities.
{: .fs-6 }
[Get started now](/setup){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 } [Demo](https://gancio.cisti.org){: .btn .btn-green .fs-5 .mb-4 .mb-md-0 }
[Get started now](/setup){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 } [Demo](https://demo.fugadalcontrollo.org){: .btn .btn-green .fs-5 .mb-4 .mb-md-0 }
[Source](https://git.lattuga.net/cisti/gancio){: .btn .fs-5 }
<iframe width="800" height="500" sandbox="allow-same-origin allow-scripts" src="https://spacepub.space/videos/embed/9745bffc-e1e8-416d-9b08-fbc5e4c803b3?muted=1&title=0" frameborder="0" allowfullscreen></iframe>

View file

@ -7,13 +7,13 @@ parent: Setup
## Classic setup
1. Install Node.js
1. Install Node.js and postgreSQL
```bash
curl -sL https://deb.nodesource.com/setup_12.x | bash -
apt-get install -y nodejs
apt-get install -y nodejs postgresql
```
<small>[source](https://github.com/nodesource/distributions/blob/master/README.md)</small>
2. Install Gancio
1. Install Gancio
```bash
npm install --global gancio
```
@ -26,19 +26,40 @@ postgres=# create user gancio with encrypted password 'gancio';
postgres=# grant all privileges on database gancio to gancio;
```
4. Create a new user
1. Create a database (optional as you can use sqlite, but recommended)
```bash
sudo -u postgres psql
postgres=# create database gancio;
postgres=# create user gancio with encrypted password 'gancio';
postgres=# grant all privileges on database gancio to gancio;
```
1. Create a user to run gancio from
```bash
adduser gancio
su gancio
```
5. Setup & test
1. Test & launch interactive setup
```bash
gancio --help
gancio setup
```
1. Start
```bash
gancio --help
gancio setup
gancio start
```
1. Point your web browser to [http://localhost:13120](http://localhost:13120) or where you selected during setup.
6. Enjoy :tada:
Point your web browser to [http://localhost:3000](http://localhost:3000)
1. [Setup nginx as a proxy](/setup/nginx)
1. Deploy in production
If you don't use the [docker way](/setup/docker), in production you should use something like **[pm2](http://pm2.keymetrics.io/)**:
```bash
sudo npm install --global pm2
pm2 gancio start
```

55
docs/setup/dev.md Normal file
View file

@ -0,0 +1,55 @@
---
layout: default
title: Classic
permalink: /setup/classic
parent: Setup
---
## Classic setup
1. Install Node.js and postgreSQL
```bash
curl -sL https://deb.nodesource.com/setup_12.x | bash -
apt-get install -y nodejs postgresql
```
<small>[source](https://github.com/nodesource/distributions/blob/master/README.md)</small>
1. Install Gancio
```bash
npm install --global gancio
```
1. Create a database (optional as you can use sqlite, but recommended)
```bash
sudo -u postgres psql
postgres=# create database gancio;
postgres=# create user gancio with encrypted password 'gancio';
postgres=# grant all privileges on database gancio to gancio;
```
1. Create a user to run gancio from
```bash
adduser gancio
su gancio
```
1. Test & launch interactive setup
```bash
gancio --help
gancio setup
```
1. Start
```bash
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](/setup/nginx)
1. Deploy in production
If you don't use the [docker way](/setup/docker), in production you should use something like **[pm2](http://pm2.keymetrics.io/)**:
```bash
sudo npm install --global pm2
pm2 gancio start
```

View file

@ -7,4 +7,38 @@ parent: Setup
## Install with docker
**You do not need to clone the full repo as we distribute gancio via npm.**
[Dockerfile](https://git.lattuga.net/cisti/gancio/raw/docker/docker/Dockerfile) and [docker-compose.yml](https://git.lattuga.net/cisti/gancio/raw/docker/docker/docker-compose.yml) are the only needed files.
1. Create a directory where everything related to gancio is stored (db, images, config)
```bash
mkdir /opt/gancio
cd /opt/gancio
```
:information_source: you can choose a different directory of course
1. Download docker-compose.yml and Dockerfile
```bash
wget https://git.lattuga.net/cisti/gancio/raw/docker/docker/Dockerfile
wget https://git.lattuga.net/cisti/gancio/raw/docker/docker/docker-compose.yml
```
1. Create an empty configuration file
```
touch config.json
```
<small>After first setup, you can modify this file and restart the container on your needs.</small>
1. Build docker image and launch interactive setup in one step
```
docker-compose run --rm gancio gancio setup
```
1. Run your container
```bash
docker-compose up -d
```
1. [Setup nginx as a proxy](/setup/nginx)
1. Point your web browser to [http://localhost:13120](http://localhost:13120) or where you specified during setup and enjoy :tada:

71
docs/setup/nginx.md Normal file
View file

@ -0,0 +1,71 @@
---
layout: default
title: Nginx
permalink: /setup/nginx
parent: Setup
---
## Nginx proxy configuration
This is the default nginx configuration for gancio, please modify at least the **server_name** and **ssl_certificate**'s path
```nginx
server {
listen 80;
listen [::]:80;
server_name gancio.cisti.org;
root /var/www/letsencrypt;
location /.well-known/acme-challenge/ { allow all; }
location / { return 301 https://$host$request_uri; }
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name gancio.cisti.org;
ssl_protocols TLSv1.2;
ssl_ciphers HIGH:!MEDIUM:!LOW:!aNULL:!NULL:!SHA;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
# Uncomment these lines once you acquire a certificate:
# ssl_certificate /etc/letsencrypt/live/gancio.cisti.org/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/gancio.cisti.org/privkey.pem;
keepalive_timeout 70;
sendfile on;
client_max_body_size 80m;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
add_header Strict-Transport-Security "max-age=31536000";
location / {
try_files $uri @proxy;
}
location @proxy {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Proxy "";
proxy_pass_header Server;
proxy_pass http://127.0.0.1:13120;
proxy_buffering on;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
tcp_nodelay on;
}
}
```

View file

@ -4,9 +4,13 @@ title: Setup
permalink: /setup
has_children: true
nav_order: 2
has_toc: false
---
# Setup
You would setup **Gancio** for different scenario
{: .fs-6 }
- ## [Setup with docker](/setup/docker)
- ## [Classic setup](/setup/classic)
- ## [Nginx as a proxy](/setup/nginx)
- ## [Hacking & contribute](/dev)

View file

@ -1,6 +1,6 @@
{
"name": "gancio",
"version": "0.9.31",
"version": "0.10.0",
"description": "A shared agenda for local communities",
"author": "lesion",
"scripts": {
@ -8,6 +8,7 @@
"build": "nuxt build",
"start": "cross-env NODE_ENV=production node server/cli.js",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"doc": "cd docs && bundle exec jekyll b",
"precommit": "npm run lint",
"migrate:dev": "sequelize db:migrate",
"migrate": "NODE_ENV=production sequelize db:migrate"

View file

@ -188,7 +188,7 @@ require('yargs')
.option('config', {
alias: 'c',
describe: 'Configuration file',
default: './gancio_config.json',
default: '/gancio/config.json',
})
.coerce('config', config_path => {
const absolute_config_path = path.resolve(cwd, config_path)