better documentation

This commit is contained in:
lesion
2019-08-06 01:12:05 +02:00
parent 60edcbb970
commit 689b4d0a76
29 changed files with 261 additions and 823 deletions

View File

@@ -18,12 +18,11 @@ services:
build: .
image: node:latest
container_name: gancio
command: gancio start --docker
command: gancio start --docker --db=postgresql
volumes:
- ./db.sqlite:/opt/gancio/db.sqlite
- ./config.json:/opt/gancio/config.json
- ./uploads:/opt/gancio/uploads
depends_on:
depends_on:
- db
ports:
- 13120:13120

View File

@@ -0,0 +1,17 @@
version: '3'
services:
gancio:
build: .
image: node:latest
container_name: gancio
command: gancio start --docker --db=sqlite
volumes:
- ./db.sqlite:/opt/gancio/db.sqlite
- ./config.json:/opt/gancio/config.json
- ./uploads:/opt/gancio/uploads
ports:
- 13120:13120
volumes:
db:
gancio:

View File

View File

@@ -105,7 +105,7 @@
<li class="navigation-list-item ">
<a href="https://gancio.org/install/classic" class="navigation-list-link">Classic</a>
<a href="https://gancio.org/install/debian" class="navigation-list-link">Debian</a>
</li>

View File

@@ -105,7 +105,7 @@
<li class="navigation-list-item ">
<a href="https://gancio.org/install/classic" class="navigation-list-link">Classic</a>
<a href="https://gancio.org/install/debian" class="navigation-list-link">Debian</a>
</li>

View File

