aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.dockerignore22
-rw-r--r--.env.example2
-rw-r--r--.gitignore3
-rw-r--r--Dockerfile26
-rw-r--r--LICENSE2
-rw-r--r--README.md41
-rw-r--r--docker/.gitignore12
-rw-r--r--docker/README.md214
-rw-r--r--docker/docker-compose.yml38
-rwxr-xr-xdocker/entrypoint.sh47
-rw-r--r--docker/logo.pngbin0 -> 340668 bytes
11 files changed, 364 insertions, 43 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..01c565b
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,22 @@
1.DS_Store
2
3# ignore .git and .cache folders
4.git
5.gitignore
6.github
7.gitattributes
8.cache
9
10# ignore all markdown files
11*.md
12
13# Ignore database files
14*.sqlite
15
16# ignore other directories
17docker
18!docker/entrypoint.sh
19node_modules
20
21
22
diff --git a/.env.example b/.env.example
index d507d6c..a11ce1f 100644
--- a/.env.example
+++ b/.env.example
@@ -10,7 +10,7 @@ CACHE_VIEWS=false
10 10
11APP_KEY= 11APP_KEY=
12 12
13DATA_DIR=data 13DATA_DIR=
14 14
15DB_CONNECTION=sqlite 15DB_CONNECTION=sqlite
16DB_HOST=127.0.0.1 16DB_HOST=127.0.0.1
diff --git a/.gitignore b/.gitignore
index 79f578b..a8bc908 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,8 +8,7 @@ tmp
8.env 8.env
9 9
10# The development sqlite file 10# The development sqlite file
11data*/development.sqlite 11*.sqlite
12data*/adonis.sqlite
13 12
14# Uploaded recipes 13# Uploaded recipes
15recipes/ 14recipes/
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..416c503
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,26 @@
1FROM node:lts-alpine as build
2
3WORKDIR /server-build
4
5RUN ["apk", "add", "--no-cache", "python", "make", "gcc", "g++", "libc-dev", "sqlite-dev"]
6
7COPY . /server-build
8
9RUN ["npm", "ci", "--production", "--build-from-source", "--sqlite=/usr/local"]
10
11FROM node:lts-alpine
12
13WORKDIR /app
14LABEL maintainer="xthursdayx"
15
16ENV HOST=0.0.0.0 PORT=3333
17
18RUN ["apk", "add", "--no-cache", "sqlite-libs", "curl"]
19
20COPY --from=build /server-build /app
21RUN ["npm", "i", "-g", "@adonisjs/cli"]
22
23HEALTHCHECK --interval=5m --timeout=3s CMD curl -sSf http://localhost:${PORT}/health
24
25COPY docker/entrypoint.sh /entrypoint.sh
26CMD ["/entrypoint.sh"] \ No newline at end of file
diff --git a/LICENSE b/LICENSE
index 2ae8432..1633187 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
1MIT License 1MIT License
2 2
3Copyright (c) 2019 vantezzen 3Copyright (c) 2019 Ferdi
4 4
5Permission is hereby granted, free of charge, to any person obtaining a copy 5Permission is hereby granted, free of charge, to any person obtaining a copy
6of this software and associated documentation files (the "Software"), to deal 6of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index d6ff0ff..40834e2 100644
--- a/README.md
+++ b/README.md
@@ -79,48 +79,11 @@ After setting up the docker container we recommend you to set up an NGINX revers
79 getferdi/ferdi-server 79 getferdi/ferdi-server
80 ``` 80 ```
81 81
82 Alternatively, you can also use docker-compose v2 schemas 82 Alternatively, you can also use docker-compose v2 schema. An example can be found [in the docker folder](./docker/docker-compose.yml).
83
84 ```sh
85 ---
86 version: "2"
87 services:
88 ferdi-server:
89 image: getferdi/ferdi-server
90 container_name: ferdi-server
91 environment:
92 - NODE_ENV=development
93 - EXTERNAL_DOMAIN=<ferdi-serverdomain>
94 - DB_CONNECTION=<database>
95 - DB_HOST=<yourdbhost>
96 - DB_PORT=<yourdbPORT>
97 - DB_USER=<yourdbuser>
98 - DB_PASSWORD=<yourdbpass>
99 - DB_DATABASE=<yourdbdatabase>
100 - DB_SSL=true/false
101 - MAIL_CONNECTION=<mailsender>
102 - SMPT_HOST=<smtpmailserver>
103 - SMTP_PORT=<smtpport>
104 - MAIL_SSL=true/false
105 - MAIL_USERNAME=<yourmailusername>
106 - MAIL_PASSWORD=<yourmailpassword>
107 - MAIL_SENDER=<sendemailaddress>
108 - IS_CREATION_ENABLED=true/false
109 - IS_DASHBOARD_ENABLED=true/false
110 - IS_REGISTRATION_ENABLED=true/false
111 - CONNECT_WITH_FRANZ=true/false
112 volumes:
113 - <path to data>:/config
114 - <path to database>:/app/database
115 - <path to recipes>:/app/recipes
116 ports:
117 - <port>:80
118 restart: unless-stopped
119 ```
120 83
1213. Optionally, you can now [set up Nginx as a reverse proxy](https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04#set-up-nginx-as-a-reverse-proxy-server). 843. Optionally, you can now [set up Nginx as a reverse proxy](https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04#set-up-nginx-as-a-reverse-proxy-server).
122 85
123For more information on configuring the Docker image, visit the Docker image repository at <https://github.com/getferdi/server-docker>. 86For more information on configuring the Docker image, please read [the ferdi docker documentation](./docker/README.md).
124 87
125### Manual setup 88### Manual setup
126 89
diff --git a/docker/.gitignore b/docker/.gitignore
new file mode 100644
index 0000000..552cd4a
--- /dev/null
+++ b/docker/.gitignore
@@ -0,0 +1,12 @@
1# Node modules
2node_modules
3
4# Adonis directory for storing tmp files
5tmp
6
7# Uploaded recipes
8recipes/
9
10.DS_Store
11public/terms.html
12public/privacy.html
diff --git a/docker/README.md b/docker/README.md
new file mode 100644
index 0000000..780dcb1
--- /dev/null
+++ b/docker/README.md
@@ -0,0 +1,214 @@
1# Ferdi-server-docker
2[Ferdi](https://github.com/getferdi/ferdi) is a hard-fork of [Franz](https://github.com/meetfranz/franz), adding awesome features and removing unwanted ones. Ferdi-server is an unofficial replacement of the Franz server for use with the Ferdi Client.
3
4This is a dockerized version of [Ferdi-server](https://github.com/getferdi/server) running on Alpine Linux and Node.js (v10.16.3).
5
6## Why use a custom Ferdi-server?
7A custom ferdi-server allows you to experience the full potential of the Ferdi client. It allows you to use all Premium features (e.g. Workspaces and custom URL recipes) and [adding your own recipes](#creating-and-using-custom-recipes).
8
9## Features
10- [x] User registration and login
11- [x] Service creation, download, listing and removing
12- [x] Workspace support
13- [x] Functioning service store
14- [x] User dashboard
15- [x] Password recovery
16- [x] Export/import data to other ferdi-servers
17- [ ] Recipe update
18
19## Installation & Setup
20
21Here are some example snippets to help you get started creating a container.
22
23The docker can be run as is, with the default sqlite database, or you can modify your environment variables to use an external database (e.g. MySQL, MariaDB, Postgres, etc). After setting up the docker container you will likely need to create a reverse proxy to access Ferdi-server outside of your home network, using for example NGINX.
24
25### docker
26
27Pull the docker image:
28
29 docker pull getferdi/ferdi-server
30
31To create the docker container with the proper parameters:
32
33 docker create \
34 --name=ferdi-server \
35 -e NODE_ENV=development \
36 -e EXTERNAL_DOMAIN=<ferdi-serverdomain> \
37 -e DB_CONNECTION=<database> \
38 -e DB_HOST=<yourdbhost> \
39 -e DB_PORT=<yourdbport> \
40 -e DB_USER=<yourdbuser> \
41 -e DB_PASSWORD=<yourdbpass> \
42 -e DB_DATABASE=<yourdbdatabase> \
43 -e DB_SSL=false \
44 -e MAIL_CONNECTION=smtp \
45 -e SMPT_HOST=<smtpmailserver> \
46 -e SMTP_PORT=<smtpport> \
47 -e MAIL_SSL=true/false \
48 -e MAIL_USERNAME=<yourmailusername> \
49 -e MAIL_PASSWORD=<yourmailpassword> \
50 -e MAIL_SENDER=<sendemailaddress> \
51 -e IS_CREATION_ENABLED=true \
52 -e IS_DASHBOARD_ENABLED=true \
53 -e IS_REGISTRATION_ENABLED=true \
54 -e CONNECT_WITH_FRANZ=true \
55 -e DATA_DIR=data \
56 -p <port>:80 \
57 -v <path to data>:/config \
58 -v <path to database>:/app/database \
59 -v <path to recipes>:/app/recipes \
60 --restart unless-stopped \
61 getferdi/ferdi-server
62
63### docker-compose
64
65 You can use sample [./docker/docker-compose.yml](https://github.com/getferdi/server/tree/master/docker/docker-compose.yml).
66 This will pull latest image from Docker Hub or use local image which you can build using instructions in [Building locally section](#Building-locally).
67
68 To start the application, use
69
70 docker-compose up
71The server will be launched at [http://localhost:3333/](http://localhost:3333/) address.
72
73## Configuration
74
75Container images are configured using parameters passed at runtime (such as those above).
76
77**Warning, using `config.txt` will be deprecated in the future releases.**
78
79If any of environmental parameters is not passed to the container, its value will be taken from the `/config/config.txt` file. **The previous functionality of saving container parameters in this file is now removed.**
80
81| Parameter | Function |
82| :----: | --- |
83| `-p <port>:3333` | will map the container's port 80 to a port on the host, default is 3333 |
84| `-e NODE_ENV=development` | for specifying Node environment, production or development, default is development |
85| `-e EXTERNAL_DOMAIN=<ferdi-serverdomain>` | for specifying external domain address of the ferdi server |
86| `-e DB_CONNECTION=sqlite` | for specifying the database being used, default is sqlite |
87| `-e DB_HOST=<yourdbhost>` | for specifying the database host, default is 127.0.0.1 |
88| `-e DB_PORT=<yourdbport>` | for specifying the database port, default is 3306 |
89| `-e DB_USER=<yourdbuser>` | for specifying the database user, default is root |
90| `-e DB_PASSWORD=<yourdbpass>` | for specifying the database password, default is password |
91| `-e DB_DATABASE=adonis` | for specifying the database to be used, adonis |
92| `-e DB_SSL=false` | true only if your database is postgres and it is hosted online on platforms like GCP, AWS, etc |
93| `-e MAIL_CONNECTION=<mailsender>` | for specifying the mail sender to be used, default is smtp |
94| `-e SMPT_HOST=<smtpmailserver>` | for specifying the mail host to be used, default is 127.0.0.1 |
95| `-e SMTP_PORT=<smtpport>` | for specifying the mail port to be used, default is 2525 |
96| `-e MAIL_SSL=true/false` | for specifying SMTP mail secuirty, default is false |
97| `-e MAIL_USERNAME=<yourmailusername>` | for specifying your mail username to be used, default is username |
98| `-e MAIL_PASSWORD=<yourmailpassword>` | for specifying your mail password to be used, default is password |
99| `-e MAIL_SENDER=<sendemailaddress` | for specifying the mail sender address to be used, default is noreply@getferdi.com |
100| `-e IS_CREATION_ENABLED=true` | for specifying whether to enable the [creation of custom recipes](#creating-and-using-custom-recipes), default is true |
101| `-e IS_DASHBOARD_ENABLED=true` | for specifying whether to enable the Ferdi-server dashboard, default is true |
102| `-e IS_REGISTRATION_ENABLED=true` | for specifying whether to allow user registration, default is true |
103| `-e CONNECT_WITH_FRANZ=true` | for specifying whether to enable connections to the Franz server, default is true |
104| `-e DATA_DIR=data` | for specifying sql-lite database folder, default is database. |
105| `-v <path to data>:/config` | this will store persistent ENV data on the docker host |
106| `-v <path to database>:/app/database` | this will strore Ferdi-server's database on the docker host for persistence |
107| `-v <path to recipes>:/app/recipes` | this will strore Ferdi-server's recipes on the docker host for persistence |
108
109By enabling the `CONNECT_WITH_FRANZ` option, Ferdi-server can:
110 - Show the full Franz recipe library instead of only custom recipes
111 - Import Franz accounts
112
113## Supported databases and drivers
114
115To use a different database than the default, SQLite, enter the driver code below in your ENV configuration.
116
117| Database | Driver |
118| :----: | --- |
119| MariaDB/MySQL | mysql |
120| PostgreSQL | pg |
121| SQLite3 | sqlite |
122
123## Supported mail connections (advanced)
124
125To use a different email sender than the default, SMTP, enter the correct information in your ENV configuration and adapt your docker run, create, or compose commands accordingly.
126
127| Mail Connection | ENV variables |
128| :----: | --- |
129| SMTP | SMTP_PORT, SMTP_HOST, MAIL_USERNAME, MAIL_PASSWORD, MAIL_SSL |
130| SparkPost | SPARKPOST_API_KEY |
131| Mailgun | MAILGUN_DOMAIN, MAILGUN_API_REGION, MAILGUN_API_KEY |
132| (**Deprecated**) Ethereal | A disposable account is created automatically if you choose this option. |
133
134## NGINX config block
135To access Ferdi-server from outside of your home network on a subdomain use this server block:
136
137```
138# Ferdi-server
139server {
140 listen 443 ssl http2;
141 server_name ferdi.my.website;
142
143 # all ssl related config moved to ssl.conf
144 include /config/nginx/ssl.conf;
145
146 location / {
147 proxy_pass http://<Ferdi-IP>:3333;
148 proxy_set_header X-Real-IP $remote_addr;
149 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
150 proxy_set_header Host $host;
151 proxy_set_header X-Forwarded-Proto $scheme;
152 }
153}
154```
155
156## Importing your Franz account
157Ferdi-server allows you to import your full Franz account, including all its settings.
158
159To import your Franz account, open `http://[YOUR FERDI-SERVER]/import` in your browser and login using your Franz account details. Ferdi-server will create a new user with the same credentials and copy your Franz settings, services and workspaces.
160
161## Transferring user data
162Please refer to <https://github.com/getferdi/ferdi/wiki/Transferring-data-between-servers>
163
164## Creating and using custom recipes
165Ferdi-server allows to extends the Franz recipe catalogue with custom Ferdi recipes.
166
167For documentation on how to create a recipe, please visit [the official guide by Franz](https://github.com/meetfranz/plugins/blob/master/docs/integration.md).
168
169To add your recipe to Ferdi-server, open `http://[YOUR FERDI-SERVER]/new` in your browser. You can now define the following settings:
170- `Author`: Author who created the recipe
171- `Name`: Name for your new service. Can contain spaces and unicode characters
172- `Service ID`: Unique ID for this recipe. Does not contain spaces or special characters (e.g. `google-drive`)
173- `Link to PNG/SVG image`: Direct link to a 1024x1024 PNG image and SVG that is used as a logo inside the store. Please use jsDelivr when using a file uploaded to GitHub as raw.githubusercontent files won't load
174- `Recipe files`: Recipe files that you created using the [Franz recipe creation guide](https://github.com/meetfranz/plugins/blob/master/docs/integration.md). Please do *not* package your files beforehand - upload the raw files (you can drag and drop multiple files). ferdi-server will automatically package and store the recipe in the right format. Please also do not drag and drop or select the whole folder, select the individual files.
175
176### Listing custom recipes
177Inside Ferdi, searching for `ferdi:custom` will list all your custom recipes.
178
179## Support Info
180
181* Shell access while the container is running: `docker exec -it ferdi-server /bin/bash`
182* To monitor the logs of the container in realtime: `docker logs -f ferdi-server`
183
184## Updating Info
185
186Below are the instructions for updating the container to get the most recent version of Ferdi-server:
187
188### Via Docker Run/Create
189* Update the image: `docker pull getferdi/ferdi-server`
190* Stop the running container: `docker stop ferdi-server`
191* Delete the container: `docker rm ferdi-server`
192* Recreate a new container with the same docker create parameters as instructed above (if mapped correctly to a host folder, your `/config` folder and your ENV settings will be preserved)
193* Start the new container: `docker start ferdi-server`
194* You can also remove the old dangling images: `docker image prune`
195
196### Via Docker Compose
197* Update all images: `docker-compose pull`
198 * or update a single image: `docker-compose pull ferdi-server`
199* Let compose update all containers as necessary: `docker-compose up -d`
200 * or update a single container: `docker-compose up -d ferdi-server`
201* You can also remove the old dangling images: `docker image prune`
202
203## Building locally
204
205If you want to build this image locally, please run this command from root of [ferdi server repository](https://github.com/getferdi/server/tree/master/):
206```
207docker build \
208 --no-cache \
209 --pull \
210 -t getferdi/ferdi-server:latest .
211```
212
213## License
214Ferdi-server-docker and ferdi-server are licensed under the MIT License.
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
new file mode 100644
index 0000000..64797c4
--- /dev/null
+++ b/docker/docker-compose.yml
@@ -0,0 +1,38 @@
1version: "2"
2services:
3 ferdi-server:
4 image: getferdi/ferdi-server
5 container_name: ferdi-server
6 environment:
7 - NODE_ENV=development
8 - EXTERNAL_DOMAIN=localhost
9 - DB_CONNECTION=sqlite
10 - DB_HOST=127.0.0.1
11 - DB_PORT=3306
12 - DB_USER=root
13 - DB_PASSWORD=password
14 - DB_DATABASE=adonis
15 - DB_SSL=false
16 - MAIL_CONNECTION=smtp
17 - SMPT_HOST=127.0.0.1
18 - SMTP_PORT=2525
19 - MAIL_SSL=false
20 - MAIL_USERNAME=username
21 - MAIL_PASSWORD=password
22 - MAIL_SENDER=noreply@getferdi.com
23 - IS_CREATION_ENABLED=true
24 - IS_DASHBOARD_ENABLED=true
25 - IS_REGISTRATION_ENABLED=true
26 - CONNECT_WITH_FRANZ=false
27 - DATA_DIR=data
28 volumes:
29 - ferdi-config-vol:/config
30 - ferdi-database-vol:/app/data
31 - ferdi-recipes-vol:/app/recipes
32 ports:
33 - 3333:3333
34 restart: unless-stopped
35volumes:
36 ferdi-config-vol:
37 ferdi-database-vol:
38 ferdi-recipes-vol:
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
new file mode 100755
index 0000000..eac3fc8
--- /dev/null
+++ b/docker/entrypoint.sh
@@ -0,0 +1,47 @@
1#!/bin/sh
2
3echo << EOL
4-------------------------------------
5 ____ ___
6 / __/__ _______/ (_)
7 / _// -_) __/ _ / /
8 _/_/ \__/_/ \_,_/_/
9 / __/__ _____ _____ ____
10 _\ \/ -_) __/ |/ / -_) __/
11 /___/\__/_/ |___/\__/_/
12Brought to you by getferdi.com
13Support our Open Collective at:
14https://opencollective.com/getferdi/
15EOL
16
17# use config.txt or .env.example parameter values as default if they are not passed to container
18if [ -f /config/config.txt ]; then
19 cp /config/config.txt /app/.env
20else
21 cp /app/.env.example /app/.env
22fi
23
24# Create APP key if needed
25if [ ! -f "/config/FERDI_APP_KEY.txt" ];
26 then
27 echo " "
28 echo "**** Generating Ferdi-server app key for first run ****"
29 adonis key:generate
30 APP_KEY=$(grep APP_KEY .env | cut -d '=' -f2)
31 echo $APP_KEY > /config/FERDI_APP_KEY.txt
32 echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****"
33 sed -i "s/APP_KEY=/APP_KEY=$APP_KEY/g" /config/config.txt
34elif [ -f "/config/FERDI_APP_KEY.txt" ];
35 then
36 echo " "
37 echo "**** App Key found ****"
38 APP_KEY=$(cat /config/FERDI_APP_KEY.txt)
39 sed -i "s/APP_KEY=.*/APP_KEY=$APP_KEY/g" /config/config.txt
40 echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****"
41fi
42
43export APP_KEY
44
45node ace migration:run --force
46
47exec node server.js
diff --git a/docker/logo.png b/docker/logo.png
new file mode 100644
index 0000000..587e0b8
--- /dev/null
+++ b/docker/logo.png
Binary files differ