@@ -15,25 +15,25 @@
},
"2": {
"id": "2",
"title": "Classic",
"content": "Install Install Node.js and postgreSQL curl -sL https://deb.nodesource.com/setup_12.x | bash - apt-get install -y nodejs postgresql source Install Gancio npm install --global gancio Create a database (optional as you can use sqlite, but recommended) sudo -u postgres psql postgres=# create database gancio; postgres=# create user gancio with encrypted password &#39;gancio&#39;; postgres=# grant all privileges on database gancio to gancio; Create a user to run gancio from adduser gancio su gancio Test &amp; launch interactive setup gancio --help gancio setup --config config.json Start gancio --help gancio start --config config.json Point your web browser to http://localhost:13120 or where you selected during setup. Setup nginx as a proxy Deploy in production If you dont use the docker way, in production you should use something like pm2: sudo npm install --global pm2 pm2 gancio start --config config.json",
"url": "https://gancio.org/install/classic",
"relUrl": "/install/classic"
},
"3": {
"id": "3",
"title": "Configuration",
"content": "Configuration 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. eg. gancio start --config ./config.json eg. pm2 start gancio start -- --config ~/config.json Title Description BaseURL Server Database Upload path SMTP Admin Favicon User locale Secret Default settings Title The title will be in rss feed, in html head and in emails: &quot;title&quot;: &quot;Gancio&quot; Description &quot;description&quot;: &quot;a shared agenda for local communities&quot; BaseURL URL where your site will be accessible (include http or https): &quot;baseurl&quot;: &quot;https://gancio.cisti.org&quot; Server This probably support unix socket too :D &quot;server&quot;: { &quot;host&quot;: &quot;localhost&quot;, &quot;port&quot;: 13120 } Database &quot;db&quot;: { &quot;dialect&quot;: &quot;sqlite&quot;, &quot;storage&quot;: &quot;/tmp/db.sqlite&quot; } Upload path Where to save images &quot;upload_path&quot;: &quot;./uploads&quot; SMTP Admin Favicon You could specify another favicon. This is also used as logo (top-left corner): &quot;favicon&quot;: &quot;./favicon.ico&quot; User locale Probably you want to modify some text for your specific community, thats 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, lets 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: export default { about: &#39;A new about&#39; } and then point the user_locale configuration to that directory: &quot;user_locale&quot;: &quot;/opt/gancio/user_locale&quot; Watch here for a list of strings you can override. :warning: Note that a restart is needed when you change user_locales content. Secret Default settings { &quot;title&quot;: &quot;Gancio&quot;, &quot;description&quot;: &quot;A shared agenda for local communities&quot;, &quot;baseurl&quot;: &quot;http://localhost:13120&quot;, &quot;server&quot;: { &quot;host&quot;: &quot;0.0.0.0&quot;, &quot;port&quot;: 13120 }, &quot;db&quot;: { &quot;dialect&quot;: &quot;sqlite&quot;, &quot;storage&quot;: &quot;/tmp/db.sqlite&quot; }, &quot;upload_path&quot;: &quot;./&quot;, &quot;favicon&quot;: &quot;../dist/favicon.ico&quot;, &quot;smtp&quot;: { &quot;auth&quot;: { &quot;user&quot;: &quot;&quot;, &quot;pass&quot;: &quot;&quot; }, &quot;secure&quot;: true, &quot;host&quot;: &quot;&quot; }, &quot;admin&quot;: &quot;&quot;, &quot;secret&quot;: &quot;notsosecret&quot; }",
"url": "https://gancio.org/config",
"relUrl": "/config"
},
"4": {
"id": "4",
"3": {
"id": "3",
"title": "Contribute",
"content": "Contribute If you want to contribute, take a look at the issues Code Translate Design Documentation Share Code Translate Design Documentation Share",
"url": "https://gancio.org/contribute",
"relUrl": "/contribute"
},
"4": {
"id": "4",
"title": "Debian",
"content": "Debian installation Install Node.js &amp; yarn (from root) curl -sL https://deb.nodesource.com/setup_12.x | bash - apt-get install -y nodejs curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - echo &quot;deb https://dl.yarnpkg.com/debian/ stable main&quot; &gt; /etc/apt/sources.list.d/yarn.list apt-get update &amp;&amp; apt-get install yarn source Install Gancio yarn add gancio --prod Setup with postgreSQL (optional as you can choose sqlite) apt-get install postgresql # Create the database su postgres -c psql postgres=# create database gancio; postgres=# create user gancio with encrypted password &#39;gancio&#39;; postgres=# grant all privileges on database gancio to gancio; Create a user to run gancio from adduser gancio su gancio Test &amp; launch interactive setup gancio --help gancio setup --config config.json Start gancio --help gancio start --config config.json Point your web browser to http://localhost:13120 or where you selected during setup. Setup nginx as a proxy Deploy in production If you dont use the docker way, in production you should use something like pm2: sudo yarn global add pm2 pm2 gancio start --config config.json",
"url": "https://gancio.org/install/debian",
"relUrl": "/install/debian"
},
"5": {
"id": "5",
"title": "Hacking",
@@ -44,7 +44,7 @@
"6": {
"id": "6",
"title": "Docker",
"content": "Install with docker You do not need to clone the full repo as we distribute gancio via npm. Dockerfile and docker-compose.yml are the only needed files. Create a directory where everything related to gancio is stored (db, images, config) mkdir /opt/gancio cd /opt/gancio :information_source: you can choose a different directory of course Download docker-compose.yml and Dockerfile wget https://git.lattuga.net/cisti/gancio/raw/master/docker/Dockerfile wget https://git.lattuga.net/cisti/gancio/raw/master/docker/docker-compose.yml Create an empty configuration file (db.sqlite only needed for sqlite setup) touch config.json db.sqlite After first setup, you can edit config.json file and restart the container on your needs. Build docker image and launch interactive setup in one step docker-compose run --rm gancio gancio setup --docker Run your container docker-compose up -d Setup nginx as a proxy Point your web browser to http://localhost:13120 or where you specified during setup and enjoy :tada:",
"content": "Install with docker 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) mkdir /opt/gancio cd /opt/gancio :information_source: you can choose a different directory. Using postgreSQL Download docker-compose.yml and Dockerfile wget https://git.lattuga.net/cisti/gancio/raw/master/docker/Dockerfile wget https://git.lattuga.net/cisti/gancio/raw/master/docker/docker-compose.postgresql.yml -O docker.compose.yml Create an empty configiguration (this is needed) touch config.json Using sqlite Download docker-compose.yml and Dockerfile wget https://git.lattuga.net/cisti/gancio/raw/master/docker/Dockerfile wget https://git.lattuga.net/cisti/gancio/raw/master/docker/docker-compose.sqlite.yml -O docker-compose.yml Create an empty db and config (this is needed) touch config.json db.sqlite Finish Build docker image and launch interactive setup in one step docker-compose run --rm gancio gancio setup --docker Run your container docker-compose up -d Setup nginx as a proxy Point your web browser to http://localhost:13120 or where you specified during setup and enjoy :tada: You can edit config.json file and restart the container on your needs, see Configuration for more details.",
"url": "https://gancio.org/install/docker",
"relUrl": "/install/docker"
},
@@ -58,7 +58,7 @@
"8": {
"id": "8",
"title": "Install",
"content": "Install Classic install Using docker Nginx as a proxy Hacking &amp; contribute",
"content": "Install (production) Install on Debian Install using docker Post installation Nginx as a proxy If you wanna hack or run the current develop release take a look at Hacking &amp; contribute",
"url": "https://gancio.org/install",
"relUrl": "/install"
},
@@ -86,7 +86,7 @@
"12": {
"id": "12",
"title": "Project Structure",
"content": "Structure API / backend Source code inside server/api/. index.js is basically a routing table pointing each PATH with specified HTTP VERB to a method of a controller. jwt is used to authenticate api request. Express is based on middleware, passing each request to a chain of methods. If you come from a PHP background, note that the main difference with Node.js is that the server process is always running and able to manage multiple requests and tasks together (asyncronically) while each php process is tied to a single request. Sequelize is used as ORM. Take a look in /server/api/models. Client / frontend Nuxt.js is used here! Nuxt is basically Vue plus SSR (Server Side Rendering). Client routing in nuxt is automatic (if you dont need something special), just put your page inside pages and thats it!",
"content": "Project structure API / backend Client / frontend Federation / ActivityPub API / backend Source code inside server/api/. index.js is basically a routing table pointing each PATH with specified HTTP VERB to a method of a controller. jwt is used to authenticate api request. Express.js is based on middleware, passing each request to a chain of methods. If you come from a PHP background, note that the main difference with Node.js is that the server process is always running and able to manage multiple requests and tasks together (asyncronically) while each php process is tied to a single request. Sequelize is used as ORM. Take a look in /server/api/models. Client / frontend Nuxt.js is used here! Nuxt is basically Vue plus SSR (Server Side Rendering). Client routing in nuxt is automatic (if you dont need something special), just put your page inside pages and thats it! Federation / ActivityPub Code inside server/federation.",
"url": "https://gancio.org/dev/structure",
"relUrl": "/dev/structure"
},

View File

@@ -105,7 +105,7 @@
<li class="navigation-list-item ">
<a href="https://gancio.org/install/classic" class="navigation-list-link">Classic</a>
<a href="https://gancio.org/install/debian" class="navigation-list-link">Debian</a>
</li>

View File

@@ -105,7 +105,7 @@
<li class="navigation-list-item ">
<a href="https://gancio.org/install/classic" class="navigation-list-link">Classic</a>
<a href="https://gancio.org/install/debian" class="navigation-list-link">Debian</a>
</li>

View File

@@ -105,7 +105,7 @@
<li class="navigation-list-item ">
<a href="https://gancio.org/install/classic" class="navigation-list-link">Classic</a>
<a href="https://gancio.org/install/debian" class="navigation-list-link">Debian</a>
</li>
@@ -297,10 +297,10 @@
<ul>
<li><a href="https://nuxtjs.org/">Nuxt.js</a></li>
<li>Vue.js</li>
<li><a href="https://vuejs.org/">Vue.js</a></li>
<li>Express</li>
<li>Node.js</li>
<li>Sequelize</li>
<li><a href="https://sequelize.org/">Sequelize</a></li>
<li>Element.ui</li>
</ul>

View File

@@ -105,7 +105,7 @@
<li class="navigation-list-item ">
<a href="https://gancio.org/install/classic" class="navigation-list-link">Classic</a>
<a href="https://gancio.org/install/debian" class="navigation-list-link">Debian</a>
</li>

View File

@@ -105,7 +105,7 @@
<li class="navigation-list-item ">
<a href="https://gancio.org/install/classic" class="navigation-list-link">Classic</a>
<a href="https://gancio.org/install/debian" class="navigation-list-link">Debian</a>
</li>
@@ -300,24 +300,29 @@
<div id="main-content" class="page-content" role="main">
<h3 id="structure">Structure</h3>
<h3 class="no_toc" id="project-structure">Project structure</h3>
<ol id="markdown-toc">
<li><a href="#api--backend" id="markdown-toc-api--backend">API / backend</a></li>
<li><a href="#client--frontend" id="markdown-toc-client--frontend">Client / frontend</a></li>
<li><a href="#federation--activitypub" id="markdown-toc-federation--activitypub">Federation / ActivityPub</a></li>
</ol>
<h3 id="api--backend">API / backend</h3>
<p>Source code inside <code class="highlighter-rouge">server/api/</code>.
<p>Source code inside <code class="highlighter-rouge">server/api/</code>.<br />
<code class="highlighter-rouge">index.js</code> is basically a routing table pointing each PATH with specified
HTTP VERB to a method of a controller.</p>
<p>jwt is used to authenticate api request.</p>
<p>Express is based on middleware, passing each request to a chain of methods.</p>
<p><a href="https://expressjs.com/">Express.js</a> is based on middleware, passing each request to a chain of methods.</p>
<p>If you come from a PHP background, note that the main difference with
Node.js is that the server process is always running and able to manage
<a href="https://en.wikipedia.org/wiki/Node.js">Node.js</a> is that the server process is always running and able to manage
multiple requests and tasks together (asyncronically) while each php
process is tied to a single request.</p>
<p>Sequelize is used as ORM. Take a look in <code class="highlighter-rouge">/server/api/models</code>.</p>
<p><a href="https://sequelize.org/">Sequelize</a> is used as ORM. Take a look in <a href="https://git.lattuga.net/cisti/gancio/src/master/server/api/models"><code class="highlighter-rouge">/server/api/models</code></a>.</p>
<h3 id="client--frontend">Client / frontend</h3>
<p>Nuxt.js is used here!<br />
@@ -325,6 +330,8 @@ Nuxt is basically Vue plus SSR (Server Side Rendering).
Client routing in nuxt is automatic (if you dont need something special),
just put your page inside <code class="highlighter-rouge">pages</code> and thats it!</p>
<h3 id="federation--activitypub">Federation / ActivityPub</h3>
<p>Code inside <a href="https://git.lattuga.net/cisti/gancio/src/master/server/federation"><code class="highlighter-rouge">server/federation</code></a>.</p>

View File

@@ -1 +1 @@
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.8.6">Jekyll</generator><link href="https://gancio.org/feed.xml" rel="self" type="application/atom+xml" /><link href="https://gancio.org/" rel="alternate" type="text/html" /><updated>2019-08-05T01:50:43+02:00</updated><id>https://gancio.org/feed.xml</id><title type="html">Gancio</title><subtitle>A shared agenda for local communities</subtitle></feed>
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.8.6">Jekyll</generator><link href="https://gancio.org/feed.xml" rel="self" type="application/atom+xml" /><link href="https://gancio.org/" rel="alternate" type="text/html" /><updated>2019-08-06T01:01:30+02:00</updated><id>https://gancio.org/feed.xml</id><title type="html">Gancio</title><subtitle>A shared agenda for local communities</subtitle></feed>

View File

@@ -107,7 +107,7 @@
<li class="navigation-list-item ">
<a href="https://gancio.org/install/classic" class="navigation-list-link">Classic</a>
<a href="https://gancio.org/install/debian" class="navigation-list-link">Debian</a>
</li>

View File

@@ -105,7 +105,7 @@
<li class="navigation-list-item ">
<a href="https://gancio.org/install/classic" class="navigation-list-link">Classic</a>
<a href="https://gancio.org/install/debian" class="navigation-list-link">Debian</a>
</li>
@@ -291,15 +291,20 @@
<div id="main-content" class="page-content" role="main">
<h1 id="install">Install</h1>
<h1 id="install-production">Install (production)</h1>
<ul>
<li><a href="/install/classic">Classic install</a></li>
<li><a href="/install/docker">Using docker</a></li>
<li><a href="/install/nginx">Nginx as a proxy</a></li>
<li><a href="../dev">Hacking &amp; contribute</a></li>
<li><a href="/install/debian">Install on Debian</a></li>
<li><a href="/install/docker">Install using docker</a></li>
</ul>
<h3 id="post-installation">Post installation</h3>
<ul>
<li><a href="/install/nginx">Nginx as a proxy</a></li>
</ul>
<p>If you wanna hack or run the current develop release take a look at <a href="../dev">Hacking &amp; contribute</a></p>
</div>

View File

@@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<title>Classic - Gancio</title>
<title>Debian - Gancio</title>
@@ -25,17 +25,17 @@
<script src="https://gancio.org/assets/js/jquery.fancybox.min.js"></script>
<!-- Begin Jekyll SEO tag v2.6.1 -->
<title>Classic | Gancio</title>
<title>Debian | Gancio</title>
<meta name="generator" content="Jekyll v3.8.6" />
<meta property="og:title" content="Classic" />
<meta property="og:title" content="Debian" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="A shared agenda for local communities" />
<meta property="og:description" content="A shared agenda for local communities" />
<link rel="canonical" href="https://gancio.org/install/classic" />
<meta property="og:url" content="https://gancio.org/install/classic" />
<link rel="canonical" href="https://gancio.org/install/debian" />
<meta property="og:url" content="https://gancio.org/install/debian" />
<meta property="og:site_name" content="Gancio" />
<script type="application/ld+json">
{"@type":"WebPage","url":"https://gancio.org/install/classic","headline":"Classic","description":"A shared agenda for local communities","@context":"https://schema.org"}</script>
{"@type":"WebPage","url":"https://gancio.org/install/debian","headline":"Debian","description":"A shared agenda for local communities","@context":"https://schema.org"}</script>
<!-- End Jekyll SEO tag -->
</head>
@@ -105,7 +105,7 @@
<li class="navigation-list-item active">
<a href="https://gancio.org/install/classic" class="navigation-list-link active">Classic</a>
<a href="https://gancio.org/install/debian" class="navigation-list-link active">Debian</a>
</li>
@@ -294,27 +294,32 @@
<li class="breadcrumb-nav-list-item"><a href="https://gancio.org/install">Install</a></li>
<li class="breadcrumb-nav-list-item"><span>Classic</span></li>
<li class="breadcrumb-nav-list-item"><span>Debian</span></li>
</ol>
</nav>
<div id="main-content" class="page-content" role="main">
<h2 id="install">Install</h2>
<h2 id="debian-installation">Debian installation</h2>
<ol>
<li>Install Node.js and postgreSQL
<li>Install Node.js &amp; yarn (<strong>from root</strong>)
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl <span class="nt">-sL</span> https://deb.nodesource.com/setup_12.x | bash -
apt-get <span class="nb">install</span> <span class="nt">-y</span> nodejs postgresql
apt-get <span class="nb">install</span> <span class="nt">-y</span> nodejs
curl <span class="nt">-sL</span> https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
<span class="nb">echo</span> <span class="s2">"deb https://dl.yarnpkg.com/debian/ stable main"</span> <span class="o">&gt;</span> /etc/apt/sources.list.d/yarn.list
apt-get update <span class="o">&amp;&amp;</span> apt-get <span class="nb">install </span>yarn
</code></pre></div> </div>
<p><small><a href="https://github.com/nodesource/distributions/blob/master/README.md">source</a></small></p>
</li>
<li>Install Gancio
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>npm <span class="nb">install</span> <span class="nt">--global</span> gancio
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>yarn add gancio <span class="nt">--prod</span>
</code></pre></div> </div>
</li>
<li>Create a database (optional as you can use sqlite, but recommended)
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo</span> <span class="nt">-u</span> postgres psql
<li>Setup with postgreSQL (optional as you can choose sqlite)
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>apt-get <span class="nb">install </span>postgresql
<span class="c"># Create the database</span>
su postgres <span class="nt">-c</span> psql
<span class="nv">postgres</span><span class="o">=</span><span class="c"># create database gancio;</span>
<span class="nv">postgres</span><span class="o">=</span><span class="c"># create user gancio with encrypted password 'gancio';</span>
<span class="nv">postgres</span><span class="o">=</span><span class="c"># grant all privileges on database gancio to gancio;</span>
@@ -339,13 +344,13 @@ gancio start <span class="nt">--config</span> config.json
<p>Point your web browser to <a href="http://localhost:13120">http://localhost:13120</a> or where you selected during setup.</p>
</li>
<li>
<p><a href="/setup/nginx">Setup nginx as a proxy</a></p>
<p><a href="/install/nginx">Setup nginx as a proxy</a></p>
</li>
<li>Deploy in production<br />
If you dont use the <a href="/setup/docker">docker way</a>, in production you should use something like <strong><a href="http://pm2.keymetrics.io/">pm2</a></strong>:</li>
If you dont use the <a href="/install/docker">docker way</a>, in production you should use something like <strong><a href="http://pm2.keymetrics.io/">pm2</a></strong>:</li>
</ol>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>npm <span class="nb">install</span> <span class="nt">--global</span> pm2
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>yarn global add pm2
pm2 gancio start <span class="nt">--config</span> config.json
</code></pre></div></div>

View File

@@ -105,7 +105,7 @@
<li class="navigation-list-item ">
<a href="https://gancio.org/install/classic" class="navigation-list-link">Classic</a>
<a href="https://gancio.org/install/debian" class="navigation-list-link">Debian</a>
</li>
@@ -302,9 +302,8 @@
<div id="main-content" class="page-content" role="main">
<h2 id="install-with-docker">Install with docker</h2>
<p><strong>You do not need to clone the full repo as we distribute gancio via npm.</strong><br>
<a href="https://git.lattuga.net/cisti/gancio/raw/docker/docker/Dockerfile">Dockerfile</a> and <a href="https://git.lattuga.net/cisti/gancio/raw/docker/docker/docker-compose.yml">docker-compose.yml</a> are the only needed files.</p>
A <a href="https://git.lattuga.net/cisti/gancio/raw/docker/docker/Dockerfile">Dockerfile</a> and a docker-compose.yml are the only files needed.</p>
<ol>
<li>Create a directory where everything related to gancio is stored (db, images, config)
@@ -312,21 +311,43 @@
<div class="highlight"><pre class="highlight"><code><span class="nb">mkdir</span> /opt/gancio
<span class="nb">cd</span> /opt/gancio
</code></pre></div> </div>
<p><img class="emoji" title=":information_source:" alt=":information_source:" src="https://github.githubassets.com/images/icons/emoji/unicode/2139.png" height="20" width="20"> you can choose a different directory of course</p>
<p><img class="emoji" title=":information_source:" alt=":information_source:" src="https://github.githubassets.com/images/icons/emoji/unicode/2139.png" height="20" width="20"> <small>you can choose a different directory.</small></p>
</li>
</ol>
<h3 id="using-postgresql">Using postgreSQL</h3>
<ol>
<li>Download docker-compose.yml and Dockerfile
<div class="language-bash highlighter-rouge">
<div class="highlight"><pre class="highlight"><code>wget https://git.lattuga.net/cisti/gancio/raw/master/docker/Dockerfile
wget https://git.lattuga.net/cisti/gancio/raw/master/docker/docker-compose.yml
wget https://git.lattuga.net/cisti/gancio/raw/master/docker/docker-compose.postgresql.yml <span class="nt">-O</span> docker.compose.yml
</code></pre></div> </div>
</li>
<li>Create an empty configuration file (db.sqlite only needed for sqlite
setup)
<li>Create an empty configiguration (<strong>this is needed</strong>)
<div class="highlighter-rouge">
<div class="highlight"><pre class="highlight"><code>touch config.json
</code></pre></div> </div>
</li>
</ol>
<h3 id="using-sqlite">Using sqlite</h3>
<ol>
<li>Download docker-compose.yml and Dockerfile
<div class="language-bash highlighter-rouge">
<div class="highlight"><pre class="highlight"><code>wget https://git.lattuga.net/cisti/gancio/raw/master/docker/Dockerfile
wget https://git.lattuga.net/cisti/gancio/raw/master/docker/docker-compose.sqlite.yml <span class="nt">-O</span> docker-compose.yml
</code></pre></div> </div>
</li>
<li>Create an empty db and config (<strong>this is needed</strong>)
<div class="highlighter-rouge">
<div class="highlight"><pre class="highlight"><code>touch config.json db.sqlite
</code></pre></div> </div>
<p><small>After first setup, you can edit <code class="highlighter-rouge">config.json</code> file and restart the container on your needs.</small></p>
</li>
</ol>
<h3 id="finish">Finish</h3>
<ol>
<li>Build docker image and launch interactive setup in one step
<div class="highlighter-rouge">
<div class="highlight"><pre class="highlight"><code>docker-compose run --rm gancio gancio setup --docker
@@ -338,10 +359,12 @@ setup)
</code></pre></div> </div>
</li>
<li>
<p><a href="/setup/nginx">Setup nginx as a proxy</a></p>
<p><a href="/install/nginx">Setup nginx as a proxy</a></p>
</li>
<li>Point your web browser to <a href="http://localhost:13120">http://localhost:13120</a> or where you specified during setup and enjoy <img class="emoji" title=":tada:" alt=":tada:" src="https://github.githubassets.com/images/icons/emoji/unicode/1f389.png" height="20" width="20">
</li>
<li>
<p>Point your web browser to <a href="http://localhost:13120">http://localhost:13120</a> or where you specified during setup and enjoy <img class="emoji" title=":tada:" alt=":tada:" src="https://github.githubassets.com/images/icons/emoji/unicode/1f389.png" height="20" width="20"></p>
</li>
<li>You can edit <code class="highlighter-rouge">config.json</code> file and restart the container on your needs, see <a href="/config">Configuration</a> for more details.</li>
</ol>

View File

@@ -105,7 +105,7 @@
<li class="navigation-list-item ">
<a href="https://gancio.org/install/classic" class="navigation-list-link">Classic</a>
<a href="https://gancio.org/install/debian" class="navigation-list-link">Debian</a>
</li>

View File

@@ -105,7 +105,7 @@
<li class="navigation-list-item ">
<a href="https://gancio.org/install/classic" class="navigation-list-link">Classic</a>
<a href="https://gancio.org/install/debian" class="navigation-list-link">Debian</a>
</li>

View File

@@ -105,7 +105,7 @@
<li class="navigation-list-item ">
<a href="https://gancio.org/install/classic" class="navigation-list-link">Classic</a>
<a href="https://gancio.org/install/debian" class="navigation-list-link">Debian</a>
</li>

View File

@@ -11,10 +11,10 @@ has_children: true
**Gancio** is built with following technologies:
- [Nuxt.js](https://nuxtjs.org/)
- Vue.js
- [Vue.js](https://vuejs.org/)
- Express
- Node.js
- Sequelize
- [Sequelize](https://sequelize.org/)
- Element.ui
### Testing on your own machine

View File

@@ -5,25 +5,28 @@ permalink: /dev/structure
parent: Hacking
---
### Structure
### Project structure
{: .no_toc }
1. TOC
{:toc}
### API / backend
Source code inside `server/api/`.
Source code inside `server/api/`.
`index.js` is basically a routing table pointing each PATH with specified
HTTP VERB to a method of a controller.
jwt is used to authenticate api request.
Express is based on middleware, passing each request to a chain of methods.
[Express.js](https://expressjs.com/) is based on middleware, passing each request to a chain of methods.
If you come from a PHP background, note that the main difference with
Node.js is that the server process is always running and able to manage
[Node.js](https://en.wikipedia.org/wiki/Node.js) is that the server process is always running and able to manage
multiple requests and tasks together (asyncronically) while each php
process is tied to a single request.
Sequelize is used as ORM. Take a look in `/server/api/models`.
[Sequelize](https://sequelize.org/) is used as ORM. Take a look in [`/server/api/models`](https://git.lattuga.net/cisti/gancio/src/master/server/api/models).
### Client / frontend
@@ -33,4 +36,5 @@ Client routing in nuxt is automatic (if you don't need something special),
just put your page inside `pages` and that's it!
### Federation / ActivityPub
Code inside [`server/federation`](https://git.lattuga.net/cisti/gancio/src/master/server/federation).

View File

@@ -1,25 +1,32 @@
---
layout: default
title: Classic
permalink: /install/classic
title: Debian
permalink: /install/debian
parent: Install
---
## Install
## Debian installation
1. Install Node.js and postgreSQL
1. Install Node.js & yarn (**from root**)
```bash
curl -sL https://deb.nodesource.com/setup_12.x | bash -
apt-get install -y nodejs postgresql
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
apt-get update && apt-get install yarn
```
<small>[source](https://github.com/nodesource/distributions/blob/master/README.md)</small>
1. Install Gancio
```bash
npm install --global gancio
yarn add gancio --prod
```
1. Create a database (optional as you can use sqlite, but recommended)
1. Setup with postgreSQL (optional as you can choose sqlite)
```bash
sudo -u postgres psql
apt-get install postgresql
# Create the database
su postgres -c psql
postgres=# create database gancio;
postgres=# create user gancio with encrypted password 'gancio';
postgres=# grant all privileges on database gancio to gancio;
@@ -44,12 +51,12 @@ gancio start --config config.json
```
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. [Setup nginx as a proxy](/install/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/)**:
If you don't use the [docker way](/install/docker), in production you should use something like **[pm2](http://pm2.keymetrics.io/)**:
```bash
sudo npm install --global pm2
sudo yarn global add pm2
pm2 gancio start --config config.json
```

View File

@@ -6,29 +6,41 @@ parent: Install
---
## 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.
A [Dockerfile](https://git.lattuga.net/cisti/gancio/raw/docker/docker/Dockerfile) and a docker-compose.yml are the only files needed.
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
:information_source: <small>you can choose a different directory.</small>
### Using postgreSQL
1. Download docker-compose.yml and Dockerfile
```bash
wget https://git.lattuga.net/cisti/gancio/raw/master/docker/Dockerfile
wget https://git.lattuga.net/cisti/gancio/raw/master/docker/docker-compose.yml
wget https://git.lattuga.net/cisti/gancio/raw/master/docker/docker-compose.postgresql.yml -O docker.compose.yml
```
1. Create an empty configuration file (db.sqlite only needed for sqlite
setup)
1. Create an empty configiguration (**this is needed**)
```
touch config.json
```
### Using sqlite
1. Download docker-compose.yml and Dockerfile
```bash
wget https://git.lattuga.net/cisti/gancio/raw/master/docker/Dockerfile
wget https://git.lattuga.net/cisti/gancio/raw/master/docker/docker-compose.sqlite.yml -O docker-compose.yml
```
1. Create an empty db and config (**this is needed**)
```
touch config.json db.sqlite
```
<small>After first setup, you can edit `config.json` file and restart the container on your needs.</small>
### Finish
1. Build docker image and launch interactive setup in one step
```
@@ -40,6 +52,8 @@ docker-compose run --rm gancio gancio setup --docker
docker-compose up -d
```
1. [Setup nginx as a proxy](/setup/nginx)
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.

View File

@@ -7,10 +7,13 @@ nav_order: 2
has_toc: false
---
# Install
# Install (production)
- [Install on Debian](/install/debian)
- [Install using docker](/install/docker)
- [Classic install](/install/classic)
- [Using docker](/install/docker)
### Post installation
- [Nginx as a proxy](/install/nginx)
- [Hacking & contribute](../dev)
If you wanna hack or run the current develop release take a look at [Hacking & contribute](../dev)

View File

@@ -44,7 +44,7 @@
"body-parser": "^1.18.3",
"bootstrap": "^4.3.1",
"config": "^3.2.0",
"consola": "^2.9.0",
"consola": "^2.10.1",
"cookie-parser": "^1.4.4",
"cors": "^2.8.5",
"cross-env": "^5.2.0",
@@ -54,7 +54,7 @@
"express": "^4.17.1",
"express-jwt": "^5.3.1",
"http-signature": "^1.2.0",
"ics": "^2.15.1",
"ics": "^2.16.0",
"inquirer": "^6.5.0",
"jsonwebtoken": "^8.5.1",
"less": "^3.9.0",
@@ -66,9 +66,9 @@
"nuxt": "^2.8.1",
"pg": "^7.11.0",
"sass-loader": "^7.1.0",
"sequelize": "^5.10.1",
"sequelize": "^5.12.3",
"sequelize-cli": "^5.4.0",
"sharp": "^0.22.0",
"sharp": "^0.23.0",
"sqlite3": "^4.0.8",
"v-calendar": "^1.0.0-beta.14",
"vue-awesome": "^3.5.3",
@@ -84,7 +84,7 @@
"eslint-config-standard": ">=13.0.1",
"eslint-loader": "^2.2.1",
"eslint-plugin-import": ">=2.17.3",
"eslint-plugin-jest": ">=22.11.1",
"eslint-plugin-jest": ">=22.14.1",
"eslint-plugin-node": ">=9.1.0",
"eslint-plugin-nuxt": ">=0.4.2",
"eslint-plugin-prettier": "^3.1.0",

View File

@@ -1,5 +1,5 @@
'use strict'
module.exports = (sequelize, DataTypes) => {
module.exports = (sequelize, DataTypes) => {
const comment = sequelize.define('comment', {
activitypub_id: {
type: DataTypes.STRING(18),
@@ -10,8 +10,6 @@ module.exports = (sequelize, DataTypes) => {
}, {})
comment.associate = function (models) {
comment.belongsTo(models.event)
// Event.hasMany(Comment)
// associations can be defined here
}
return comment
};

View File

@@ -19,7 +19,7 @@ function notEmpty (value) {
return value.length>0
}
async function setupQuestionnaire(is_docker) {
async function setupQuestionnaire(is_docker, db) {
const questions = []
questions.push({
@@ -53,6 +53,7 @@ async function setupQuestionnaire(is_docker) {
name: 'db.dialect',
message: 'DB dialect',
type: 'list',
when: answers => !db,
choices: ['sqlite', 'postgres']
})
@@ -61,7 +62,7 @@ async function setupQuestionnaire(is_docker) {
message: 'sqlite db path',
default: is_docker ? '/opt/gancio/db.sqlite' : './db.sqlite',
filter: p => path.resolve(cwd, p),
when: answers => answers.db.dialect === 'sqlite',
when: answers => (db && db==='sqlite') || (answers.db && answers.db.dialect === 'sqlite'),
validate: db_path => db_path.length>0 && fs.existsSync(path.dirname(db_path))
})
@@ -69,7 +70,7 @@ async function setupQuestionnaire(is_docker) {
name: 'db.host',
message: 'Postgres host',
default: is_docker ? 'db' : 'localhost',
when: answers => answers.db.dialect === 'postgres',
when: answers => (db && db==='postgresql') || (answers.db && answers.db.dialect === 'postgres'),
validate: notEmpty
})
@@ -77,7 +78,7 @@ async function setupQuestionnaire(is_docker) {
name: 'db.database',
message: 'DB name',
default: 'gancio',
when: answers => answers.db.dialect === 'postgres',
when: answers => (db && db==='postgresql') || (answers.db && answers.db.dialect === 'postgres'),
validate: notEmpty
})
@@ -85,7 +86,7 @@ async function setupQuestionnaire(is_docker) {
name: 'db.username',
message: 'DB user',
default: 'gancio',
when: answers => answers.db.dialect === 'postgres',
when: answers => (db && db==='postgresql') || (answers.db && answers.db.dialect === 'postgres'),
validate: notEmpty
})
@@ -94,7 +95,7 @@ async function setupQuestionnaire(is_docker) {
type: 'password',
message: 'DB password',
default: 'gancio',
when: answers => answers.db.dialect === 'postgres',
when: answers => (db && db==='postgresql') || (answers.db && answers.db.dialect === 'postgres'),
validate: async (password, options) => {
try {
const db = new sequelize({ ...options.db, dialect: 'postgres' , password, logging: false })
@@ -112,7 +113,8 @@ async function setupQuestionnaire(is_docker) {
questions.push({
name: 'upload_path',
message: 'Where gancio has to store media?',
default: '/opt/gancio/uploads',
default: is_docker ? '/opt/gancio/uploads' : './uploads',
when: answers => !is_docker,
filter: p => path.resolve(cwd, p),
validate: async p => {
let exists = fs.existsSync(p)
@@ -182,9 +184,6 @@ async function upgrade (options) {
}
})
const migrations = await umzug.up()
if (migrations.length) {
consola.info('Migrations executed: ', migrations.map(m => m.file))
}
db.close()
}
@@ -205,10 +204,10 @@ If this is your first run use 'gancio setup --config <CONFIG_FILE.json>' `)
}
async function setup (options) {
consola.info('DOCKER ', options.docker)
consola.info(`You're going to setup gancio on this machine.`)
const config = await setupQuestionnaire(options.docker)
await firstrun.setup(config, options.config)
const config = await setupQuestionnaire(options.docker, options.db)
const ret = await firstrun.setup(config, options.config)
if (!ret) process.exit(-1)
if (options.docker) {
consola.info(`You can edit ./config.json to modify your configuration.`)
consola.info(`Start the server with "docker-compose up"`)
@@ -229,6 +228,9 @@ require('yargs')
default: false,
type: 'boolean'
})
.option('db', {
describe: 'Specify db type',
})
.option('config', {
alias: 'c',
describe: 'Configuration file',

View File

@@ -26,14 +26,14 @@ module.exports = {
try {
await db.user.findAll()
consola.warn(`⚠️ Non empty db! Please move your current db elsewhere than retry.`)
return -1
consola.warn(`⚠️ Non empty db! Please move your current db elsewhere than retry.`)
return false
} catch(e) { }
consola.info(`Create tables schema`)
await db.sequelize.sync().catch(e => {
consola.error('Error creating tables', e)
return -1
return false
})
// create admin user

754
yarn.lock

File diff suppressed because it is too large Load Diff