From 8337e2632686cf8d0dcf39474019370f7d3dc752 Mon Sep 17 00:00:00 2001 From: Michal Kostewicz Date: Fri, 5 Feb 2021 19:18:05 +0100 Subject: Moved getferdi/server-docker into getferdi/server repository. Add sample docker-compose file and update README.md files in root and docker directories. --- README.md | 4 +- docker/.dockerignore | 13 ++ docker/.gitignore | 16 ++ docker/Dockerfile | 97 ++++++++++++ docker/LICENSE | 21 +++ docker/README.md | 224 ++++++++++++++++++++++++++++ docker/docker-compose.yml | 37 +++++ docker/logo.png | Bin 0 -> 340668 bytes docker/root/defaults/.env.example | 35 +++++ docker/root/etc/cont-init.d/10-adduser | 32 ++++ docker/root/etc/cont-init.d/50-config | 184 +++++++++++++++++++++++ docker/root/etc/services.d/ferdi-server/run | 10 ++ 12 files changed, 672 insertions(+), 1 deletion(-) create mode 100644 docker/.dockerignore create mode 100644 docker/.gitignore create mode 100644 docker/Dockerfile create mode 100644 docker/LICENSE create mode 100644 docker/README.md create mode 100644 docker/docker-compose.yml create mode 100644 docker/logo.png create mode 100755 docker/root/defaults/.env.example create mode 100755 docker/root/etc/cont-init.d/10-adduser create mode 100755 docker/root/etc/cont-init.d/50-config create mode 100755 docker/root/etc/services.d/ferdi-server/run diff --git a/README.md b/README.md index 098ba16..9d1b02d 100644 --- a/README.md +++ b/README.md @@ -116,9 +116,11 @@ After setting up the docker container we recommend you to set up an NGINX revers - :80 restart: unless-stopped ``` + You can also use sample [./docker/docker-compose.yml](https://github.com/getferdi/server/tree/master/docker/docker-compose.yml) file. + 3. 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). -For more information on configuring the Docker image, visit the Docker image repository at . +For more information on configuring the Docker image, please read [./docker/README.md](https://github.com/getferdi/server/tree/master/docker/README.md). ### Manual setup 1. Clone this repository diff --git a/docker/.dockerignore b/docker/.dockerignore new file mode 100644 index 0000000..92207ac --- /dev/null +++ b/docker/.dockerignore @@ -0,0 +1,13 @@ +.DS_Store + +# ignore .git and .cache folders +.git +.gitignore +.github +.gitattributes +.cache + +# ignore all markdown files (md) beside all README*.md other than README-secret.md +*.md +!README*.md +README-secret.md diff --git a/docker/.gitignore b/docker/.gitignore new file mode 100644 index 0000000..b726524 --- /dev/null +++ b/docker/.gitignore @@ -0,0 +1,16 @@ +# Node modules +node_modules + +# Adonis directory for storing tmp files +tmp + +# The development sqlite file +database/development.sqlite +database/adonis.sqlite + +# Uploaded recipes +recipes/ + +.DS_Store +public/terms.html +public/privacy.html diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..2b165f5 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,97 @@ +FROM lsiobase/alpine:3.11 + +# version labels +ARG BUILD_DATE +LABEL build_version="Ferdi-server-docker Build-date:- ${BUILD_DATE}" +LABEL maintainer="xthursdayx" + +ARG FERDI_RELEASE +ENV NODE_VERSION=10.16.3 +ENV S6_BEHAVIOUR_IF_STAGE2_FAILS=2 + +# install packages +RUN \ + echo "**** installing build packages ****" && \ + apk add --no-cache \ + libcap \ + libstdc++ \ + nano && \ + apk add --no-cache --virtual .build-deps \ + binutils-gold \ + curl \ + gnupg \ + gcc \ + g++ \ + linux-headers \ + make \ + memcached \ + python && \ + echo "**** downloading keys ****" && \ + # gpg keys listed at https://github.com/nodejs/node#release-keys + for key in \ + 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ + FD3A5288F042B6850C66B31F09FE44734EB7990E \ + 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ + DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ + C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ + B9AE9905FFD7803F25714661B63B535A4C206CA9 \ + 77984A986EBC2AA786BC0F66B01FBB92821C587A \ + 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \ + 4ED778F539E3634C779C87C6D7062848A1AB005C \ + A48C2BEE680E841632CD4E44F07496B3EB3C1762 \ + B9E2F5981AA6E0CD28160D9FF13993A75599653C \ + ; do \ + gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \ + gpg --batch --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \ + gpg --batch --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \ + done && \ + echo "**** installing node ****" && \ + curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz" && \ + curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" && \ + gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc && \ + grep " node-v$NODE_VERSION.tar.xz\$" SHASUMS256.txt | sha256sum -c - && \ + tar -xf "node-v$NODE_VERSION.tar.xz" && \ + cd "node-v$NODE_VERSION" && \ + ./configure --prefix=/usr && \ + make -j$(getconf _NPROCESSORS_ONLN) V= && \ + make install && \ + apk del .build-deps && \ + cd / && \ + rm -Rf "node-v$NODE_VERSION" && \ + rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt + +RUN \ + apk add --no-cache --virtual .build-deps-ferdi \ + curl \ + gnupg \ + tar && \ + echo "**** installing npm ****" && \ + npm config set unsafe-perm true && \ + npm install -g npm@latest && \ + find /usr/lib/node_modules/npm -name test -o -name .bin -type d | xargs rm -rf && \ + echo "**** install ferdi server ****" && \ + mkdir -p /ferdi && \ + curl -o /ferdi/ferdi.tar.gz -L "https://github.com/getferdi/server/archive/master.tar.gz" && \ + echo "**** cleanup ****" && \ + apk del .build-deps-ferdi && \ + rm -rf \ + ${RM_DIRS} \ + /SHASUMS256.txt \ + /tmp/* \ + /var/cache/apk/* \ + /usr/share/man/* \ + /usr/share/doc \ + /root/.node-gyp \ + /root/.config \ + /usr/lib/node_modules/npm/man \ + /usr/lib/node_modules/npm/doc \ + /usr/lib/node_modules/npm/html \ + /usr/lib/node_modules/npm/scripts + +COPY root/ / + +USER root + +# ports and volumes +EXPOSE 80 443 +VOLUME /app/database /app/recipes /config diff --git a/docker/LICENSE b/docker/LICENSE new file mode 100644 index 0000000..a91c1fe --- /dev/null +++ b/docker/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 xthursdayx + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..8e0da08 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,224 @@ +

+ +

+ +# Ferdi-server-docker +[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. + +This is a dockerized version of [Ferdi-server](https://github.com/getferdi/server) running on Alpine Linux and Node.js (v10.16.3). + +## Why use a custom Ferdi-server? +A 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). + +## Features +- [x] User registration and login +- [x] Service creation, download, listing and removing +- [x] Workspace support +- [x] Functioning service store +- [x] User dashboard +- [x] Password recovery +- [x] Export/import data to other ferdi-servers +- [ ] Recipe update + +## Installation & Setup + +Here are some example snippets to help you get started creating a container. + +The docker can be run as is, with the default sqlite database, or you can modifying your ENV variables to use an external database (e.g. MYSql, MariaDB, Postgres, etc). After setting up the docker container you will need to create a NGINX reverse proxy to access Ferdi-server outside of your home network. + +### docker + +Pull the docker image: + + docker pull getferdi/ferdi-server + +To create the docker container with the proper parameters: + + docker create \ + --name=ferdi-server \ + -e NODE_ENV=development \ + -e EXTERNAL_DOMAIN= \ + -e DB_CONNECTION= \ + -e DB_HOST= \ + -e DB_PORT= \ + -e DB_USER= \ + -e DB_PASSWORD= \ + -e DB_DATABASE= \ + -e DB_SSL=false \ + -e MAIL_CONNECTION=smtp \ + -e SMPT_HOST= \ + -e SMTP_PORT= \ + -e MAIL_SSL=true/false \ + -e MAIL_USERNAME= \ + -e MAIL_PASSWORD= \ + -e MAIL_SENDER= \ + -e IS_CREATION_ENABLED=true \ + -e IS_DASHBOARD_ENABLED=true \ + -e IS_REGISTRATION_ENABLED=true \ + -e CONNECT_WITH_FRANZ=true \ + -p :80 \ + -v :/config \ + -v :/app/database \ + -v :/app/recipes \ + --restart unless-stopped \ + getferdi/ferdi-server + +### docker-compose + + You can use sample [./docker/docker-compose.yml](https://github.com/getferdi/server/tree/master/docker/docker-compose.yml). + This will pull latest image from Docker Hub or use local image which you can build using instructions in [Building locally section](#Building-locally). + + To start the application, use + + docker-compose up +The server will be launched at [http://localhost:3333/](http://localhost:3333/) address. + +## Configuration + +Container images are configured using parameters passed at runtime (such as those above). These parameters are separated by a colon and indicate `:` respectively. For example, `-p 3333:80` would expose port `80` from inside the container to be accessible from the host's IP on port `3333` outside the container. +After the first run, Ferdi-server's configuration is saved inside the `config.txt` file inside your persistent data directory (`/config` in the container). + +| Parameter | Function | +| :----: | --- | +| `-p :80` | will map the container's port 80 to a port on the host, default is 3333 | +| `-e NODE_ENV=development` | for specifying Node environment, production or development, default is development | +| `-e EXTERNAL_DOMAIN=` | for specifying external domain address of the ferdi server | +| `-e DB_CONNECTION=sqlite` | for specifying the database being used, default is sqlite | +| `-e DB_HOST=` | for specifying the database host, default is 127.0.0.1 | +| `-e DB_PORT=` | for specifying the database port, default is 3306 | +| `-e DB_USER=` | for specifying the database user, default is root | +| `-e DB_PASSWORD=` | for specifying the database password, default is password | +| `-e DB_DATABASE=adonis` | for specifying the database to be used, adonis | +| `-e DB_SSL=false` | true only if your database is postgres and it is hosted online on platforms like GCP, AWS, etc | +| `-e MAIL_CONNECTION=` | for specifying the mail sender to be used, default is smtp | +| `-e SMPT_HOST=` | for specifying the mail host to be used, default is 127.0.0.1 | +| `-e SMTP_PORT=` | for specifying the mail port to be used, default is 2525 | +| `-e MAIL_SSL=true/false` | for specifying SMTP mail secuirty, default is false | +| `-e MAIL_USERNAME=` | for specifying your mail username to be used, default is username | +| `-e MAIL_PASSWORD=` | for specifying your mail password to be used, default is password | +| `-e MAIL_SENDER=:/config` | this will store persistent ENV data on the docker host | +| `-v :/app/database` | this will strore Ferdi-server's database on the docker host for persistence | +| `-v :/app/recipes` | this will strore Ferdi-server's recipes on the docker host for persistence | + +By enabling the `CONNECT_WITH_FRANZ` option, Ferdi-server can: + - Show the full Franz recipe library instead of only custom recipes + - Import Franz accounts + +## Supported databases and drivers + +To use a different database than the default, SQLite, enter the driver code below in your ENV configuration. + +| Database | Driver | +| :----: | --- | +| MariaDB | mysql | +| MySQL | mysql | +| PostgreSQL | pg | +| SQLite3 | sqlite | + +## Supported mail connections (advanced) + +To 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. + +| Mail Connection | ENV variables | +| :----: | --- | +| SMTP | SMTP_PORT, SMTP_HOST, MAIL_USERNAME, MAIL_PASSWORD, MAIL_SSL | +| SparkPost | SPARKPOST_API_KEY | +| Mailgun | MAILGUN_DOMAIN, MAILGUN_API_REGION, MAILGUN_API_KEY | +| Ethereal | A disposable account is created automatically if you choose this option. | + +## NGINX config block +To access Ferdi-server from outside of your home network on a subdomain use this server block: + +``` +# Ferdi-server +server { + listen 443 ssl http2; + server_name ferdi.my.website; + + # all ssl related config moved to ssl.conf + include /config/nginx/ssl.conf; + + location / { + proxy_pass http://:3333; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + } +} +``` + +## Importing your Franz account +Ferdi-server allows you to import your full Franz account, including all its settings. + +To 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. + +## Transferring user data +Please refer to + +## Creating and using custom recipes +Ferdi-server allows to extends the Franz recipe catalogue with custom Ferdi recipes. + +For documentation on how to create a recipe, please visit [the official guide by Franz](https://github.com/meetfranz/plugins/blob/master/docs/integration.md). + +To add your recipe to Ferdi-server, open `http://[YOUR FERDI-SERVER]/new` in your browser. You can now define the following settings: +- `Author`: Author who created the recipe +- `Name`: Name for your new service. Can contain spaces and unicode characters +- `Service ID`: Unique ID for this recipe. Does not contain spaces or special characters (e.g. `google-drive`) +- `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 +- `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. + +### Listing custom recipes +Inside Ferdi, searching for `ferdi:custom` will list all your custom recipes. + +## Support Info + +* Shell access while the container is running: `docker exec -it ferdi-server /bin/bash` +* To monitor the logs of the container in realtime: `docker logs -f ferdi-server` + +## Updating Info + +Below are the instructions for updating the container to get the most recent version of Ferdi-server: + +### Via Docker Run/Create +* Update the image: `docker pull getferdi/ferdi-server` +* Stop the running container: `docker stop ferdi-server` +* Delete the container: `docker rm ferdi-server` +* 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) +* Start the new container: `docker start ferdi-server` +* You can also remove the old dangling images: `docker image prune` + +### Via Docker Compose +* Update all images: `docker-compose pull` + * or update a single image: `docker-compose pull ferdi-server` +* Let compose update all containers as necessary: `docker-compose up -d` + * or update a single container: `docker-compose up -d ferdi-server` +* You can also remove the old dangling images: `docker image prune` + +## Building locally + +If you want to make local modifications to this image for development purposes or just to customize the logic: +``` +git clone https://github.com/getferdi/server-docker.git +cd server-docker +docker build \ + --no-cache \ + --pull \ + -t getferdi/ferdi-server:latest . +``` + +## Versions + +* **05.02.21:** - Repository moved to ferdi-server repository +* **19.01.21:** - Updated Mail SSL and DB SLL settings +* **20.09.20:** - Updated SMTP Mailer settings for password reset. +* **21.06.20:** - Rebase to Alpine 3.11 and added Mailer settings. +* **25.09.19:** - Initial Release. + +## License +Ferdi-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..7bf1b8c --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,37 @@ +version: "2" +services: + ferdi-server: + image: getferdi/ferdi-server + container_name: ferdi-server + environment: + - NODE_ENV=development + - EXTERNAL_DOMAIN=localhost + - DB_CONNECTION=sqlite + - DB_HOST=127.0.0.1 + - DB_PORT=3306 + - DB_USER=root + - DB_PASSWORD=password + - DB_DATABASE=adonis + - DB_SSL=false + - MAIL_CONNECTION=smtp + - SMPT_HOST=127.0.0.1 + - SMTP_PORT=2525 + - MAIL_SSL=false + - MAIL_USERNAME=username + - MAIL_PASSWORD=password + - MAIL_SENDER=noreply@getferdi.com + - IS_CREATION_ENABLED=true + - IS_DASHBOARD_ENABLED=true + - IS_REGISTRATION_ENABLED=true + - CONNECT_WITH_FRANZ=false + volumes: + - ferdi-config-vol:/config + - ferdi-database-vol:/app/database + - ferdi-recipes-vol:/app/recipes + ports: + - 3333:80 + restart: unless-stopped +volumes: + ferdi-config-vol: + ferdi-database-vol: + ferdi-recipes-vol: \ No newline at end of file diff --git a/docker/logo.png b/docker/logo.png new file mode 100644 index 0000000..587e0b8 Binary files /dev/null and b/docker/logo.png differ diff --git a/docker/root/defaults/.env.example b/docker/root/defaults/.env.example new file mode 100755 index 0000000..2ed73dc --- /dev/null +++ b/docker/root/defaults/.env.example @@ -0,0 +1,35 @@ +HOST=0.0.0.0 +PORT=80 +NODE_ENV=development + +APP_NAME=AdonisJs +APP_URL=http://${EXTERNAL_DOMAIN} +EXTERNAL_DOMAIN=ferdi.domain.tld + +CACHE_VIEWS=false + +APP_KEY=appkey + +DB_CONNECTION=sqlite +DB_HOST=127.0.0.1 +DB_PORT=3306 +DB_USER=root +DB_PASSWORD=password +DB_DATABASE=adonis + +DB_SSL=false + +HASH_DRIVER=bcrypt + +IS_CREATION_ENABLED=true +IS_DASHBOARD_ENABLED=true +IS_REGISTRATION_ENABLED=true +CONNECT_WITH_FRANZ=true + +MAIL_CONNECTION=smtp +SMTP_PORT=2525 +SMTP_HOST=127.0.0.1 +MAIL_USERNAME=username +MAIL_PASSWORD=password +MAIL_SENDER=noreply@getferdi.com +MAIL_SSL=false diff --git a/docker/root/etc/cont-init.d/10-adduser b/docker/root/etc/cont-init.d/10-adduser new file mode 100755 index 0000000..8ba1aea --- /dev/null +++ b/docker/root/etc/cont-init.d/10-adduser @@ -0,0 +1,32 @@ +#!/usr/bin/with-contenv bash + +PUID=${PUID:-911} +PGID=${PGID:-911} + +groupmod -o -g "$PGID" abc +usermod -o -u "$PUID" abc + +echo ' +------------------------------------- + ____ ___ + / __/__ _______/ (_) + / _// -_) __/ _ / / + _/_/ \__/_/ \_,_/_/ + / __/__ _____ _____ ____ + _\ \/ -_) __/ |/ / -_) __/ + /___/\__/_/ |___/\__/_/ + +Brought to you by getferdi.com +Support our Open Collective at: +https://opencollective.com/getferdi/ +------------------------------------- +GID/UID +-------------------------------------' +echo " +User uid: $(id -u abc) +User gid: $(id -g abc) +------------------------------------- +" +chown abc:abc /app +chown abc:abc /config +chown abc:abc /defaults \ No newline at end of file diff --git a/docker/root/etc/cont-init.d/50-config b/docker/root/etc/cont-init.d/50-config new file mode 100755 index 0000000..1c0caed --- /dev/null +++ b/docker/root/etc/cont-init.d/50-config @@ -0,0 +1,184 @@ +#!/usr/bin/with-contenv bash + +# Display variables for troubleshooting +echo " " +echo "-------------------------------------" +echo " " +echo -e "Variables set:\\n\ +NODE_ENV=${NODE_ENV}\\n\ +EXTERNAL_DOMAIN=${EXTERNAL_DOMAIN}\\n\ +DB_CONNECTION=${DB_CONNECTION}\\n\ +DB_HOST=${DB_HOST}\\n\ +DB_PORT=${DB_PORT}\\n\ +DB_USER=${DB_USER}\\n\ +DB_PASSWORD=${DB_PASSWORD}\\n\ +DB_DATABASE=${DB_DATABASE}\\n\ +DB_SSL=${DB_SSL}\\n\ +IS_CREATION_ENABLED=${IS_CREATION_ENABLED}\\n\ +IS_DASHBOARD_ENABLED=${IS_DASHBOARD_ENABLED}\\n\ +IS_REGISTRATION_ENABLED=${IS_REGISTRATION_ENABLED}\\n\ +CONNECT_WITH_FRANZ=${CONNECT_WITH_FRANZ}\\n\ +MAIL_CONNECTION=${MAIL_CONNECTION}\\n\ +SMTP_PORT=${SMTP_PORT}\\n\ +SMTP_HOST=${SMTP_HOST}\\n\ +MAIL_SSL=${MAIL_SSL}\\n\ +MAIL_USERNAME=${MAIL_USERNAME}\\n\ +MAIL_PASSWORD=${MAIL_PASSWORD}\\n\ +MAIL_SENDER=${MAIL_SENDER}\\n" + +# Echo init finish for test runs +if [ -n "${TEST_RUN}" ]; then + echo " " + echo '**** [services.d] done ****' +fi + +# install ferdi-server if necessary +[[ -f /ferdi/ferdi.tar.gz ]] && \ + echo "**** Installing Ferdi-server ****" && \ + tar xf \ + /ferdi/ferdi.tar.gz -C \ + /app --strip-components=1 && \ + rm -rf \ + /ferdi && \ + chown -R abc:abc /app + +# set ferdi-server status +echo " " +echo "**** Checking Ferdi-server settings ****" +if [ -f /config/config.txt ]; then + [[ "${NODE_ENV}" ]] && sed -i "s/NODE_ENV=.*/NODE_ENV=${NODE_ENV}/g" /config/config.txt + [[ "${EXTERNAL_DOMAIN}" ]] && sed -i "s/EXTERNAL_DOMAIN=.*/EXTERNAL_DOMAIN=${EXTERNAL_DOMAIN}/g" /config/config.txt + [[ "${IS_CREATION_ENABLED}" ]] && sed -i "s/IS_CREATION_ENABLED=.*/IS_CREATION_ENABLED=${IS_CREATION_ENABLED}/g" /config/config.txt + [[ "${IS_DASHBOARD_ENABLED}" ]] && sed -i "s/IS_DASHBOARD_ENABLED=.*/IS_DASHBOARD_ENABLED=${IS_DASHBOARD_ENABLED}/g" /config/config.txt + [[ "${IS_REGISTRATION_ENABLED}" ]] && sed -i "s/IS_REGISTRATION_ENABLED=.*/IS_REGISTRATION_ENABLED=${IS_REGISTRATION_ENABLED}/g" /config/config.txt + [[ "${CONNECT_WITH_FRANZ}" ]] && sed -i "s/CONNECT_WITH_FRANZ=.*/CONNECT_WITH_FRANZ=${CONNECT_WITH_FRANZ}/g" /config/config.txt + [[ "${DB_CONNECTION}" ]] && sed -i "s/DB_CONNECTION=.*/DB_CONNECTION=${DB_CONNECTION}/g" /config/config.txt + [[ "${DB_HOST}" ]] && sed -i "s/DB_HOST=.*/DB_HOST=${DB_HOST}/g" /config/config.txt + [[ "${DB_PORT}" ]] && sed -i "s/DB_PORT=.*/DB_PORT=${DB_PORT}/g" /config/config.txt + [[ "${DB_DATABASE}" ]] && sed -i "s/DB_DATABASE=.*/DB_DATABASE=${DB_DATABASE}/g" /config/config.txt + [[ "${DB_USER}" ]] && sed -i "s/DB_USER=.*/DB_USER=${DB_USER}/g" /config/config.txt + [[ "${DB_PASSWORD}" ]] && sed -i "s/DB_PASSWORD=.*/DB_PASSWORD=${DB_PASSWORD}/g" /config/config.txt + [[ "${DB_SSL}" ]] && sed -i "s/DB_SSL=.*/DB_SSL=${DB_SSL}/g" /config/config.txt + [[ "${MAIL_CONNECTION}" ]] && sed -i "s/MAIL_CONNECTION=.*/MAIL_CONNECTION=${MAIL_CONNECTION}/g" /config/config.txt + [[ "${SMTP_HOST}" ]] && sed -i "s/SMTP_HOST=.*/SMTP_HOST=${SMTP_HOST}/g" /config/config.txt + [[ "${SMTP_PORT}" ]] && sed -i "s/SMTP_PORT=.*/SMTP_PORT=${SMTP_PORT}/g" /config/config.txt + [[ "${MAIL_SSL}" ]] && sed -i "s/MAIL_SSL=.*/MAIL_SSL=${MAIL_SSL}/g" /config/config.txt + [[ "${MAIL_USERNAME}" ]] && sed -i "s/MAIL_USERNAME=.*/MAIL_USERNAME=${MAIL_USERNAME}/g" /config/config.txt + [[ "${MAIL_PASSWORD}" ]] && sed -i "s/MAIL_PASSWORD=.*/MAIL_PASSWORD=${MAIL_PASSWORD}/g" /config/config.txt + [[ "${MMAIL_SENDER}" ]] && sed -i "s/MAIL_SENDER=.*/MAIL_SENDER=${MAIL_SENDER}/g" /config/config.txt + rm /config/.env + cp /config/config.txt /config/.env +elif [ ! -f /config/config.txt ]; then + echo " " + echo "**** Generating .env file ****" + cp /defaults/.env.example /config/.env + [[ "${NODE_ENV}" ]] && sed -i "s/NODE_ENV=.*/NODE_ENV=${NODE_ENV}/g" /config/.env + [[ "${EXTERNAL_DOMAIN}" ]] && sed -i "s/EXTERNAL_DOMAIN=.*/EXTERNAL_DOMAIN=${EXTERNAL_DOMAIN}/g" /config/.env + [[ "${IS_CREATION_ENABLED}" ]] && sed -i "s/IS_CREATION_ENABLED=.*/IS_CREATION_ENABLED=${IS_CREATION_ENABLED}/g" /config/.env + [[ "${IS_DASHBOARD_ENABLED}" ]] && sed -i "s/IS_DASHBOARD_ENABLED=.*/IS_DASHBOARD_ENABLED=${IS_DASHBOARD_ENABLED}/g" /config/.env + [[ "${IS_REGISTRATION_ENABLED}" ]] && sed -i "s/IS_REGISTRATION_ENABLED=.*/IS_REGISTRATION_ENABLED=${IS_REGISTRATION_ENABLED}/g" /config/.env + [[ "${CONNECT_WITH_FRANZ}" ]] && sed -i "s/CONNECT_WITH_FRANZ=.*/CONNECT_WITH_FRANZ=${CONNECT_WITH_FRANZ}/g" /config/.env + [[ "${DB_CONNECTION}" ]] && sed -i "s/DB_CONNECTION=.*/DB_CONNECTION=${DB_CONNECTION}/g" /config/.env + [[ "${DB_HOST}" ]] && sed -i "s/DB_HOST=.*/DB_HOST=${DB_HOST}/g" /config/.env + [[ "${DB_PORT}" ]] && sed -i "s/DB_PORT=.*/DB_PORT=${DB_PORT}/g" /config/.env + [[ "${DB_DATABASE}" ]] && sed -i "s/DB_DATABASE=.*/DB_DATABASE=${DB_DATABASE}/g" /config/.env + [[ "${DB_USER}" ]] && sed -i "s/DB_USER=.*/DB_USER=${DB_USER}/g" /config/.env + [[ "${DB_PASSWORD}" ]] && sed -i "s/DB_PASSWORD=.*/DB_PASSWORD=${DB_PASSWORD}/g" /config/.env + [[ "${DB_SSL}" ]] && sed -i "s/DB_SSL=.*/DB_SSL=${DB_SSL}/g" /config/.env + [[ "${MAIL_CONNECTION}" ]] && sed -i "s/MAIL_CONNECTION=.*/MAIL_CONNECTION=${MAIL_CONNECTION}/g" /config/.env + [[ "${SMTP_HOST}" ]] && sed -i "s/SMTP_HOST=.*/SMTP_HOST=${SMTP_HOST}/g" /config/.env + [[ "${SMTP_PORT}" ]] && sed -i "s/SMTP_PORT=.*/SMTP_PORT=${SMTP_PORT}/g" /config/.env + [[ "${MAIL_SSL}" ]] && sed -i "s/MAIL_SSL=.*/MAIL_SSL=${MAIL_SSL}/g" /config/.env + [[ "${MAIL_USERNAME}" ]] && sed -i "s/MAIL_USERNAME=.*/MAIL_USERNAME=${MAIL_USERNAME}/g" /config/.env + [[ "${MAIL_PASSWORD}" ]] && sed -i "s/MAIL_PASSWORD=.*/MAIL_PASSWORD=${MAIL_PASSWORD}/g" /config/.env + [[ "${MMAIL_SENDER}" ]] && sed -i "s/MAIL_SENDER=.*/MAIL_SENDER=${MAIL_SENDER}/g" /config/.env + cp /config/.env /config/config.txt +fi + +# update .env +if [ -f /app/.env ]; then + rm /app/.env + ln -s /config/.env /app/.env +elif [ ! -f /app/.env ]; then + ln -s /config/.env /app/.env +fi + +# install adonisjs cli +echo " " +echo "**** Installing AdonisJS and deps ****" +cd /app +echo " " +npm config set unsafe-perm true +npm i -g @adonisjs/cli + +# install adonisjs dependencies +npm install + +# make custom recipe dir +if [ ! -f /app/recipes/dev ]; then +mkdir -p /app/recipes/dev +fi + +# setting the database helper +if [ "${DB_CONNECTION}" = "sqlite" ]; then + echo " " + echo "**** DB helper loaded ****" + else npm i ${DB_CONNECTION} + echo " " + echo "**** DB Helper loaded ****" +fi + +# check for the database endpoint for 30 seconds +echo " " +echo "**** Checking DB endpoint ****" +source .env +END=$((SECONDS+30)) +while [ ${SECONDS} -lt ${END} ] && [ "${DB_HOST} ${DB_PORT}" ]; + do + /usr/bin/nc -z ${DB_HOST} ${DB_PORT} && \ + if [ ! -z "$(/usr/bin/nc -w1 ${DB_HOST} ${DB_PORT})" ]; + then + [ ! -z "${RUN}" ] && break + RUN="RAN" + # we sleep here again due to first run init on DB containers + [ ! -f /dbwait.lock ] && sleep 5 + else + sleep 1 + fi + sleep 1 +done + +# source the .env file +source .env + +# database migration +echo " " +echo "**** Run DB migration ****" +adonis migration:run --force + +# Create APP key if needed +if [ ! -f "/config/FERDI_APP_KEY.txt" ]; + then + echo " " + echo "**** Generating Ferdi-server app key for first run ****" + adonis key:generate + source .env + echo $APP_KEY > /config/FERDI_APP_KEY.txt + echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" + sed -i "s/APP_KEY=/APP_KEY=$APP_KEY/g" /config/config.txt +elif [ -f "/config/FERDI_APP_KEY.txt" ]; + then + echo " " + echo "**** App Key found ****" + APP_KEY=$(cat /config/FERDI_APP_KEY.txt) + sed -i "s/APP_KEY=.*/APP_KEY=$APP_KEY/g" /config/config.txt + echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" +fi + +# set permissions +chown -R abc:abc \ + /config \ + /app + +# set lockfile to avoid DB waits for this specific container +touch /dbwait.lock diff --git a/docker/root/etc/services.d/ferdi-server/run b/docker/root/etc/services.d/ferdi-server/run new file mode 100755 index 0000000..cf1568c --- /dev/null +++ b/docker/root/etc/services.d/ferdi-server/run @@ -0,0 +1,10 @@ +#!/usr/bin/with-contenv bash + +cd /app + +setcap 'cap_net_bind_service=+ep' `which node` + +# start server +echo " " +echo "**** Starting Ferdi-server ****" +exec s6-setuidgid abc adonis serve --dev \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 7e55e4bf83321c770645e9657589a620335fa029 Mon Sep 17 00:00:00 2001 From: Michal Kostewicz Date: Fri, 5 Feb 2021 20:43:13 +0100 Subject: Modifying Dockerfile so that it can use the current application code to build the image. Update instructions for building image in README.md --- .dockerignore | 21 +++++++++++++++++++++ docker/.dockerignore | 13 ------------- docker/Dockerfile | 7 +++---- docker/README.md | 5 ++--- docker/root/etc/cont-init.d/50-config | 10 ---------- 5 files changed, 26 insertions(+), 30 deletions(-) create mode 100644 .dockerignore delete mode 100644 docker/.dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..43c6cd0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,21 @@ +.DS_Store + +# ignore .git and .cache folders +.git +.gitignore +.github +.gitattributes +.cache + +# ignore all markdown files (md) beside all README*.md other than README-secret.md +*.md +!README*.md +README-secret.md + +# ignore other directories +docker +!docker/root +node_modules + + + diff --git a/docker/.dockerignore b/docker/.dockerignore deleted file mode 100644 index 92207ac..0000000 --- a/docker/.dockerignore +++ /dev/null @@ -1,13 +0,0 @@ -.DS_Store - -# ignore .git and .cache folders -.git -.gitignore -.github -.gitattributes -.cache - -# ignore all markdown files (md) beside all README*.md other than README-secret.md -*.md -!README*.md -README-secret.md diff --git a/docker/Dockerfile b/docker/Dockerfile index 2b165f5..a561509 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -59,6 +59,8 @@ RUN \ cd / && \ rm -Rf "node-v$NODE_VERSION" && \ rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt + +COPY . /app RUN \ apk add --no-cache --virtual .build-deps-ferdi \ @@ -69,9 +71,6 @@ RUN \ npm config set unsafe-perm true && \ npm install -g npm@latest && \ find /usr/lib/node_modules/npm -name test -o -name .bin -type d | xargs rm -rf && \ - echo "**** install ferdi server ****" && \ - mkdir -p /ferdi && \ - curl -o /ferdi/ferdi.tar.gz -L "https://github.com/getferdi/server/archive/master.tar.gz" && \ echo "**** cleanup ****" && \ apk del .build-deps-ferdi && \ rm -rf \ @@ -88,7 +87,7 @@ RUN \ /usr/lib/node_modules/npm/html \ /usr/lib/node_modules/npm/scripts -COPY root/ / +COPY docker/root/ / USER root diff --git a/docker/README.md b/docker/README.md index 8e0da08..5daa9fc 100644 --- a/docker/README.md +++ b/docker/README.md @@ -202,11 +202,10 @@ Below are the instructions for updating the container to get the most recent ver ## Building locally -If you want to make local modifications to this image for development purposes or just to customize the logic: +If you want to build this image locally, please run this command from root of [ferdi server repository](https://github.com/getferdi/server/tree/master/): ``` -git clone https://github.com/getferdi/server-docker.git -cd server-docker docker build \ + -f docker/Dockerfile \ --no-cache \ --pull \ -t getferdi/ferdi-server:latest . diff --git a/docker/root/etc/cont-init.d/50-config b/docker/root/etc/cont-init.d/50-config index 1c0caed..72b2d00 100755 --- a/docker/root/etc/cont-init.d/50-config +++ b/docker/root/etc/cont-init.d/50-config @@ -32,16 +32,6 @@ if [ -n "${TEST_RUN}" ]; then echo '**** [services.d] done ****' fi -# install ferdi-server if necessary -[[ -f /ferdi/ferdi.tar.gz ]] && \ - echo "**** Installing Ferdi-server ****" && \ - tar xf \ - /ferdi/ferdi.tar.gz -C \ - /app --strip-components=1 && \ - rm -rf \ - /ferdi && \ - chown -R abc:abc /app - # set ferdi-server status echo " " echo "**** Checking Ferdi-server settings ****" -- cgit v1.2.3-54-g00ecf From 7329a7fd852082f0216b4f67f1912eaa601981fc Mon Sep 17 00:00:00 2001 From: Michal Kostewicz Date: Sun, 7 Feb 2021 12:43:41 +0100 Subject: Add new configuration for docker with small script to generate or use APP_KEY. docker-compose was adjusted to use DATA_DIR. --- .dockerignore | 2 +- docker/Dockerfile | 109 ++++------------- docker/docker-compose.yml | 5 +- docker/entrypoint.sh | 40 +++++++ docker/root/defaults/.env.example | 35 ------ docker/root/etc/cont-init.d/10-adduser | 32 ----- docker/root/etc/cont-init.d/50-config | 174 ---------------------------- docker/root/etc/services.d/ferdi-server/run | 10 -- 8 files changed, 64 insertions(+), 343 deletions(-) create mode 100755 docker/entrypoint.sh delete mode 100755 docker/root/defaults/.env.example delete mode 100755 docker/root/etc/cont-init.d/10-adduser delete mode 100755 docker/root/etc/cont-init.d/50-config delete mode 100755 docker/root/etc/services.d/ferdi-server/run diff --git a/.dockerignore b/.dockerignore index 43c6cd0..7dad3a9 100644 --- a/.dockerignore +++ b/.dockerignore @@ -14,7 +14,7 @@ README-secret.md # ignore other directories docker -!docker/root +!docker/entrypoint.sh node_modules diff --git a/docker/Dockerfile b/docker/Dockerfile index a561509..799bb0b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,96 +1,27 @@ -FROM lsiobase/alpine:3.11 +FROM node:lts-alpine as build -# version labels -ARG BUILD_DATE -LABEL build_version="Ferdi-server-docker Build-date:- ${BUILD_DATE}" +WORKDIR /server-build + +RUN ["apk", "add", "--no-cache", "python", "make", "gcc", "g++", "libc-dev", "sqlite-dev"] + +COPY . /server-build + +RUN ["npm", "ci", "--production", "--build-from-source", "--sqlite=/usr/local"] + +FROM node:lts-alpine + +WORKDIR /app LABEL maintainer="xthursdayx" -ARG FERDI_RELEASE -ENV NODE_VERSION=10.16.3 -ENV S6_BEHAVIOUR_IF_STAGE2_FAILS=2 +ENV HOST=0.0.0.0 PORT=3333 -# install packages -RUN \ - echo "**** installing build packages ****" && \ - apk add --no-cache \ - libcap \ - libstdc++ \ - nano && \ - apk add --no-cache --virtual .build-deps \ - binutils-gold \ - curl \ - gnupg \ - gcc \ - g++ \ - linux-headers \ - make \ - memcached \ - python && \ - echo "**** downloading keys ****" && \ - # gpg keys listed at https://github.com/nodejs/node#release-keys - for key in \ - 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ - FD3A5288F042B6850C66B31F09FE44734EB7990E \ - 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ - DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ - C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ - B9AE9905FFD7803F25714661B63B535A4C206CA9 \ - 77984A986EBC2AA786BC0F66B01FBB92821C587A \ - 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \ - 4ED778F539E3634C779C87C6D7062848A1AB005C \ - A48C2BEE680E841632CD4E44F07496B3EB3C1762 \ - B9E2F5981AA6E0CD28160D9FF13993A75599653C \ - ; do \ - gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \ - gpg --batch --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \ - gpg --batch --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \ - done && \ - echo "**** installing node ****" && \ - curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz" && \ - curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" && \ - gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc && \ - grep " node-v$NODE_VERSION.tar.xz\$" SHASUMS256.txt | sha256sum -c - && \ - tar -xf "node-v$NODE_VERSION.tar.xz" && \ - cd "node-v$NODE_VERSION" && \ - ./configure --prefix=/usr && \ - make -j$(getconf _NPROCESSORS_ONLN) V= && \ - make install && \ - apk del .build-deps && \ - cd / && \ - rm -Rf "node-v$NODE_VERSION" && \ - rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt +RUN ["apk", "add", "--no-cache", "sqlite-libs", "curl"] -COPY . /app - -RUN \ - apk add --no-cache --virtual .build-deps-ferdi \ - curl \ - gnupg \ - tar && \ - echo "**** installing npm ****" && \ - npm config set unsafe-perm true && \ - npm install -g npm@latest && \ - find /usr/lib/node_modules/npm -name test -o -name .bin -type d | xargs rm -rf && \ - echo "**** cleanup ****" && \ - apk del .build-deps-ferdi && \ - rm -rf \ - ${RM_DIRS} \ - /SHASUMS256.txt \ - /tmp/* \ - /var/cache/apk/* \ - /usr/share/man/* \ - /usr/share/doc \ - /root/.node-gyp \ - /root/.config \ - /usr/lib/node_modules/npm/man \ - /usr/lib/node_modules/npm/doc \ - /usr/lib/node_modules/npm/html \ - /usr/lib/node_modules/npm/scripts - -COPY docker/root/ / +COPY --from=build /server-build /app +RUN ["touch", ".env"] +RUN ["npm", "i", "-g", "@adonisjs/cli"] -USER root +HEALTHCHECK --interval=5m --timeout=3s CMD curl -sSf http://localhost:${PORT}/health -# ports and volumes -EXPOSE 80 443 -VOLUME /app/database /app/recipes /config +COPY docker/entrypoint.sh /entrypoint.sh +CMD ["/entrypoint.sh"] \ No newline at end of file diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 7bf1b8c..364f9c3 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -24,12 +24,13 @@ services: - IS_DASHBOARD_ENABLED=true - IS_REGISTRATION_ENABLED=true - CONNECT_WITH_FRANZ=false + - DATA_DIR=/database volumes: - ferdi-config-vol:/config - - ferdi-database-vol:/app/database + - ferdi-database-vol:/database - ferdi-recipes-vol:/app/recipes ports: - - 3333:80 + - 3333:3333 restart: unless-stopped volumes: ferdi-config-vol: diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 0000000..cb0dd0f --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +echo << EOL +------------------------------------- + ____ ___ + / __/__ _______/ (_) + / _// -_) __/ _ / / + _/_/ \__/_/ \_,_/_/ + / __/__ _____ _____ ____ + _\ \/ -_) __/ |/ / -_) __/ + /___/\__/_/ |___/\__/_/ +Brought to you by getferdi.com +Support our Open Collective at: +https://opencollective.com/getferdi/ +EOL + +# Create APP key if needed +if [ ! -f "/config/FERDI_APP_KEY.txt" ]; + then + echo " " + echo "**** Generating Ferdi-server app key for first run ****" + adonis key:generate + source .env + echo $APP_KEY > /config/FERDI_APP_KEY.txt + echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" + sed -i "s/APP_KEY=/APP_KEY=$APP_KEY/g" /config/config.txt +elif [ -f "/config/FERDI_APP_KEY.txt" ]; + then + echo " " + echo "**** App Key found ****" + APP_KEY=$(cat /config/FERDI_APP_KEY.txt) + sed -i "s/APP_KEY=.*/APP_KEY=$APP_KEY/g" /config/config.txt + echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" +fi + +export APP_KEY=$APP_KEY + +node ace migration:run --force + +exec node server.js diff --git a/docker/root/defaults/.env.example b/docker/root/defaults/.env.example deleted file mode 100755 index 2ed73dc..0000000 --- a/docker/root/defaults/.env.example +++ /dev/null @@ -1,35 +0,0 @@ -HOST=0.0.0.0 -PORT=80 -NODE_ENV=development - -APP_NAME=AdonisJs -APP_URL=http://${EXTERNAL_DOMAIN} -EXTERNAL_DOMAIN=ferdi.domain.tld - -CACHE_VIEWS=false - -APP_KEY=appkey - -DB_CONNECTION=sqlite -DB_HOST=127.0.0.1 -DB_PORT=3306 -DB_USER=root -DB_PASSWORD=password -DB_DATABASE=adonis - -DB_SSL=false - -HASH_DRIVER=bcrypt - -IS_CREATION_ENABLED=true -IS_DASHBOARD_ENABLED=true -IS_REGISTRATION_ENABLED=true -CONNECT_WITH_FRANZ=true - -MAIL_CONNECTION=smtp -SMTP_PORT=2525 -SMTP_HOST=127.0.0.1 -MAIL_USERNAME=username -MAIL_PASSWORD=password -MAIL_SENDER=noreply@getferdi.com -MAIL_SSL=false diff --git a/docker/root/etc/cont-init.d/10-adduser b/docker/root/etc/cont-init.d/10-adduser deleted file mode 100755 index 8ba1aea..0000000 --- a/docker/root/etc/cont-init.d/10-adduser +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/with-contenv bash - -PUID=${PUID:-911} -PGID=${PGID:-911} - -groupmod -o -g "$PGID" abc -usermod -o -u "$PUID" abc - -echo ' -------------------------------------- - ____ ___ - / __/__ _______/ (_) - / _// -_) __/ _ / / - _/_/ \__/_/ \_,_/_/ - / __/__ _____ _____ ____ - _\ \/ -_) __/ |/ / -_) __/ - /___/\__/_/ |___/\__/_/ - -Brought to you by getferdi.com -Support our Open Collective at: -https://opencollective.com/getferdi/ -------------------------------------- -GID/UID --------------------------------------' -echo " -User uid: $(id -u abc) -User gid: $(id -g abc) -------------------------------------- -" -chown abc:abc /app -chown abc:abc /config -chown abc:abc /defaults \ No newline at end of file diff --git a/docker/root/etc/cont-init.d/50-config b/docker/root/etc/cont-init.d/50-config deleted file mode 100755 index 72b2d00..0000000 --- a/docker/root/etc/cont-init.d/50-config +++ /dev/null @@ -1,174 +0,0 @@ -#!/usr/bin/with-contenv bash - -# Display variables for troubleshooting -echo " " -echo "-------------------------------------" -echo " " -echo -e "Variables set:\\n\ -NODE_ENV=${NODE_ENV}\\n\ -EXTERNAL_DOMAIN=${EXTERNAL_DOMAIN}\\n\ -DB_CONNECTION=${DB_CONNECTION}\\n\ -DB_HOST=${DB_HOST}\\n\ -DB_PORT=${DB_PORT}\\n\ -DB_USER=${DB_USER}\\n\ -DB_PASSWORD=${DB_PASSWORD}\\n\ -DB_DATABASE=${DB_DATABASE}\\n\ -DB_SSL=${DB_SSL}\\n\ -IS_CREATION_ENABLED=${IS_CREATION_ENABLED}\\n\ -IS_DASHBOARD_ENABLED=${IS_DASHBOARD_ENABLED}\\n\ -IS_REGISTRATION_ENABLED=${IS_REGISTRATION_ENABLED}\\n\ -CONNECT_WITH_FRANZ=${CONNECT_WITH_FRANZ}\\n\ -MAIL_CONNECTION=${MAIL_CONNECTION}\\n\ -SMTP_PORT=${SMTP_PORT}\\n\ -SMTP_HOST=${SMTP_HOST}\\n\ -MAIL_SSL=${MAIL_SSL}\\n\ -MAIL_USERNAME=${MAIL_USERNAME}\\n\ -MAIL_PASSWORD=${MAIL_PASSWORD}\\n\ -MAIL_SENDER=${MAIL_SENDER}\\n" - -# Echo init finish for test runs -if [ -n "${TEST_RUN}" ]; then - echo " " - echo '**** [services.d] done ****' -fi - -# set ferdi-server status -echo " " -echo "**** Checking Ferdi-server settings ****" -if [ -f /config/config.txt ]; then - [[ "${NODE_ENV}" ]] && sed -i "s/NODE_ENV=.*/NODE_ENV=${NODE_ENV}/g" /config/config.txt - [[ "${EXTERNAL_DOMAIN}" ]] && sed -i "s/EXTERNAL_DOMAIN=.*/EXTERNAL_DOMAIN=${EXTERNAL_DOMAIN}/g" /config/config.txt - [[ "${IS_CREATION_ENABLED}" ]] && sed -i "s/IS_CREATION_ENABLED=.*/IS_CREATION_ENABLED=${IS_CREATION_ENABLED}/g" /config/config.txt - [[ "${IS_DASHBOARD_ENABLED}" ]] && sed -i "s/IS_DASHBOARD_ENABLED=.*/IS_DASHBOARD_ENABLED=${IS_DASHBOARD_ENABLED}/g" /config/config.txt - [[ "${IS_REGISTRATION_ENABLED}" ]] && sed -i "s/IS_REGISTRATION_ENABLED=.*/IS_REGISTRATION_ENABLED=${IS_REGISTRATION_ENABLED}/g" /config/config.txt - [[ "${CONNECT_WITH_FRANZ}" ]] && sed -i "s/CONNECT_WITH_FRANZ=.*/CONNECT_WITH_FRANZ=${CONNECT_WITH_FRANZ}/g" /config/config.txt - [[ "${DB_CONNECTION}" ]] && sed -i "s/DB_CONNECTION=.*/DB_CONNECTION=${DB_CONNECTION}/g" /config/config.txt - [[ "${DB_HOST}" ]] && sed -i "s/DB_HOST=.*/DB_HOST=${DB_HOST}/g" /config/config.txt - [[ "${DB_PORT}" ]] && sed -i "s/DB_PORT=.*/DB_PORT=${DB_PORT}/g" /config/config.txt - [[ "${DB_DATABASE}" ]] && sed -i "s/DB_DATABASE=.*/DB_DATABASE=${DB_DATABASE}/g" /config/config.txt - [[ "${DB_USER}" ]] && sed -i "s/DB_USER=.*/DB_USER=${DB_USER}/g" /config/config.txt - [[ "${DB_PASSWORD}" ]] && sed -i "s/DB_PASSWORD=.*/DB_PASSWORD=${DB_PASSWORD}/g" /config/config.txt - [[ "${DB_SSL}" ]] && sed -i "s/DB_SSL=.*/DB_SSL=${DB_SSL}/g" /config/config.txt - [[ "${MAIL_CONNECTION}" ]] && sed -i "s/MAIL_CONNECTION=.*/MAIL_CONNECTION=${MAIL_CONNECTION}/g" /config/config.txt - [[ "${SMTP_HOST}" ]] && sed -i "s/SMTP_HOST=.*/SMTP_HOST=${SMTP_HOST}/g" /config/config.txt - [[ "${SMTP_PORT}" ]] && sed -i "s/SMTP_PORT=.*/SMTP_PORT=${SMTP_PORT}/g" /config/config.txt - [[ "${MAIL_SSL}" ]] && sed -i "s/MAIL_SSL=.*/MAIL_SSL=${MAIL_SSL}/g" /config/config.txt - [[ "${MAIL_USERNAME}" ]] && sed -i "s/MAIL_USERNAME=.*/MAIL_USERNAME=${MAIL_USERNAME}/g" /config/config.txt - [[ "${MAIL_PASSWORD}" ]] && sed -i "s/MAIL_PASSWORD=.*/MAIL_PASSWORD=${MAIL_PASSWORD}/g" /config/config.txt - [[ "${MMAIL_SENDER}" ]] && sed -i "s/MAIL_SENDER=.*/MAIL_SENDER=${MAIL_SENDER}/g" /config/config.txt - rm /config/.env - cp /config/config.txt /config/.env -elif [ ! -f /config/config.txt ]; then - echo " " - echo "**** Generating .env file ****" - cp /defaults/.env.example /config/.env - [[ "${NODE_ENV}" ]] && sed -i "s/NODE_ENV=.*/NODE_ENV=${NODE_ENV}/g" /config/.env - [[ "${EXTERNAL_DOMAIN}" ]] && sed -i "s/EXTERNAL_DOMAIN=.*/EXTERNAL_DOMAIN=${EXTERNAL_DOMAIN}/g" /config/.env - [[ "${IS_CREATION_ENABLED}" ]] && sed -i "s/IS_CREATION_ENABLED=.*/IS_CREATION_ENABLED=${IS_CREATION_ENABLED}/g" /config/.env - [[ "${IS_DASHBOARD_ENABLED}" ]] && sed -i "s/IS_DASHBOARD_ENABLED=.*/IS_DASHBOARD_ENABLED=${IS_DASHBOARD_ENABLED}/g" /config/.env - [[ "${IS_REGISTRATION_ENABLED}" ]] && sed -i "s/IS_REGISTRATION_ENABLED=.*/IS_REGISTRATION_ENABLED=${IS_REGISTRATION_ENABLED}/g" /config/.env - [[ "${CONNECT_WITH_FRANZ}" ]] && sed -i "s/CONNECT_WITH_FRANZ=.*/CONNECT_WITH_FRANZ=${CONNECT_WITH_FRANZ}/g" /config/.env - [[ "${DB_CONNECTION}" ]] && sed -i "s/DB_CONNECTION=.*/DB_CONNECTION=${DB_CONNECTION}/g" /config/.env - [[ "${DB_HOST}" ]] && sed -i "s/DB_HOST=.*/DB_HOST=${DB_HOST}/g" /config/.env - [[ "${DB_PORT}" ]] && sed -i "s/DB_PORT=.*/DB_PORT=${DB_PORT}/g" /config/.env - [[ "${DB_DATABASE}" ]] && sed -i "s/DB_DATABASE=.*/DB_DATABASE=${DB_DATABASE}/g" /config/.env - [[ "${DB_USER}" ]] && sed -i "s/DB_USER=.*/DB_USER=${DB_USER}/g" /config/.env - [[ "${DB_PASSWORD}" ]] && sed -i "s/DB_PASSWORD=.*/DB_PASSWORD=${DB_PASSWORD}/g" /config/.env - [[ "${DB_SSL}" ]] && sed -i "s/DB_SSL=.*/DB_SSL=${DB_SSL}/g" /config/.env - [[ "${MAIL_CONNECTION}" ]] && sed -i "s/MAIL_CONNECTION=.*/MAIL_CONNECTION=${MAIL_CONNECTION}/g" /config/.env - [[ "${SMTP_HOST}" ]] && sed -i "s/SMTP_HOST=.*/SMTP_HOST=${SMTP_HOST}/g" /config/.env - [[ "${SMTP_PORT}" ]] && sed -i "s/SMTP_PORT=.*/SMTP_PORT=${SMTP_PORT}/g" /config/.env - [[ "${MAIL_SSL}" ]] && sed -i "s/MAIL_SSL=.*/MAIL_SSL=${MAIL_SSL}/g" /config/.env - [[ "${MAIL_USERNAME}" ]] && sed -i "s/MAIL_USERNAME=.*/MAIL_USERNAME=${MAIL_USERNAME}/g" /config/.env - [[ "${MAIL_PASSWORD}" ]] && sed -i "s/MAIL_PASSWORD=.*/MAIL_PASSWORD=${MAIL_PASSWORD}/g" /config/.env - [[ "${MMAIL_SENDER}" ]] && sed -i "s/MAIL_SENDER=.*/MAIL_SENDER=${MAIL_SENDER}/g" /config/.env - cp /config/.env /config/config.txt -fi - -# update .env -if [ -f /app/.env ]; then - rm /app/.env - ln -s /config/.env /app/.env -elif [ ! -f /app/.env ]; then - ln -s /config/.env /app/.env -fi - -# install adonisjs cli -echo " " -echo "**** Installing AdonisJS and deps ****" -cd /app -echo " " -npm config set unsafe-perm true -npm i -g @adonisjs/cli - -# install adonisjs dependencies -npm install - -# make custom recipe dir -if [ ! -f /app/recipes/dev ]; then -mkdir -p /app/recipes/dev -fi - -# setting the database helper -if [ "${DB_CONNECTION}" = "sqlite" ]; then - echo " " - echo "**** DB helper loaded ****" - else npm i ${DB_CONNECTION} - echo " " - echo "**** DB Helper loaded ****" -fi - -# check for the database endpoint for 30 seconds -echo " " -echo "**** Checking DB endpoint ****" -source .env -END=$((SECONDS+30)) -while [ ${SECONDS} -lt ${END} ] && [ "${DB_HOST} ${DB_PORT}" ]; - do - /usr/bin/nc -z ${DB_HOST} ${DB_PORT} && \ - if [ ! -z "$(/usr/bin/nc -w1 ${DB_HOST} ${DB_PORT})" ]; - then - [ ! -z "${RUN}" ] && break - RUN="RAN" - # we sleep here again due to first run init on DB containers - [ ! -f /dbwait.lock ] && sleep 5 - else - sleep 1 - fi - sleep 1 -done - -# source the .env file -source .env - -# database migration -echo " " -echo "**** Run DB migration ****" -adonis migration:run --force - -# Create APP key if needed -if [ ! -f "/config/FERDI_APP_KEY.txt" ]; - then - echo " " - echo "**** Generating Ferdi-server app key for first run ****" - adonis key:generate - source .env - echo $APP_KEY > /config/FERDI_APP_KEY.txt - echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" - sed -i "s/APP_KEY=/APP_KEY=$APP_KEY/g" /config/config.txt -elif [ -f "/config/FERDI_APP_KEY.txt" ]; - then - echo " " - echo "**** App Key found ****" - APP_KEY=$(cat /config/FERDI_APP_KEY.txt) - sed -i "s/APP_KEY=.*/APP_KEY=$APP_KEY/g" /config/config.txt - echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" -fi - -# set permissions -chown -R abc:abc \ - /config \ - /app - -# set lockfile to avoid DB waits for this specific container -touch /dbwait.lock diff --git a/docker/root/etc/services.d/ferdi-server/run b/docker/root/etc/services.d/ferdi-server/run deleted file mode 100755 index cf1568c..0000000 --- a/docker/root/etc/services.d/ferdi-server/run +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/with-contenv bash - -cd /app - -setcap 'cap_net_bind_service=+ep' `which node` - -# start server -echo " " -echo "**** Starting Ferdi-server ****" -exec s6-setuidgid abc adonis serve --dev \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 794108b4d555d82e59d476d823d5cb87791a67fc Mon Sep 17 00:00:00 2001 From: Michal Kostewicz Date: Sun, 7 Feb 2021 12:44:46 +0100 Subject: Change database.js so any system folder can be used to keep database files --- config/database.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/database.js b/config/database.js index b7f57ad..6e08035 100644 --- a/config/database.js +++ b/config/database.js @@ -31,7 +31,7 @@ module.exports = { sqlite: { client: 'sqlite3', connection: { - filename: Helpers.appRoot(`${Env.get('DATA_DIR', 'database')}/${Env.get('DB_DATABASE', 'development')}.sqlite`), + filename: `${Env.get('DATA_DIR', 'database')}/${Env.get('DB_DATABASE', 'development')}.sqlite`, }, useNullAsDefault: true, debug: Env.get('DB_DEBUG', false), -- cgit v1.2.3-54-g00ecf From 02000d89159ba171cabbd341139871236f3df386 Mon Sep 17 00:00:00 2001 From: Michal Kostewicz Date: Sun, 7 Feb 2021 14:23:57 +0100 Subject: Revert line which choose DB folder using env. Move Dockerfile to root. Simplify export in entrypoint. Update README --- Dockerfile | 26 ++++++++++++++++++++++++++ README.md | 40 +--------------------------------------- config/database.js | 2 +- docker/Dockerfile | 27 --------------------------- docker/README.md | 1 + docker/docker-compose.yml | 6 +++--- docker/entrypoint.sh | 2 +- 7 files changed, 33 insertions(+), 71 deletions(-) create mode 100644 Dockerfile delete mode 100644 docker/Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..416c503 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM node:lts-alpine as build + +WORKDIR /server-build + +RUN ["apk", "add", "--no-cache", "python", "make", "gcc", "g++", "libc-dev", "sqlite-dev"] + +COPY . /server-build + +RUN ["npm", "ci", "--production", "--build-from-source", "--sqlite=/usr/local"] + +FROM node:lts-alpine + +WORKDIR /app +LABEL maintainer="xthursdayx" + +ENV HOST=0.0.0.0 PORT=3333 + +RUN ["apk", "add", "--no-cache", "sqlite-libs", "curl"] + +COPY --from=build /server-build /app +RUN ["npm", "i", "-g", "@adonisjs/cli"] + +HEALTHCHECK --interval=5m --timeout=3s CMD curl -sSf http://localhost:${PORT}/health + +COPY docker/entrypoint.sh /entrypoint.sh +CMD ["/entrypoint.sh"] \ No newline at end of file diff --git a/README.md b/README.md index 9d1b02d..60de4fc 100644 --- a/README.md +++ b/README.md @@ -78,45 +78,7 @@ After setting up the docker container we recommend you to set up an NGINX revers getferdi/ferdi-server ``` - Alternatively, you can also use docker-compose v2 schemas - - ```sh - --- - version: "2" - services: - ferdi-server: - image: getferdi/ferdi-server - container_name: ferdi-server - environment: - - NODE_ENV=development - - EXTERNAL_DOMAIN= - - DB_CONNECTION= - - DB_HOST= - - DB_PORT= - - DB_USER= - - DB_PASSWORD= - - DB_DATABASE= - - DB_SSL=true/false - - MAIL_CONNECTION= - - SMPT_HOST= - - SMTP_PORT= - - MAIL_SSL=true/false - - MAIL_USERNAME= - - MAIL_PASSWORD= - - MAIL_SENDER= - - IS_CREATION_ENABLED=true/false - - IS_DASHBOARD_ENABLED=true/false - - IS_REGISTRATION_ENABLED=true/false - - CONNECT_WITH_FRANZ=true/false - volumes: - - :/config - - :/app/database - - :/app/recipes - ports: - - :80 - restart: unless-stopped - ``` - You can also use sample [./docker/docker-compose.yml](https://github.com/getferdi/server/tree/master/docker/docker-compose.yml) file. + Alternatively, you can also use docker-compose v2 schemas. An example can be found in [./docker/docker-compose.yml](https://github.com/getferdi/server/tree/master/docker/docker-compose.yml) file. 3. 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). diff --git a/config/database.js b/config/database.js index 6e08035..b7f57ad 100644 --- a/config/database.js +++ b/config/database.js @@ -31,7 +31,7 @@ module.exports = { sqlite: { client: 'sqlite3', connection: { - filename: `${Env.get('DATA_DIR', 'database')}/${Env.get('DB_DATABASE', 'development')}.sqlite`, + filename: Helpers.appRoot(`${Env.get('DATA_DIR', 'database')}/${Env.get('DB_DATABASE', 'development')}.sqlite`), }, useNullAsDefault: true, debug: Env.get('DB_DEBUG', false), diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 799bb0b..0000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -FROM node:lts-alpine as build - -WORKDIR /server-build - -RUN ["apk", "add", "--no-cache", "python", "make", "gcc", "g++", "libc-dev", "sqlite-dev"] - -COPY . /server-build - -RUN ["npm", "ci", "--production", "--build-from-source", "--sqlite=/usr/local"] - -FROM node:lts-alpine - -WORKDIR /app -LABEL maintainer="xthursdayx" - -ENV HOST=0.0.0.0 PORT=3333 - -RUN ["apk", "add", "--no-cache", "sqlite-libs", "curl"] - -COPY --from=build /server-build /app -RUN ["touch", ".env"] -RUN ["npm", "i", "-g", "@adonisjs/cli"] - -HEALTHCHECK --interval=5m --timeout=3s CMD curl -sSf http://localhost:${PORT}/health - -COPY docker/entrypoint.sh /entrypoint.sh -CMD ["/entrypoint.sh"] \ No newline at end of file diff --git a/docker/README.md b/docker/README.md index 5daa9fc..995ca8a 100644 --- a/docker/README.md +++ b/docker/README.md @@ -101,6 +101,7 @@ After the first run, Ferdi-server's configuration is saved inside the `config.tx | `-e IS_DASHBOARD_ENABLED=true` | for specifying whether to enable the Ferdi-server dashboard, default is true | | `-e IS_REGISTRATION_ENABLED=true` | for specifying whether to allow user registration, default is true | | `-e CONNECT_WITH_FRANZ=true` | for specifying whether to enable connections to the Franz server, default is true | +| `-e DATA_DIR=database` | for specifying sql-lite database folder, default is database | | `-v :/config` | this will store persistent ENV data on the docker host | | `-v :/app/database` | this will strore Ferdi-server's database on the docker host for persistence | | `-v :/app/recipes` | this will strore Ferdi-server's recipes on the docker host for persistence | diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 364f9c3..8a8c795 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -24,10 +24,10 @@ services: - IS_DASHBOARD_ENABLED=true - IS_REGISTRATION_ENABLED=true - CONNECT_WITH_FRANZ=false - - DATA_DIR=/database + - DATA_DIR=my-database volumes: - ferdi-config-vol:/config - - ferdi-database-vol:/database + - ferdi-database-vol:/app/my-database - ferdi-recipes-vol:/app/recipes ports: - 3333:3333 @@ -35,4 +35,4 @@ services: volumes: ferdi-config-vol: ferdi-database-vol: - ferdi-recipes-vol: \ No newline at end of file + ferdi-recipes-vol: diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index cb0dd0f..667196e 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -33,7 +33,7 @@ elif [ -f "/config/FERDI_APP_KEY.txt" ]; echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" fi -export APP_KEY=$APP_KEY +export APP_KEY node ace migration:run --force -- cgit v1.2.3-54-g00ecf From bbd2132feede2d8c5e214c4d8a436f5505b9a766 Mon Sep 17 00:00:00 2001 From: Michal Kostewicz Date: Sun, 7 Feb 2021 16:26:58 +0100 Subject: Add script which will use config.txt if exist --- .env.example | 2 +- docker/README.md | 5 +++-- docker/entrypoint.sh | 15 ++++++++++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index d507d6c..b11a2cc 100644 --- a/.env.example +++ b/.env.example @@ -10,7 +10,7 @@ CACHE_VIEWS=false APP_KEY= -DATA_DIR=data +DATA_DIR=database DB_CONNECTION=sqlite DB_HOST=127.0.0.1 diff --git a/docker/README.md b/docker/README.md index 995ca8a..2708714 100644 --- a/docker/README.md +++ b/docker/README.md @@ -76,11 +76,12 @@ The server will be launched at [http://localhost:3333/](http://localhost:3333/) ## Configuration Container images are configured using parameters passed at runtime (such as those above). These parameters are separated by a colon and indicate `:` respectively. For example, `-p 3333:80` would expose port `80` from inside the container to be accessible from the host's IP on port `3333` outside the container. -After the first run, Ferdi-server's configuration is saved inside the `config.txt` file inside your persistent data directory (`/config` in the container). +After the first run, Ferdi-server's default configuration is saved inside the `config.txt` file inside your persistent data directory (`/config` in the container). +If any environmental parameter is not passed to the container, its value will be taken from the `config.txt` file. You can also edit the `config.txt` file, but it is advisable to send the environment parameters to the container. | Parameter | Function | | :----: | --- | -| `-p :80` | will map the container's port 80 to a port on the host, default is 3333 | +| `-p :3333` | will map the container's port 80 to a port on the host, default is 3333 | | `-e NODE_ENV=development` | for specifying Node environment, production or development, default is development | | `-e EXTERNAL_DOMAIN=` | for specifying external domain address of the ferdi server | | `-e DB_CONNECTION=sqlite` | for specifying the database being used, default is sqlite | diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 667196e..0bbcb9d 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -14,13 +14,26 @@ Support our Open Collective at: https://opencollective.com/getferdi/ EOL +# if config.txt doesn't exist then create one with default values +if [ ! -f /config/config.txt ]; then + cp /app/.env.example /config/config.txt +fi + +# use config.txt default values as .env file +if [ -f /app/.env ]; then + rm /app/.env + ln -s /config/config.txt /app/.env +elif [ ! -f /app/.env ]; then + ln -s /config/config.txt /app/.env +fi + # Create APP key if needed if [ ! -f "/config/FERDI_APP_KEY.txt" ]; then echo " " echo "**** Generating Ferdi-server app key for first run ****" adonis key:generate - source .env + APP_KEY=$(grep APP_KEY .env | cut -d '=' -f2) echo $APP_KEY > /config/FERDI_APP_KEY.txt echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" sed -i "s/APP_KEY=/APP_KEY=$APP_KEY/g" /config/config.txt -- cgit v1.2.3-54-g00ecf From 020bc369022d4937e4404babb436f21eccb9db0b Mon Sep 17 00:00:00 2001 From: Michal Kostewicz Date: Sun, 7 Feb 2021 16:30:19 +0100 Subject: Adjust README info about DATA_DIR --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 2708714..6e18d16 100644 --- a/docker/README.md +++ b/docker/README.md @@ -102,7 +102,7 @@ If any environmental parameter is not passed to the container, its value will be | `-e IS_DASHBOARD_ENABLED=true` | for specifying whether to enable the Ferdi-server dashboard, default is true | | `-e IS_REGISTRATION_ENABLED=true` | for specifying whether to allow user registration, default is true | | `-e CONNECT_WITH_FRANZ=true` | for specifying whether to enable connections to the Franz server, default is true | -| `-e DATA_DIR=database` | for specifying sql-lite database folder, default is database | +| `-e DATA_DIR=database` | for specifying sql-lite database folder, default is database. Currently you need to use folder inside `/app` directory | | `-v :/config` | this will store persistent ENV data on the docker host | | `-v :/app/database` | this will strore Ferdi-server's database on the docker host for persistence | | `-v :/app/recipes` | this will strore Ferdi-server's recipes on the docker host for persistence | -- cgit v1.2.3-54-g00ecf From b250a512363fb127d79078f13e1a0a132569e74e Mon Sep 17 00:00:00 2001 From: Michal Kostewicz Date: Mon, 8 Feb 2021 17:53:04 +0100 Subject: Fix DATA_DIR examples in README.md --- docker/README.md | 4 ++-- docker/docker-compose.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/README.md b/docker/README.md index 6e18d16..8518e15 100644 --- a/docker/README.md +++ b/docker/README.md @@ -56,6 +56,7 @@ To create the docker container with the proper parameters: -e IS_DASHBOARD_ENABLED=true \ -e IS_REGISTRATION_ENABLED=true \ -e CONNECT_WITH_FRANZ=true \ + -e DATA_DIR=data \ -p :80 \ -v :/config \ -v :/app/database \ @@ -102,7 +103,7 @@ If any environmental parameter is not passed to the container, its value will be | `-e IS_DASHBOARD_ENABLED=true` | for specifying whether to enable the Ferdi-server dashboard, default is true | | `-e IS_REGISTRATION_ENABLED=true` | for specifying whether to allow user registration, default is true | | `-e CONNECT_WITH_FRANZ=true` | for specifying whether to enable connections to the Franz server, default is true | -| `-e DATA_DIR=database` | for specifying sql-lite database folder, default is database. Currently you need to use folder inside `/app` directory | +| `-e DATA_DIR=data` | for specifying sql-lite database folder, default is database. | | `-v :/config` | this will store persistent ENV data on the docker host | | `-v :/app/database` | this will strore Ferdi-server's database on the docker host for persistence | | `-v :/app/recipes` | this will strore Ferdi-server's recipes on the docker host for persistence | @@ -207,7 +208,6 @@ Below are the instructions for updating the container to get the most recent ver If you want to build this image locally, please run this command from root of [ferdi server repository](https://github.com/getferdi/server/tree/master/): ``` docker build \ - -f docker/Dockerfile \ --no-cache \ --pull \ -t getferdi/ferdi-server:latest . diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 8a8c795..64797c4 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -24,10 +24,10 @@ services: - IS_DASHBOARD_ENABLED=true - IS_REGISTRATION_ENABLED=true - CONNECT_WITH_FRANZ=false - - DATA_DIR=my-database + - DATA_DIR=data volumes: - ferdi-config-vol:/config - - ferdi-database-vol:/app/my-database + - ferdi-database-vol:/app/data - ferdi-recipes-vol:/app/recipes ports: - 3333:3333 -- cgit v1.2.3-54-g00ecf From 0a3ce5a9e37dd917cfabdf97fdc18a41d88c65eb Mon Sep 17 00:00:00 2001 From: Michal Kostewicz Date: Tue, 9 Feb 2021 21:28:23 +0100 Subject: Fix all issues found on CR -> especially update README.md, remove creation of new config.txt, update ignore files. --- .dockerignore | 7 ++++--- .env.example | 2 +- .gitignore | 3 +-- README.md | 4 ++-- docker/.gitignore | 4 ---- docker/README.md | 16 +++++----------- docker/entrypoint.sh | 16 +++++----------- 7 files changed, 18 insertions(+), 34 deletions(-) diff --git a/.dockerignore b/.dockerignore index 7dad3a9..01c565b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -7,10 +7,11 @@ .gitattributes .cache -# ignore all markdown files (md) beside all README*.md other than README-secret.md +# ignore all markdown files *.md -!README*.md -README-secret.md + +# Ignore database files +*.sqlite # ignore other directories docker diff --git a/.env.example b/.env.example index b11a2cc..a11ce1f 100644 --- a/.env.example +++ b/.env.example @@ -10,7 +10,7 @@ CACHE_VIEWS=false APP_KEY= -DATA_DIR=database +DATA_DIR= DB_CONNECTION=sqlite DB_HOST=127.0.0.1 diff --git a/.gitignore b/.gitignore index 0f1f969..267390d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,8 +8,7 @@ tmp .env # The development sqlite file -database/development.sqlite -database/adonis.sqlite +*.sqlite # Uploaded recipes recipes/ diff --git a/README.md b/README.md index 60de4fc..2e0d9f9 100644 --- a/README.md +++ b/README.md @@ -78,11 +78,11 @@ After setting up the docker container we recommend you to set up an NGINX revers getferdi/ferdi-server ``` - Alternatively, you can also use docker-compose v2 schemas. An example can be found in [./docker/docker-compose.yml](https://github.com/getferdi/server/tree/master/docker/docker-compose.yml) file. + Alternatively, you can also use docker-compose v2 schema. An example can be found [in the docker folder](./docker/docker-compose.yml). 3. 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). -For more information on configuring the Docker image, please read [./docker/README.md](https://github.com/getferdi/server/tree/master/docker/README.md). +For more information on configuring the Docker image, please read [the ferdi docker documentation](./docker/README.md). ### Manual setup 1. Clone this repository diff --git a/docker/.gitignore b/docker/.gitignore index b726524..552cd4a 100644 --- a/docker/.gitignore +++ b/docker/.gitignore @@ -4,10 +4,6 @@ node_modules # Adonis directory for storing tmp files tmp -# The development sqlite file -database/development.sqlite -database/adonis.sqlite - # Uploaded recipes recipes/ diff --git a/docker/README.md b/docker/README.md index 8518e15..1cea8ae 100644 --- a/docker/README.md +++ b/docker/README.md @@ -76,9 +76,11 @@ The server will be launched at [http://localhost:3333/](http://localhost:3333/) ## Configuration -Container images are configured using parameters passed at runtime (such as those above). These parameters are separated by a colon and indicate `:` respectively. For example, `-p 3333:80` would expose port `80` from inside the container to be accessible from the host's IP on port `3333` outside the container. -After the first run, Ferdi-server's default configuration is saved inside the `config.txt` file inside your persistent data directory (`/config` in the container). -If any environmental parameter is not passed to the container, its value will be taken from the `config.txt` file. You can also edit the `config.txt` file, but it is advisable to send the environment parameters to the container. +Container images are configured using parameters passed at runtime (such as those above). + +**Warning ,using `config.txt` will be deprecated in the future releases.** + +If 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.** | Parameter | Function | | :----: | --- | @@ -213,13 +215,5 @@ docker build \ -t getferdi/ferdi-server:latest . ``` -## Versions - -* **05.02.21:** - Repository moved to ferdi-server repository -* **19.01.21:** - Updated Mail SSL and DB SLL settings -* **20.09.20:** - Updated SMTP Mailer settings for password reset. -* **21.06.20:** - Rebase to Alpine 3.11 and added Mailer settings. -* **25.09.19:** - Initial Release. - ## License Ferdi-server-docker and ferdi-server are licensed under the MIT License. diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 0bbcb9d..eac3fc8 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -14,17 +14,11 @@ Support our Open Collective at: https://opencollective.com/getferdi/ EOL -# if config.txt doesn't exist then create one with default values -if [ ! -f /config/config.txt ]; then - cp /app/.env.example /config/config.txt -fi - -# use config.txt default values as .env file -if [ -f /app/.env ]; then - rm /app/.env - ln -s /config/config.txt /app/.env -elif [ ! -f /app/.env ]; then - ln -s /config/config.txt /app/.env +# use config.txt or .env.example parameter values as default if they are not passed to container +if [ -f /config/config.txt ]; then + cp /config/config.txt /app/.env +else + cp /app/.env.example /app/.env fi # Create APP key if needed -- cgit v1.2.3-54-g00ecf From b45b258c2188bed5319f981dbe99171c7db2ce40 Mon Sep 17 00:00:00 2001 From: Michał Kostewicz Date: Tue, 9 Feb 2021 21:33:14 +0100 Subject: Update docker/README.md Co-authored-by: Cromefire_ --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 1cea8ae..73c660d 100644 --- a/docker/README.md +++ b/docker/README.md @@ -78,7 +78,7 @@ The server will be launched at [http://localhost:3333/](http://localhost:3333/) Container images are configured using parameters passed at runtime (such as those above). -**Warning ,using `config.txt` will be deprecated in the future releases.** +**Warning, using `config.txt` will be deprecated in the future releases.** If 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.** -- cgit v1.2.3-54-g00ecf From 489b90c81cc51321015dbb678ac42503d770b45c Mon Sep 17 00:00:00 2001 From: Michał Kostewicz Date: Tue, 9 Feb 2021 21:51:09 +0100 Subject: Update docker/README.md - removing logo from docker readme Co-authored-by: Cromefire_ --- docker/README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docker/README.md b/docker/README.md index 73c660d..f7345ca 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,7 +1,3 @@ -

- -

- # Ferdi-server-docker [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. -- cgit v1.2.3-54-g00ecf From 17c8eed91a061fcda781bf42ca58a75b188f69cc Mon Sep 17 00:00:00 2001 From: Michał Kostewicz Date: Tue, 9 Feb 2021 21:52:54 +0100 Subject: Update docker/README.md - one mention for MariaDB/MySQL Co-authored-by: Cromefire_ --- docker/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker/README.md b/docker/README.md index f7345ca..66364b0 100644 --- a/docker/README.md +++ b/docker/README.md @@ -116,8 +116,7 @@ To use a different database than the default, SQLite, enter the driver code belo | Database | Driver | | :----: | --- | -| MariaDB | mysql | -| MySQL | mysql | +| MariaDB/MySQL | mysql | | PostgreSQL | pg | | SQLite3 | sqlite | -- cgit v1.2.3-54-g00ecf From 88c94fbb301f7778f288d08e6daa81bef96a7e7f Mon Sep 17 00:00:00 2001 From: Michal Kostewicz Date: Tue, 9 Feb 2021 21:59:11 +0100 Subject: Mark Ethereal as deprecated --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 1cea8ae..b5cd3a8 100644 --- a/docker/README.md +++ b/docker/README.md @@ -134,7 +134,7 @@ To use a different email sender than the default, SMTP, enter the correct inform | SMTP | SMTP_PORT, SMTP_HOST, MAIL_USERNAME, MAIL_PASSWORD, MAIL_SSL | | SparkPost | SPARKPOST_API_KEY | | Mailgun | MAILGUN_DOMAIN, MAILGUN_API_REGION, MAILGUN_API_KEY | -| Ethereal | A disposable account is created automatically if you choose this option. | +| (**Deprecated**) Ethereal | A disposable account is created automatically if you choose this option. | ## NGINX config block To access Ferdi-server from outside of your home network on a subdomain use this server block: -- cgit v1.2.3-54-g00ecf From 824d5f1423176397038707227403e796162503be Mon Sep 17 00:00:00 2001 From: Michał Kostewicz Date: Tue, 9 Feb 2021 22:09:20 +0100 Subject: Update docker/README.md - update information about usage of NGINX Co-authored-by: Cromefire_ --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 00e3df7..780dcb1 100644 --- a/docker/README.md +++ b/docker/README.md @@ -20,7 +20,7 @@ A custom ferdi-server allows you to experience the full potential of the Ferdi c Here are some example snippets to help you get started creating a container. -The docker can be run as is, with the default sqlite database, or you can modifying your ENV variables to use an external database (e.g. MYSql, MariaDB, Postgres, etc). After setting up the docker container you will need to create a NGINX reverse proxy to access Ferdi-server outside of your home network. +The 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. ### docker -- cgit v1.2.3-54-g00ecf From 87b70a6f33aeee974165557e4ffd6cf07ba1c879 Mon Sep 17 00:00:00 2001 From: Michal Kostewicz Date: Sun, 14 Feb 2021 09:52:17 +0100 Subject: Change main license holder to Ferdi and remove one existing in docker directory --- LICENSE | 2 +- docker/LICENSE | 21 --------------------- 2 files changed, 1 insertion(+), 22 deletions(-) delete mode 100644 docker/LICENSE diff --git a/LICENSE b/LICENSE index 2ae8432..1633187 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 vantezzen +Copyright (c) 2019 Ferdi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/docker/LICENSE b/docker/LICENSE deleted file mode 100644 index a91c1fe..0000000 --- a/docker/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 xthursdayx - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -- cgit v1.2.3-54-g00ecf From c039b3ebde1e0f73ab1f465fa0c752bbbac990be Mon Sep 17 00:00:00 2001 From: thursday Date: Thu, 8 Jul 2021 16:33:26 -0400 Subject: Update .dockerignore --- .dockerignore | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.dockerignore b/.dockerignore index 01c565b..93c1caf 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,10 +1,7 @@ .DS_Store # ignore .git and .cache folders -.git -.gitignore -.github -.gitattributes +.git* .cache # ignore all markdown files -- cgit v1.2.3-54-g00ecf From 4e12368d7674b5c0da5ec07d25fc67e966586cc9 Mon Sep 17 00:00:00 2001 From: thursday Date: Fri, 9 Jul 2021 02:58:17 -0400 Subject: Comment out code to generate .env file Remove code to check for `config.txt` and generate `/app/.env` file, but keep it in comments for now as documentation. --- docker/entrypoint.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index eac3fc8..cfc6b9c 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -15,11 +15,11 @@ https://opencollective.com/getferdi/ EOL # use config.txt or .env.example parameter values as default if they are not passed to container -if [ -f /config/config.txt ]; then - cp /config/config.txt /app/.env -else - cp /app/.env.example /app/.env -fi +#if [ -f /config/config.txt ]; then +# cp /config/config.txt /app/.env +#else +# cp /app/.env.example /app/.env +#fi # Create APP key if needed if [ ! -f "/config/FERDI_APP_KEY.txt" ]; -- cgit v1.2.3-54-g00ecf From 4d8f22107e067ea8c7a32194dc775ea35c6a7a72 Mon Sep 17 00:00:00 2001 From: thursday Date: Fri, 9 Jul 2021 03:13:30 -0400 Subject: Apply suggestions from code review --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 416c503..f8fde91 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ COPY . /server-build RUN ["npm", "ci", "--production", "--build-from-source", "--sqlite=/usr/local"] FROM node:lts-alpine - + # TODO implement process to run ferdi-server as non-root user. See comments on https://github.com/getferdi/server/pull/48/ WORKDIR /app LABEL maintainer="xthursdayx" @@ -23,4 +23,4 @@ RUN ["npm", "i", "-g", "@adonisjs/cli"] HEALTHCHECK --interval=5m --timeout=3s CMD curl -sSf http://localhost:${PORT}/health COPY docker/entrypoint.sh /entrypoint.sh -CMD ["/entrypoint.sh"] \ No newline at end of file +CMD ["/entrypoint.sh"] -- cgit v1.2.3-54-g00ecf From d1e89771d0a36545ac94a876ef3a0639e7785b8a Mon Sep 17 00:00:00 2001 From: thursday Date: Fri, 9 Jul 2021 03:15:20 -0400 Subject: Update comment to deprecate use of config.txt Explain the deprecated state of config.txt (and .env) and reference the readme and .env.example. --- docker/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index cfc6b9c..8d00250 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -14,7 +14,7 @@ Support our Open Collective at: https://opencollective.com/getferdi/ EOL -# use config.txt or .env.example parameter values as default if they are not passed to container +# Use of config.txt in this image is deprecated. Users should include the environmental variables listed in the README.md when the running the container or use docker compose with an .env file based on the included .env.example. #if [ -f /config/config.txt ]; then # cp /config/config.txt /app/.env #else -- cgit v1.2.3-54-g00ecf From 0caee16078a24e1af3d655b5cb1c43bbca5d31dd Mon Sep 17 00:00:00 2001 From: thursday Date: Fri, 9 Jul 2021 16:56:48 -0400 Subject: Updated .env.example To match changes to database.js as per the discussion here: https://github.com/getferdi/server/pull/48#discussion_r667150127 --- .env.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index a11ce1f..19af6e3 100644 --- a/.env.example +++ b/.env.example @@ -10,14 +10,14 @@ CACHE_VIEWS=false APP_KEY= -DATA_DIR= +DATA_DIR=data DB_CONNECTION=sqlite DB_HOST=127.0.0.1 DB_PORT=3306 DB_USER=root DB_PASSWORD= -DB_DATABASE=adonis +DB_DATABASE=database DB_SSL=false -- cgit v1.2.3-54-g00ecf From c6483e8effb6e10e889c775b7f647d64e990e86b Mon Sep 17 00:00:00 2001 From: thursday Date: Fri, 9 Jul 2021 17:02:36 -0400 Subject: Update database.js Update default sqlite data directory and database as per: https://github.com/getferdi/server/pull/48#discussion_r667150127 --- config/database.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/database.js b/config/database.js index b7f57ad..f6ede13 100644 --- a/config/database.js +++ b/config/database.js @@ -31,7 +31,7 @@ module.exports = { sqlite: { client: 'sqlite3', connection: { - filename: Helpers.appRoot(`${Env.get('DATA_DIR', 'database')}/${Env.get('DB_DATABASE', 'development')}.sqlite`), + filename: `${Env.get('DATA_DIR', 'data')}/${Env.get('DB_DATABASE', 'database')}.sqlite`, }, useNullAsDefault: true, debug: Env.get('DB_DEBUG', false), -- cgit v1.2.3-54-g00ecf From 0437e56eb20791864a3ab45fafe029805bb05715 Mon Sep 17 00:00:00 2001 From: thursday Date: Fri, 9 Jul 2021 17:10:40 -0400 Subject: Update docker-compose.yml As per changes to database.js and the discussion here: https://github.com/getferdi/server/pull/48#discussion_r667150127 --- docker/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 64797c4..d558ed4 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -11,7 +11,7 @@ services: - DB_PORT=3306 - DB_USER=root - DB_PASSWORD=password - - DB_DATABASE=adonis + - DB_DATABASE=database - DB_SSL=false - MAIL_CONNECTION=smtp - SMPT_HOST=127.0.0.1 -- cgit v1.2.3-54-g00ecf From dd54d4c4a21c0076a3cba9c6b265e1f33b6e87cf Mon Sep 17 00:00:00 2001 From: thursday Date: Fri, 9 Jul 2021 17:24:41 -0400 Subject: Update .env.example --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 19af6e3..2c86c60 100644 --- a/.env.example +++ b/.env.example @@ -2,7 +2,7 @@ HOST=127.0.0.1 PORT=3333 NODE_ENV=development -APP_NAME=AdonisJs +APP_NAME=Ferdi-server APP_URL=http://${HOST}:${PORT} EXTERNAL_DOMAIN=ferdi.domain.tld -- cgit v1.2.3-54-g00ecf From a347c97e6b1efb344752951af5db81d84e91e58f Mon Sep 17 00:00:00 2001 From: thursday Date: Fri, 9 Jul 2021 17:32:19 -0400 Subject: Update database name and volume. Updated to reflect the changes made to database.js and alert existing users to breaking changes. --- docker/docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index d558ed4..905d79b 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -11,7 +11,7 @@ services: - DB_PORT=3306 - DB_USER=root - DB_PASSWORD=password - - DB_DATABASE=database + - DB_DATABASE=database # existing Ferdi-server users who use the built-in sqlite database should use the database name "development" - DB_SSL=false - MAIL_CONNECTION=smtp - SMPT_HOST=127.0.0.1 @@ -27,7 +27,7 @@ services: - DATA_DIR=data volumes: - ferdi-config-vol:/config - - ferdi-database-vol:/app/data + - ferdi-database-vol:/app/data # existing Ferdi-server users who use the built-in sqlite database should use the volume name "/app/database" - ferdi-recipes-vol:/app/recipes ports: - 3333:3333 -- cgit v1.2.3-54-g00ecf From 395a63c0f12cdde2eb285e45a4de5ea59b795f3c Mon Sep 17 00:00:00 2001 From: thursday Date: Fri, 9 Jul 2021 18:07:31 -0400 Subject: Update README.md Fixed spelling and grammar issues and updated with warning for existing users regarding config.txt being deprecated and the default sqlite database location and name being changed. --- docker/README.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/docker/README.md b/docker/README.md index 780dcb1..05140fd 100644 --- a/docker/README.md +++ b/docker/README.md @@ -4,7 +4,7 @@ This is a dockerized version of [Ferdi-server](https://github.com/getferdi/server) running on Alpine Linux and Node.js (v10.16.3). ## Why use a custom Ferdi-server? -A 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). +A 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 [add your own recipes](#creating-and-using-custom-recipes). ## Features - [x] User registration and login @@ -20,7 +20,7 @@ A custom ferdi-server allows you to experience the full potential of the Ferdi c Here are some example snippets to help you get started creating a container. -The 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. +The 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 a webserver such as NGINX. ### docker @@ -62,38 +62,38 @@ To create the docker container with the proper parameters: ### docker-compose - You can use sample [./docker/docker-compose.yml](https://github.com/getferdi/server/tree/master/docker/docker-compose.yml). - This will pull latest image from Docker Hub or use local image which you can build using instructions in [Building locally section](#Building-locally). + You can use the provided sample [./docker/docker-compose.yml](https://github.com/getferdi/server/tree/master/docker/docker-compose.yml) if you are happy with the default environmental variables. This will pull the latest image from Docker Hub or use a local copy of the image which you can build using the instructions provided in the [Building locally section](#building-locally). To start the application, use docker-compose up The server will be launched at [http://localhost:3333/](http://localhost:3333/) address. +**Existing users please note:** The latest updates to Ferdi-server and the Ferdi-server Docker image introduce changes to the default sqlite database name and location, please see the comments in the sample [./docker/docker-compose.yml](https://github.com/getferdi/server/tree/master/docker/docker-compose.yml) in order to continue using your existing database. + ## Configuration Container images are configured using parameters passed at runtime (such as those above). -**Warning, using `config.txt` will be deprecated in the future releases.** - -If 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.** +**Warning, the use of `config.txt` is now deprecated. Please make sure to pass the correct environmental variables to your container at runtime.** +If any environmental parameter is not passed to the container, its value will be taken from the `/config/config.txt` file. | Parameter | Function | | :----: | --- | -| `-p :3333` | will map the container's port 80 to a port on the host, default is 3333 | -| `-e NODE_ENV=development` | for specifying Node environment, production or development, default is development | -| `-e EXTERNAL_DOMAIN=` | for specifying external domain address of the ferdi server | -| `-e DB_CONNECTION=sqlite` | for specifying the database being used, default is sqlite | +| `-p :80` | Will map the container's port 80 to a port on the host, default is 3333 | +| `-e NODE_ENV=development` | for specifying Node environment, production or development, default is development **currently this should not be changed** | +| `-e EXTERNAL_DOMAIN=` | for specifying the external domain address of the Ferdi-server | +| `-e DB_CONNECTION=` | for specifying the database host, default is 127.0.0.1 | | `-e DB_PORT=` | for specifying the database port, default is 3306 | | `-e DB_USER=` | for specifying the database user, default is root | | `-e DB_PASSWORD=` | for specifying the database password, default is password | -| `-e DB_DATABASE=adonis` | for specifying the database to be used, adonis | -| `-e DB_SSL=false` | true only if your database is postgres and it is hosted online on platforms like GCP, AWS, etc | +| `-e DB_DATABASE=` | for specifying the database name to be used, default is database | +| `-e DB_SSL=false` | true only if your database is postgres and it is hosted online, on platforms like GCP, AWS, etc | | `-e MAIL_CONNECTION=` | for specifying the mail sender to be used, default is smtp | | `-e SMPT_HOST=` | for specifying the mail host to be used, default is 127.0.0.1 | | `-e SMTP_PORT=` | for specifying the mail port to be used, default is 2525 | -| `-e MAIL_SSL=true/false` | for specifying SMTP mail secuirty, default is false | +| `-e MAIL_SSL=true/false` | for specifying SMTP mail security, default is false | | `-e MAIL_USERNAME=` | for specifying your mail username to be used, default is username | | `-e MAIL_PASSWORD=` | for specifying your mail password to be used, default is password | | `-e MAIL_SENDER=:/config` | this will store persistent ENV data on the docker host | -| `-v :/app/database` | this will strore Ferdi-server's database on the docker host for persistence | -| `-v :/app/recipes` | this will strore Ferdi-server's recipes on the docker host for persistence | +| `-v :/app/data` | this will store Ferdi-server's database on the docker host for persistence | +| `-v :/app/recipes` | this will store Ferdi-server's recipes on the docker host for persistence | By enabling the `CONNECT_WITH_FRANZ` option, Ferdi-server can: - Show the full Franz recipe library instead of only custom recipes @@ -112,7 +112,7 @@ By enabling the `CONNECT_WITH_FRANZ` option, Ferdi-server can: ## Supported databases and drivers -To use a different database than the default, SQLite, enter the driver code below in your ENV configuration. +To use a different database than the default, SQLite3, enter the driver code below in your ENV configuration. | Database | Driver | | :----: | --- | @@ -189,7 +189,7 @@ Below are the instructions for updating the container to get the most recent ver * Update the image: `docker pull getferdi/ferdi-server` * Stop the running container: `docker stop ferdi-server` * Delete the container: `docker rm ferdi-server` -* 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) +* Recreate a new container with the same docker create parameters as instructed above (if mapped correctly to a host folder, your `/config` folder and ENV settings will be preserved) * Start the new container: `docker start ferdi-server` * You can also remove the old dangling images: `docker image prune` -- cgit v1.2.3-54-g00ecf From 0f5e4c0e554d8ab98ee8c87a4d6689df67bf94b6 Mon Sep 17 00:00:00 2001 From: thursday Date: Fri, 9 Jul 2021 18:14:55 -0400 Subject: Fixed line 83 to reflect the use of port 3333 I believe the Dockerfile now sets Ferdi-server's port to 3333, so I've updated the documentation to reflect this. --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 05140fd..6741fca 100644 --- a/docker/README.md +++ b/docker/README.md @@ -80,7 +80,7 @@ Container images are configured using parameters passed at runtime (such as thos | Parameter | Function | | :----: | --- | -| `-p :80` | Will map the container's port 80 to a port on the host, default is 3333 | +| `-p :3333` | Will map the container's port 3333 to a port on the host, default is 3333 | | `-e NODE_ENV=development` | for specifying Node environment, production or development, default is development **currently this should not be changed** | | `-e EXTERNAL_DOMAIN=` | for specifying the external domain address of the Ferdi-server | | `-e DB_CONNECTION= Date: Sat, 10 Jul 2021 05:21:05 -0400 Subject: Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 40834e2..5e6147f 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ To add your recipe to ferdi-server, open `http://[YOUR FERDI-SERVER]/new` in you - `Author`: Author who created the recipe - `Name`: Name for your new service. Can contain spaces and unicode characters - `Service ID`: Unique ID for this recipe. Does not contain spaces or special characters (e.g. `google-drive`) -- `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 +- `Link to SVG image`: Direct link to a 1024x1024 SvG image 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/ - `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. ### Listing custom recipes -- cgit v1.2.3-54-g00ecf From 14b9ff2a4d8e6d0f9cbd87e82ca14eacd11f87a3 Mon Sep 17 00:00:00 2001 From: thursday Date: Sat, 10 Jul 2021 05:23:31 -0400 Subject: Update RecipeController.js --- app/Controllers/Http/RecipeController.js | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Controllers/Http/RecipeController.js b/app/Controllers/Http/RecipeController.js index 9bfd92e..087627b 100644 --- a/app/Controllers/Http/RecipeController.js +++ b/app/Controllers/Http/RecipeController.js @@ -61,7 +61,6 @@ class RecipeController { name: 'required|string', id: 'required|unique:recipes,recipeId', author: 'required|accepted', - png: 'required|url', svg: 'required|url', }); if (validation.fails()) { -- cgit v1.2.3-54-g00ecf From b4554c8010c8de9a92c9dc6f6ffae73eaf07bb31 Mon Sep 17 00:00:00 2001 From: thursday Date: Sat, 10 Jul 2021 05:24:05 -0400 Subject: Update RecipeController.js --- app/Controllers/Http/RecipeController.js | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Controllers/Http/RecipeController.js b/app/Controllers/Http/RecipeController.js index 087627b..9d58708 100644 --- a/app/Controllers/Http/RecipeController.js +++ b/app/Controllers/Http/RecipeController.js @@ -107,7 +107,6 @@ class RecipeController { featured: false, version: '1.0.0', icons: { - png: data.png, svg: data.svg, }, }), -- cgit v1.2.3-54-g00ecf From 6439937c5a12d59ae8c631fe5c2de4d3c081cdc6 Mon Sep 17 00:00:00 2001 From: thursday Date: Sat, 10 Jul 2021 05:25:35 -0400 Subject: Update new.edge --- resources/views/others/new.edge | 3 --- 1 file changed, 3 deletions(-) diff --git a/resources/views/others/new.edge b/resources/views/others/new.edge index 1b54558..96bd0ee 100644 --- a/resources/views/others/new.edge +++ b/resources/views/others/new.edge @@ -14,9 +14,6 @@

-
-
-

*These images must be publicly availible and have CORS enabled in order to work.

-- cgit v1.2.3-54-g00ecf From 2ad00034dbcb6f3f3171c06ce384f466a1c3ac27 Mon Sep 17 00:00:00 2001 From: thursday Date: Mon, 12 Jul 2021 18:55:40 -0400 Subject: Changed default dbname to ferdi in .env.example --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 2c86c60..69d4d3c 100644 --- a/.env.example +++ b/.env.example @@ -17,7 +17,7 @@ DB_HOST=127.0.0.1 DB_PORT=3306 DB_USER=root DB_PASSWORD= -DB_DATABASE=database +DB_DATABASE=ferdi DB_SSL=false -- cgit v1.2.3-54-g00ecf From 68b5c7a287afde31880436b8ea496fa70202fa6d Mon Sep 17 00:00:00 2001 From: thursday Date: Mon, 12 Jul 2021 19:00:00 -0400 Subject: Update database.js Updated the path.join function for the default sqlite database and updated all default database names to `ferdi` rather than `adonis` --- config/database.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/database.js b/config/database.js index f6ede13..e5e3ec8 100644 --- a/config/database.js +++ b/config/database.js @@ -31,7 +31,7 @@ module.exports = { sqlite: { client: 'sqlite3', connection: { - filename: `${Env.get('DATA_DIR', 'data')}/${Env.get('DB_DATABASE', 'database')}.sqlite`, + filename: path.join(Env.get('DATA_DIR', 'data'), `${Env.get('DB_DATABASE', 'ferdi')}.sqlite`), }, useNullAsDefault: true, debug: Env.get('DB_DEBUG', false), @@ -54,7 +54,7 @@ module.exports = { port: Env.get('DB_PORT', ''), user: Env.get('DB_USER', 'root'), password: Env.get('DB_PASSWORD', ''), - database: Env.get('DB_DATABASE', 'adonis'), + database: Env.get('DB_DATABASE', 'ferdi'), }, debug: Env.get('DB_DEBUG', false), }, @@ -76,7 +76,7 @@ module.exports = { port: Env.get('DB_PORT', ''), user: Env.get('DB_USER', 'root'), password: Env.get('DB_PASSWORD', ''), - database: Env.get('DB_DATABASE', 'adonis'), + database: Env.get('DB_DATABASE', 'ferdi'), ssl: JSON.parse(Env.get('DB_SSL', 'true')), }, debug: Env.get('DB_DEBUG', false), -- cgit v1.2.3-54-g00ecf From b185c426ddf1fdecfffac436bd411e3c45b61916 Mon Sep 17 00:00:00 2001 From: thursday Date: Mon, 12 Jul 2021 19:52:48 -0400 Subject: Update README.md Added a warning about the deprecation of config.txt in the docker image, made Ferdi-server capitalization consistent, and fixed grammar throughout. --- README.md | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 38ab5bc..f3e8845 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@

-# ferdi-server +# Ferdi-server Official Server software for the [Ferdi Messaging Browser](https://getferdi.com) -- [ferdi-server](#ferdi-server) +- [Ferdi-server](#ferdi-server) - [Why use a custom Ferdi server?](#why-use-a-custom-ferdi-server) - [Features](#features) - [Setup](#setup) @@ -16,7 +16,7 @@ Official Server software for the [Ferdi Messaging Browser](https://getferdi.com) - [Transferring user data](#transferring-user-data) - [Creating and using custom recipes](#creating-and-using-custom-recipes) - [Listing custom recipes](#listing-custom-recipes) - - [Contributing to ferdi-server's development](#contributing-to-ferdi-servers-development) + - [Contributing to Ferdi-server's development](#contributing-to-ferdi-servers-development) - [License](#license) ## Why use a custom Ferdi server? @@ -30,7 +30,7 @@ If you are not interested in doing this you can use our official instance of Fer - [x] Workspace support - [x] Functioning service store - [x] User dashboard -- [x] Export/import data to other ferdi-servers +- [x] Export/import data to other Ferdi-servers - [ ] Password recovery - [ ] Recipe update @@ -39,7 +39,9 @@ If you are not interested in doing this you can use our official instance of Fer The easiest way to set up Ferdi server on your server is with Docker. The Docker image can be run as is, with the default sqlite database or you can modifying your ENV variables to use an external database (e.g. MySQL, MariaDB, Postgres, etc). -After setting up the docker container we recommend you to set up an NGINX reverse proxy to access ferdi-server outside of your home network and protect it with an SSL certificate. +After setting up the docker container we recommend you set up an NGINX reverse proxy to access Ferdi-server outside of your home network and protect it with an SSL certificate. + +**Warning**, please note that the use of the previous `config.txt` is now deprecated. Make sure to pass the correct environmental variables to your container at runtime. If you are an existing Ferdi-server user please see [the Ferdi docker documentation](./docker/README.md) for more information. 1. Pull the Docker image @@ -126,26 +128,26 @@ Please refer to Date: Mon, 12 Jul 2021 19:57:40 -0400 Subject: Update README.md Fixed Ferdi-server syntax throughout the readme (specifically capitalization and the - between Ferdi and server). --- docker/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docker/README.md b/docker/README.md index 6741fca..bb996ae 100644 --- a/docker/README.md +++ b/docker/README.md @@ -4,7 +4,7 @@ This is a dockerized version of [Ferdi-server](https://github.com/getferdi/server) running on Alpine Linux and Node.js (v10.16.3). ## Why use a custom Ferdi-server? -A 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 [add your own recipes](#creating-and-using-custom-recipes). +A 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 [add your own recipes](#creating-and-using-custom-recipes). ## Features - [x] User registration and login @@ -13,7 +13,7 @@ A custom ferdi-server allows you to experience the full potential of the Ferdi C - [x] Functioning service store - [x] User dashboard - [x] Password recovery -- [x] Export/import data to other ferdi-servers +- [x] Export/import data to other Ferdi-servers - [ ] Recipe update ## Installation & Setup @@ -171,7 +171,7 @@ To add your recipe to Ferdi-server, open `http://[YOUR FERDI-SERVER]/new` in you - `Name`: Name for your new service. Can contain spaces and unicode characters - `Service ID`: Unique ID for this recipe. Does not contain spaces or special characters (e.g. `google-drive`) - `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 -- `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. +- `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. ### Listing custom recipes Inside Ferdi, searching for `ferdi:custom` will list all your custom recipes. @@ -202,7 +202,7 @@ Below are the instructions for updating the container to get the most recent ver ## Building locally -If you want to build this image locally, please run this command from root of [ferdi server repository](https://github.com/getferdi/server/tree/master/): +If you want to build this image locally, please run this command from root of [Ferdi-server repository](https://github.com/getferdi/server/tree/master/): ``` docker build \ --no-cache \ @@ -211,4 +211,4 @@ docker build \ ``` ## License -Ferdi-server-docker and ferdi-server are licensed under the MIT License. +Ferdi-server-docker and Ferdi-server are licensed under the MIT License. -- cgit v1.2.3-54-g00ecf From f694067f412903d83438548a346d08e28a68dd15 Mon Sep 17 00:00:00 2001 From: thursday Date: Mon, 12 Jul 2021 20:17:26 -0400 Subject: Update README.md Added links to Docker documentation to explain port mapping, the user runtime variables and container volumes. --- docker/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/README.md b/docker/README.md index bb996ae..d32f488 100644 --- a/docker/README.md +++ b/docker/README.md @@ -73,15 +73,15 @@ The server will be launched at [http://localhost:3333/](http://localhost:3333/) ## Configuration -Container images are configured using parameters passed at runtime (such as those above). +Container images are configured using parameters passed at runtime (such as those above). An explanaition of the default parameters is included below, but please see [the Docker documentation](https://docs.docker.com/get-started/overview/) for additional information. **Warning, the use of `config.txt` is now deprecated. Please make sure to pass the correct environmental variables to your container at runtime.** If any environmental parameter is not passed to the container, its value will be taken from the `/config/config.txt` file. | Parameter | Function | | :----: | --- | -| `-p :3333` | Will map the container's port 3333 to a port on the host, default is 3333 | -| `-e NODE_ENV=development` | for specifying Node environment, production or development, default is development **currently this should not be changed** | +| `-p :3333` | Will map the container's port 3333 to a port on the host, default is 3333. See the [Docker docs](https://docs.docker.com/config/containers/container-networking/) for more information on port mapping | +| `-e NODE_ENV=development` | for specifying Node environment, production or development, default is development **currently this should not be changed**. See the [Docker docs](https://docs.docker.com/) for more information on the use of environmental variables in [Command-line](https://docs.docker.com/engine/reference/commandline/run/#mount-volume--v---read-only) and [Docker Compose](https://docs.docker.com/compose/environment-variables/) | | `-e EXTERNAL_DOMAIN=` | for specifying the external domain address of the Ferdi-server | | `-e DB_CONNECTION=` | for specifying the database host, default is 127.0.0.1 | @@ -102,7 +102,7 @@ Container images are configured using parameters passed at runtime (such as thos | `-e IS_REGISTRATION_ENABLED=true` | for specifying whether to allow user registration, default is true | | `-e CONNECT_WITH_FRANZ=true` | for specifying whether to enable connections to the Franz server, default is true | | `-e DATA_DIR=data` | for specifying the SQLite database folder, default is database | -| `-v :/config` | this will store persistent ENV data on the docker host | +| `-v :/config` | this will store persistent configuration data on the docker host. See the [Docker docs](https://docs.docker.com/storage/volumes/) for more information on the use of container volumes | | `-v :/app/data` | this will store Ferdi-server's database on the docker host for persistence | | `-v :/app/recipes` | this will store Ferdi-server's recipes on the docker host for persistence | -- cgit v1.2.3-54-g00ecf From 8bbfb28e7aff6d8ba758242423293f492e223260 Mon Sep 17 00:00:00 2001 From: thursday Date: Mon, 12 Jul 2021 22:12:27 -0400 Subject: Update README.md Updated default database names throughout readme. --- docker/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/README.md b/docker/README.md index d32f488..144a766 100644 --- a/docker/README.md +++ b/docker/README.md @@ -69,7 +69,7 @@ To create the docker container with the proper parameters: docker-compose up The server will be launched at [http://localhost:3333/](http://localhost:3333/) address. -**Existing users please note:** The latest updates to Ferdi-server and the Ferdi-server Docker image introduce changes to the default sqlite database name and location, please see the comments in the sample [./docker/docker-compose.yml](https://github.com/getferdi/server/tree/master/docker/docker-compose.yml) in order to continue using your existing database. +**Existing users please note:** The latest updates to Ferdi-server and the Ferdi-server Docker image introduce changes to the default SQLite database name and location, please see the comments in the sample [./docker/docker-compose.yml](https://github.com/getferdi/server/tree/master/docker/docker-compose.yml) in order to continue using your existing database. ## Configuration @@ -88,7 +88,7 @@ Container images are configured using parameters passed at runtime (such as thos | `-e DB_PORT=` | for specifying the database port, default is 3306 | | `-e DB_USER=` | for specifying the database user, default is root | | `-e DB_PASSWORD=` | for specifying the database password, default is password | -| `-e DB_DATABASE=` | for specifying the database name to be used, default is database | +| `-e DB_DATABASE=` | for specifying the database name to be used, default is ferdi | | `-e DB_SSL=false` | true only if your database is postgres and it is hosted online, on platforms like GCP, AWS, etc | | `-e MAIL_CONNECTION=` | for specifying the mail sender to be used, default is smtp | | `-e SMPT_HOST=` | for specifying the mail host to be used, default is 127.0.0.1 | @@ -101,7 +101,7 @@ Container images are configured using parameters passed at runtime (such as thos | `-e IS_DASHBOARD_ENABLED=true` | for specifying whether to enable the Ferdi-server dashboard, default is true | | `-e IS_REGISTRATION_ENABLED=true` | for specifying whether to allow user registration, default is true | | `-e CONNECT_WITH_FRANZ=true` | for specifying whether to enable connections to the Franz server, default is true | -| `-e DATA_DIR=data` | for specifying the SQLite database folder, default is database | +| `-e DATA_DIR=data` | for specifying the SQLite database folder, default is data | | `-v :/config` | this will store persistent configuration data on the docker host. See the [Docker docs](https://docs.docker.com/storage/volumes/) for more information on the use of container volumes | | `-v :/app/data` | this will store Ferdi-server's database on the docker host for persistence | | `-v :/app/recipes` | this will store Ferdi-server's recipes on the docker host for persistence | -- cgit v1.2.3-54-g00ecf From daf86f9439d124a9583093aad031df146a03f49d Mon Sep 17 00:00:00 2001 From: thursday Date: Mon, 12 Jul 2021 22:17:19 -0400 Subject: Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f3e8845..7865704 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ If you are not interested in doing this you can use our official instance of Fer ### with Docker The easiest way to set up Ferdi server on your server is with Docker. -The Docker image can be run as is, with the default sqlite database or you can modifying your ENV variables to use an external database (e.g. MySQL, MariaDB, Postgres, etc). +The Docker image can be run as is, with the default SQLite database or you can modifying your ENV variables to use an external database (e.g. MySQL, MariaDB, Postgres, etc). After setting up the docker container we recommend you set up an NGINX reverse proxy to access Ferdi-server outside of your home network and protect it with an SSL certificate. **Warning**, please note that the use of the previous `config.txt` is now deprecated. Make sure to pass the correct environmental variables to your container at runtime. If you are an existing Ferdi-server user please see [the Ferdi docker documentation](./docker/README.md) for more information. -- cgit v1.2.3-54-g00ecf From 0608dc7051bb0bdf22efc8af1c06a83c38b63c80 Mon Sep 17 00:00:00 2001 From: thursday Date: Mon, 12 Jul 2021 22:19:12 -0400 Subject: Update docker-compose.yml Update default database name. --- docker/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 905d79b..58c5bf5 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -11,7 +11,7 @@ services: - DB_PORT=3306 - DB_USER=root - DB_PASSWORD=password - - DB_DATABASE=database # existing Ferdi-server users who use the built-in sqlite database should use the database name "development" + - DB_DATABASE=ferdi # existing Ferdi-server users who use the built-in sqlite database should use the database name "development" - DB_SSL=false - MAIL_CONNECTION=smtp - SMPT_HOST=127.0.0.1 -- cgit v1.2.3-54-g00ecf From e359a655f0a0d1e2b62fd98a1aba8ede8dac9399 Mon Sep 17 00:00:00 2001 From: thursday Date: Mon, 12 Jul 2021 22:25:19 -0400 Subject: Update README.md Updated migration text and deprecation warning. --- docker/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/README.md b/docker/README.md index 144a766..dc49e68 100644 --- a/docker/README.md +++ b/docker/README.md @@ -69,7 +69,7 @@ To create the docker container with the proper parameters: docker-compose up The server will be launched at [http://localhost:3333/](http://localhost:3333/) address. -**Existing users please note:** The latest updates to Ferdi-server and the Ferdi-server Docker image introduce changes to the default SQLite database name and location, please see the comments in the sample [./docker/docker-compose.yml](https://github.com/getferdi/server/tree/master/docker/docker-compose.yml) in order to continue using your existing database. +**Existing users please note:** The latest updates to Ferdi-server and the Ferdi-server Docker image introduce changes to the default SQLite database name and location, as well as the internal containeer port. Please see the comments in the sample [./docker/docker-compose.yml](https://github.com/getferdi/server/tree/master/docker/docker-compose.yml) in order to continue using your existing database. ## Configuration @@ -80,7 +80,7 @@ Container images are configured using parameters passed at runtime (such as thos | Parameter | Function | | :----: | --- | -| `-p :3333` | Will map the container's port 3333 to a port on the host, default is 3333. See the [Docker docs](https://docs.docker.com/config/containers/container-networking/) for more information on port mapping | +| `-p :3333` | Will map the container's port 3333 to a port on the host, default is 3333. See the [Docker docs](https://docs.docker.com/config/containers/container-networking/) for more information about port mapping | | `-e NODE_ENV=development` | for specifying Node environment, production or development, default is development **currently this should not be changed**. See the [Docker docs](https://docs.docker.com/) for more information on the use of environmental variables in [Command-line](https://docs.docker.com/engine/reference/commandline/run/#mount-volume--v---read-only) and [Docker Compose](https://docs.docker.com/compose/environment-variables/) | | `-e EXTERNAL_DOMAIN=` | for specifying the external domain address of the Ferdi-server | | `-e DB_CONNECTION= Date: Mon, 12 Jul 2021 22:34:02 -0400 Subject: Update docker-compose.yml Added additional migration note for existing users. --- docker/docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 58c5bf5..cf7269a 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -24,13 +24,13 @@ services: - IS_DASHBOARD_ENABLED=true - IS_REGISTRATION_ENABLED=true - CONNECT_WITH_FRANZ=false - - DATA_DIR=data + - DATA_DIR=data # existing Ferdi-server users should ensure that they add this variable to ensure data persistence. volumes: - ferdi-config-vol:/config - ferdi-database-vol:/app/data # existing Ferdi-server users who use the built-in sqlite database should use the volume name "/app/database" - ferdi-recipes-vol:/app/recipes ports: - - 3333:3333 + - 3333:3333 # existing Ferdi-server users will neeed to update their portt mappings from 80:3333 to 3333:3333. restart: unless-stopped volumes: ferdi-config-vol: -- cgit v1.2.3-54-g00ecf From 9c21478009e5dbda8084c3fb6da9603ca157de9a Mon Sep 17 00:00:00 2001 From: thursday Date: Mon, 12 Jul 2021 22:41:45 -0400 Subject: Update README.md Further clarified migration pathway for existing users. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7865704..5d93847 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ The easiest way to set up Ferdi server on your server is with Docker. The Docker image can be run as is, with the default SQLite database or you can modifying your ENV variables to use an external database (e.g. MySQL, MariaDB, Postgres, etc). After setting up the docker container we recommend you set up an NGINX reverse proxy to access Ferdi-server outside of your home network and protect it with an SSL certificate. -**Warning**, please note that the use of the previous `config.txt` is now deprecated. Make sure to pass the correct environmental variables to your container at runtime. If you are an existing Ferdi-server user please see [the Ferdi docker documentation](./docker/README.md) for more information. +**Warning**, please note that the use of the previous `config.txt` is now deprecated and a number of environmental variables have changed, specifically the default database name and local, the internal contianer port, and an additional `DATA_DIR` variable has been added. Make sure to pass the correct environmental variables to your container at runtime. If you are an existing Ferdi-server user please see [the Ferdi docker documentation](./docker/README.md) and the example [docker-compose.yml](./docker/docker-compose.yml) for more information. 1. Pull the Docker image @@ -73,7 +73,7 @@ After setting up the docker container we recommend you set up an NGINX reverse p -e IS_DASHBOARD_ENABLED=true \ -e IS_REGISTRATION_ENABLED=true \ -e CONNECT_WITH_FRANZ=true \ - -p :80 \ + -p :3333 \ -v :/config \ -v :/app/database \ -v :/app/recipes \ -- cgit v1.2.3-54-g00ecf From 744a4b341181604dbf1eeffc7c46575d72d2b70e Mon Sep 17 00:00:00 2001 From: thursday Date: Mon, 12 Jul 2021 22:49:27 -0400 Subject: Update README.md Further clarification for existing users. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5d93847..277ce07 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ After setting up the docker container we recommend you set up an NGINX reverse p ```sh docker pull getferdi/ferdi-server ``` -2. Create a new Docker container with your desired configuration +2. Create a *new* Docker container with your desired configuration **Existing users please seee the warning above.** ```sh docker create \ @@ -73,6 +73,7 @@ After setting up the docker container we recommend you set up an NGINX reverse p -e IS_DASHBOARD_ENABLED=true \ -e IS_REGISTRATION_ENABLED=true \ -e CONNECT_WITH_FRANZ=true \ + -e DATA_DIR=data \ -p :3333 \ -v :/config \ -v :/app/database \ -- cgit v1.2.3-54-g00ecf From 90a3e2d92c242a7a318d26ee33b4ca056e8152fb Mon Sep 17 00:00:00 2001 From: thursday Date: Mon, 12 Jul 2021 22:52:48 -0400 Subject: Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 277ce07..a73b717 100644 --- a/README.md +++ b/README.md @@ -109,11 +109,11 @@ For more information on configuring the Docker image, please read [the ferdi doc ## Configuration -franz-server's configuration is saved inside the `.env` file. Besides AdonisJS's settings, ferdi-server has the following custom settings: +franz-server's configuration is saved inside an `.env` file. Besides AdonisJS's settings, Ferdi-server has the following custom settings: - `IS_CREATION_ENABLED` (`true` or `false`, default: `true`): Whether to enable the [creation of custom recipes](#creating-and-using-custom-recipes) - `IS_REGISTRATION_ENABLED` (`true` or `false`, default: `true`): Whether to enable the creation of new user accounts - `IS_DASHBOARD_ENABLED` (`true` or `false`, default: `true`): Whether to enable the user dashboard -- `CONNECT_WITH_FRANZ` (`true` or `false`, default: `true`): Whether to enable connections to the Franz server. By enabling this option, ferdi-server can: +- `CONNECT_WITH_FRANZ` (`true` or `false`, default: `true`): Whether to enable connections to the Franz server. By enabling this option, Ferdi-server can: - Show the full Franz recipe library instead of only custom recipes - Import Franz accounts -- cgit v1.2.3-54-g00ecf From 70cc5a8f805db97dc9c3aa7d761581f85dc0308d Mon Sep 17 00:00:00 2001 From: thursday Date: Mon, 12 Jul 2021 22:56:10 -0400 Subject: Update .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index a8bc908..2f0f98f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,8 @@ tmp recipes/ .DS_Store +public/terms.html +public/privacy.html resources/announcements/*.json !resources/announcements/version.json -- cgit v1.2.3-54-g00ecf From 9b28db7b4de7df0c51a25fc22ef5fa5368cda966 Mon Sep 17 00:00:00 2001 From: thursday Date: Mon, 12 Jul 2021 22:57:42 -0400 Subject: Delete .gitignore combining the docker .gitignore with the main server repo .gitignore. --- docker/.gitignore | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 docker/.gitignore diff --git a/docker/.gitignore b/docker/.gitignore deleted file mode 100644 index 552cd4a..0000000 --- a/docker/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -# Node modules -node_modules - -# Adonis directory for storing tmp files -tmp - -# Uploaded recipes -recipes/ - -.DS_Store -public/terms.html -public/privacy.html -- cgit v1.2.3-54-g00ecf From 18efa364137f8b8e486436963abe233441155345 Mon Sep 17 00:00:00 2001 From: thursday Date: Mon, 12 Jul 2021 23:00:50 -0400 Subject: Update .nvmrc Upgraded nodejs to '14.17.3' to match head --- .nvmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.nvmrc b/.nvmrc index 6b17d22..c6244cd 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -14.16.1 +14.17.3 -- cgit v1.2.3-54-g00ecf From 93332c7e98c69d51d4ce69add4ea5a428d4bcc03 Mon Sep 17 00:00:00 2001 From: thursday Date: Mon, 12 Jul 2021 23:02:20 -0400 Subject: Update CONTRIBUTING.md Upgraded nodejs to '14.17.3' to match main server HEAD --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d276763..440cc19 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,7 +47,7 @@ Currently, these are the combinations of system dependencies that work on an int ```bash node -v -v14.16.1 +v14.17.3 npm -v 6.14.12 node-gyp -v -- cgit v1.2.3-54-g00ecf From 37d0a70febe70c1db3964f2f11ff57e3c5b7cb70 Mon Sep 17 00:00:00 2001 From: thursday Date: Mon, 12 Jul 2021 23:03:34 -0400 Subject: Update package.json Upgraded nodejs to '14.17.3' to match HEAD --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6fc32a1..6673fb9 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "description": "Ferdi server to replace the default Franz server.", "main": "index.js", "engines": { - "node": "^14.16", + "node": "^14.17", "npm": "^6.14", "node-gyp": "^8.0" }, -- cgit v1.2.3-54-g00ecf From 68dc07abeab6313ef4f48a6694ef7a3655739839 Mon Sep 17 00:00:00 2001 From: thursday Date: Mon, 12 Jul 2021 23:41:15 -0400 Subject: Update README.md --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index dc49e68..eed4a12 100644 --- a/docker/README.md +++ b/docker/README.md @@ -62,7 +62,7 @@ To create the docker container with the proper parameters: ### docker-compose - You can use the provided sample [./docker/docker-compose.yml](https://github.com/getferdi/server/tree/master/docker/docker-compose.yml) if you are happy with the default environmental variables. This will pull the latest image from Docker Hub or use a local copy of the image which you can build using the instructions provided in the [Building locally section](#building-locally). + You can use the provided sample [docker-compose.yml](https://github.com/getferdi/server/tree/master/docker/docker-compose.yml) if you are happy with the default environmental variables. This will pull the latest image from Docker Hub or use a local copy of the image which you can build using the instructions provided in the [Building locally section](#building-locally). To start the application, use -- cgit v1.2.3-54-g00ecf From 19935d6cc4e1ea704af7aad1190dddcb060e8dd2 Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 04:01:57 -0400 Subject: Update Dockerfile adding an empty .env file to attempt to resolve --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f8fde91..42a1c02 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ COPY . /server-build RUN ["npm", "ci", "--production", "--build-from-source", "--sqlite=/usr/local"] FROM node:lts-alpine - # TODO implement process to run ferdi-server as non-root user. See comments on https://github.com/getferdi/server/pull/48/ +# TODO: implement process to run ferdi-server as non-root user. See comments on https://github.com/getferdi/server/pull/48/ WORKDIR /app LABEL maintainer="xthursdayx" @@ -23,4 +23,5 @@ RUN ["npm", "i", "-g", "@adonisjs/cli"] HEALTHCHECK --interval=5m --timeout=3s CMD curl -sSf http://localhost:${PORT}/health COPY docker/entrypoint.sh /entrypoint.sh +COPY docker/.env /app/.env CMD ["/entrypoint.sh"] -- cgit v1.2.3-54-g00ecf From a1324ca3d57b0968e0d058476eb43a4191d44d3d Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 04:03:04 -0400 Subject: Create .env Creating an empty .env file in an attempt to resolve the runtime issue discussed in PR 48 --- docker/.env | 1 + 1 file changed, 1 insertion(+) create mode 100644 docker/.env diff --git a/docker/.env b/docker/.env new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/docker/.env @@ -0,0 +1 @@ + -- cgit v1.2.3-54-g00ecf From 57da346c8f3241cc6af35685d794c0dced4cf2da Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 04:09:10 -0400 Subject: Update .gitignore temporarily removing .env ignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2f0f98f..f561b27 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ node_modules tmp # Environment variables, never commit this file -.env +# .env # The development sqlite file *.sqlite -- cgit v1.2.3-54-g00ecf From d7eea009ef5137fa566b13bf62ee5a84ad3621ec Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 04:13:00 -0400 Subject: Update .dockerignore Still trying to fix the .env problem --- .dockerignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.dockerignore b/.dockerignore index 93c1caf..110334e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -13,6 +13,7 @@ # ignore other directories docker !docker/entrypoint.sh +!docker/.env node_modules -- cgit v1.2.3-54-g00ecf From 6feb0cde33dcf378ae40aa90910691b77015d27b Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 04:38:34 -0400 Subject: Update entrypoint.sh Removing remaining references to cofig.txt --- docker/entrypoint.sh | 9 --------- 1 file changed, 9 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 8d00250..e38a8b3 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -14,13 +14,6 @@ Support our Open Collective at: https://opencollective.com/getferdi/ EOL -# Use of config.txt in this image is deprecated. Users should include the environmental variables listed in the README.md when the running the container or use docker compose with an .env file based on the included .env.example. -#if [ -f /config/config.txt ]; then -# cp /config/config.txt /app/.env -#else -# cp /app/.env.example /app/.env -#fi - # Create APP key if needed if [ ! -f "/config/FERDI_APP_KEY.txt" ]; then @@ -30,13 +23,11 @@ if [ ! -f "/config/FERDI_APP_KEY.txt" ]; APP_KEY=$(grep APP_KEY .env | cut -d '=' -f2) echo $APP_KEY > /config/FERDI_APP_KEY.txt echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" - sed -i "s/APP_KEY=/APP_KEY=$APP_KEY/g" /config/config.txt elif [ -f "/config/FERDI_APP_KEY.txt" ]; then echo " " echo "**** App Key found ****" APP_KEY=$(cat /config/FERDI_APP_KEY.txt) - sed -i "s/APP_KEY=.*/APP_KEY=$APP_KEY/g" /config/config.txt echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" fi -- cgit v1.2.3-54-g00ecf From c3f758d413c1f25f17992423a3954b6ba71a2a3d Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 07:14:03 -0400 Subject: Update entrypoint.sh Updating APP_KEY location --- docker/entrypoint.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index e38a8b3..30ac95e 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -15,19 +15,16 @@ https://opencollective.com/getferdi/ EOL # Create APP key if needed -if [ ! -f "/config/FERDI_APP_KEY.txt" ]; - then +if [[ -f "/app/adata/FERDI_APP_KEY.txt" ]]; then echo " " + echo "**** App Key found ****" + APP_KEY=$(echo "${APP_KEY}") + echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" +elif [[ -z "${APP_KEY}" ]]; then echo "**** Generating Ferdi-server app key for first run ****" adonis key:generate APP_KEY=$(grep APP_KEY .env | cut -d '=' -f2) - echo $APP_KEY > /config/FERDI_APP_KEY.txt - echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" -elif [ -f "/config/FERDI_APP_KEY.txt" ]; - then - echo " " - echo "**** App Key found ****" - APP_KEY=$(cat /config/FERDI_APP_KEY.txt) + echo $APP_KEY > /app/data/FERDI_APP_KEY.txt echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" fi -- cgit v1.2.3-54-g00ecf From e64389b43067b079382020429961cbd12fc77678 Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 07:19:58 -0400 Subject: Update database.js Add path for path.join variables. --- config/database.js | 1 + 1 file changed, 1 insertion(+) diff --git a/config/database.js b/config/database.js index e5e3ec8..9372eda 100644 --- a/config/database.js +++ b/config/database.js @@ -1,3 +1,4 @@ +const path = require("path"); /** @type {import('@adonisjs/framework/src/Env')} */ const Env = use('Env'); -- cgit v1.2.3-54-g00ecf From d06b8b5fa0a7e1f9bd89273919db16a6af9e7c11 Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 07:20:54 -0400 Subject: Update database.js changing docker data_dir to /data --- config/database.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/database.js b/config/database.js index 9372eda..1812295 100644 --- a/config/database.js +++ b/config/database.js @@ -32,7 +32,7 @@ module.exports = { sqlite: { client: 'sqlite3', connection: { - filename: path.join(Env.get('DATA_DIR', 'data'), `${Env.get('DB_DATABASE', 'ferdi')}.sqlite`), + filename: path.join(Env.get('DATA_DIR', '/data'), `${Env.get('DB_DATABASE', 'ferdi')}.sqlite`), }, useNullAsDefault: true, debug: Env.get('DB_DEBUG', false), -- cgit v1.2.3-54-g00ecf From e94853d276391497c1c2ebf19e897ff04459ae7c Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 07:23:42 -0400 Subject: Update .env.example changed data_dir to /data --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 69d4d3c..6b81d1b 100644 --- a/.env.example +++ b/.env.example @@ -10,7 +10,7 @@ CACHE_VIEWS=false APP_KEY= -DATA_DIR=data +DATA_DIR=/data DB_CONNECTION=sqlite DB_HOST=127.0.0.1 -- cgit v1.2.3-54-g00ecf From 6718dc23d4f54eb464336c6efe2d12435e067ebc Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 07:24:54 -0400 Subject: Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 42a1c02..323baf4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,5 +23,5 @@ RUN ["npm", "i", "-g", "@adonisjs/cli"] HEALTHCHECK --interval=5m --timeout=3s CMD curl -sSf http://localhost:${PORT}/health COPY docker/entrypoint.sh /entrypoint.sh -COPY docker/.env /app/.env +COPY docker/.env /data/.env CMD ["/entrypoint.sh"] -- cgit v1.2.3-54-g00ecf From 5d4caf5944fc88da16ae528392371ecf6ae289ed Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 07:47:14 -0400 Subject: Update docker/README.md Co-authored-by: Cromefire_ --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index eed4a12..d005a78 100644 --- a/docker/README.md +++ b/docker/README.md @@ -52,7 +52,7 @@ To create the docker container with the proper parameters: -e IS_DASHBOARD_ENABLED=true \ -e IS_REGISTRATION_ENABLED=true \ -e CONNECT_WITH_FRANZ=true \ - -e DATA_DIR=data \ + -e DATA_DIR=/data \ -p :80 \ -v :/config \ -v :/app/database \ -- cgit v1.2.3-54-g00ecf From a81bc9a01f6233809ae91bd38f804403120a4225 Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 07:48:09 -0400 Subject: Update Dockerfile Add docker-specific DATA_DIR Co-authored-by: Cromefire_ --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 323baf4..d7ed503 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ FROM node:lts-alpine WORKDIR /app LABEL maintainer="xthursdayx" -ENV HOST=0.0.0.0 PORT=3333 +ENV HOST=0.0.0.0 PORT=3333 DATA_DIR="/data" RUN ["apk", "add", "--no-cache", "sqlite-libs", "curl"] -- cgit v1.2.3-54-g00ecf From d91c144840d28efc62ee6e089cc9f50eb752fff4 Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 08:03:11 -0400 Subject: Update docker/README.md Co-authored-by: Cromefire_ --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index d005a78..94bcb24 100644 --- a/docker/README.md +++ b/docker/README.md @@ -53,7 +53,7 @@ To create the docker container with the proper parameters: -e IS_REGISTRATION_ENABLED=true \ -e CONNECT_WITH_FRANZ=true \ -e DATA_DIR=/data \ - -p :80 \ + -p :3333 \ -v :/config \ -v :/app/database \ -v :/app/recipes \ -- cgit v1.2.3-54-g00ecf From 0d6fdf994466f54ce9971b977c206dd188781293 Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 08:03:37 -0400 Subject: Update docker/entrypoint.sh Co-authored-by: Cromefire_ --- docker/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 30ac95e..4f089d0 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -24,7 +24,7 @@ elif [[ -z "${APP_KEY}" ]]; then echo "**** Generating Ferdi-server app key for first run ****" adonis key:generate APP_KEY=$(grep APP_KEY .env | cut -d '=' -f2) - echo $APP_KEY > /app/data/FERDI_APP_KEY.txt + echo "${APP_KEY}" > "${DATA_DIR}/FERDI_APP_KEY.txt" echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" fi -- cgit v1.2.3-54-g00ecf From 07eef781baaf093dac6ecf2bc4e4f8bbb7f08db6 Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 08:03:56 -0400 Subject: Update docker/entrypoint.sh Co-authored-by: Cromefire_ --- docker/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 4f089d0..a897339 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -15,7 +15,7 @@ https://opencollective.com/getferdi/ EOL # Create APP key if needed -if [[ -f "/app/adata/FERDI_APP_KEY.txt" ]]; then +if [[ -f "${DATA_DIR}/FERDI_APP_KEY.txt" ]]; then echo " " echo "**** App Key found ****" APP_KEY=$(echo "${APP_KEY}") -- cgit v1.2.3-54-g00ecf From 4d159f2b5beb3ed0f1943e197db9bcdeb0237968 Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 08:04:41 -0400 Subject: Update docker/README.md Co-authored-by: Cromefire_ --- docker/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker/README.md b/docker/README.md index 94bcb24..573498e 100644 --- a/docker/README.md +++ b/docker/README.md @@ -54,8 +54,7 @@ To create the docker container with the proper parameters: -e CONNECT_WITH_FRANZ=true \ -e DATA_DIR=/data \ -p :3333 \ - -v :/config \ - -v :/app/database \ + -v :/data \ -v :/app/recipes \ --restart unless-stopped \ getferdi/ferdi-server -- cgit v1.2.3-54-g00ecf From f97d567dd8ca43b9b27153f4e98f45e84a22052d Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 08:05:19 -0400 Subject: Update docker/docker-compose.yml Co-authored-by: Cromefire_ --- docker/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index cf7269a..acd1264 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -24,7 +24,7 @@ services: - IS_DASHBOARD_ENABLED=true - IS_REGISTRATION_ENABLED=true - CONNECT_WITH_FRANZ=false - - DATA_DIR=data # existing Ferdi-server users should ensure that they add this variable to ensure data persistence. + - DATA_DIR=/data # existing Ferdi-server users should ensure that they add this variable to ensure data persistence. volumes: - ferdi-config-vol:/config - ferdi-database-vol:/app/data # existing Ferdi-server users who use the built-in sqlite database should use the volume name "/app/database" -- cgit v1.2.3-54-g00ecf From 1b90c82cff122210f8441fe9eef72bce4b3bc3e8 Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 08:06:21 -0400 Subject: Update database.js reverting DATA_DIR default to data --- config/database.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/database.js b/config/database.js index 1812295..9372eda 100644 --- a/config/database.js +++ b/config/database.js @@ -32,7 +32,7 @@ module.exports = { sqlite: { client: 'sqlite3', connection: { - filename: path.join(Env.get('DATA_DIR', '/data'), `${Env.get('DB_DATABASE', 'ferdi')}.sqlite`), + filename: path.join(Env.get('DATA_DIR', 'data'), `${Env.get('DB_DATABASE', 'ferdi')}.sqlite`), }, useNullAsDefault: true, debug: Env.get('DB_DEBUG', false), -- cgit v1.2.3-54-g00ecf From 320fb9ef6b66bd2468629738aba783d965e4e63f Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 08:08:04 -0400 Subject: Update docker/README.md Co-authored-by: Cromefire_ --- docker/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker/README.md b/docker/README.md index 573498e..1efa2b4 100644 --- a/docker/README.md +++ b/docker/README.md @@ -101,8 +101,7 @@ Container images are configured using parameters passed at runtime (such as thos | `-e IS_REGISTRATION_ENABLED=true` | for specifying whether to allow user registration, default is true | | `-e CONNECT_WITH_FRANZ=true` | for specifying whether to enable connections to the Franz server, default is true | | `-e DATA_DIR=data` | for specifying the SQLite database folder, default is data | -| `-v :/config` | this will store persistent configuration data on the docker host. See the [Docker docs](https://docs.docker.com/storage/volumes/) for more information on the use of container volumes | -| `-v :/app/data` | this will store Ferdi-server's database on the docker host for persistence | +| `-v :/data` | this will store Ferdi-server's data (among others the database) on the docker host for persistence. See the [Docker docs](https://docs.docker.com/storage/volumes/) for more information on the use of container volumes | | `-v :/app/recipes` | this will store Ferdi-server's recipes on the docker host for persistence | By enabling the `CONNECT_WITH_FRANZ` option, Ferdi-server can: -- cgit v1.2.3-54-g00ecf From 9171dbdbc0b9013cffece3a0e1c2133112a5f280 Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 08:09:11 -0400 Subject: Update README.md --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 1efa2b4..c9237cf 100644 --- a/docker/README.md +++ b/docker/README.md @@ -101,7 +101,7 @@ Container images are configured using parameters passed at runtime (such as thos | `-e IS_REGISTRATION_ENABLED=true` | for specifying whether to allow user registration, default is true | | `-e CONNECT_WITH_FRANZ=true` | for specifying whether to enable connections to the Franz server, default is true | | `-e DATA_DIR=data` | for specifying the SQLite database folder, default is data | -| `-v :/data` | this will store Ferdi-server's data (among others the database) on the docker host for persistence. See the [Docker docs](https://docs.docker.com/storage/volumes/) for more information on the use of container volumes | +| `-v :/data` | this will store Ferdi-server's data (its database, among other things) on the docker host for persistence. See the [Docker docs](https://docs.docker.com/storage/volumes/) for more information on the use of container volumes | | `-v :/app/recipes` | this will store Ferdi-server's recipes on the docker host for persistence | By enabling the `CONNECT_WITH_FRANZ` option, Ferdi-server can: -- cgit v1.2.3-54-g00ecf From 74557d190d6611ebfbb29805a63d1b0128f090da Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 08:09:45 -0400 Subject: Update .env.example --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 6b81d1b..69d4d3c 100644 --- a/.env.example +++ b/.env.example @@ -10,7 +10,7 @@ CACHE_VIEWS=false APP_KEY= -DATA_DIR=/data +DATA_DIR=data DB_CONNECTION=sqlite DB_HOST=127.0.0.1 -- cgit v1.2.3-54-g00ecf From c87515d488b5c7d8858f404dbca1627b87128b27 Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 09:16:58 -0400 Subject: Update docker-compose.yml Fixed the DATA_DIR to align with the rest of the repo and removed the reference to the config volume. --- docker/docker-compose.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index acd1264..7a67b87 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -26,13 +26,11 @@ services: - CONNECT_WITH_FRANZ=false - DATA_DIR=/data # existing Ferdi-server users should ensure that they add this variable to ensure data persistence. volumes: - - ferdi-config-vol:/config - - ferdi-database-vol:/app/data # existing Ferdi-server users who use the built-in sqlite database should use the volume name "/app/database" + - ferdi-database-vol:/data # existing Ferdi-server users who use the built-in sqlite database should use the volume name "/app/database" - ferdi-recipes-vol:/app/recipes ports: - 3333:3333 # existing Ferdi-server users will neeed to update their portt mappings from 80:3333 to 3333:3333. restart: unless-stopped volumes: - ferdi-config-vol: ferdi-database-vol: ferdi-recipes-vol: -- cgit v1.2.3-54-g00ecf From 1b7a2cd14f494df1d0b834dd218cc2da50ccc0df Mon Sep 17 00:00:00 2001 From: thursday Date: Tue, 13 Jul 2021 09:23:31 -0400 Subject: Update README.md --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a73b717..715208d 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ The easiest way to set up Ferdi server on your server is with Docker. The Docker image can be run as is, with the default SQLite database or you can modifying your ENV variables to use an external database (e.g. MySQL, MariaDB, Postgres, etc). After setting up the docker container we recommend you set up an NGINX reverse proxy to access Ferdi-server outside of your home network and protect it with an SSL certificate. -**Warning**, please note that the use of the previous `config.txt` is now deprecated and a number of environmental variables have changed, specifically the default database name and local, the internal contianer port, and an additional `DATA_DIR` variable has been added. Make sure to pass the correct environmental variables to your container at runtime. If you are an existing Ferdi-server user please see [the Ferdi docker documentation](./docker/README.md) and the example [docker-compose.yml](./docker/docker-compose.yml) for more information. +**Warning**, please note that the use of the previous `config.txt` is now deprecated and a number of environmental variables have changed, specifically the default database name and location, the internal container port, and an additional `DATA_DIR` variable has been added. Make sure to pass the correct environmental variables to your container at runtime. If you are an existing Ferdi-server user please see [the Ferdi docker documentation](./docker/README.md) and the example [docker-compose.yml](./docker/docker-compose.yml) for more information about migrating to the new image. 1. Pull the Docker image @@ -75,8 +75,7 @@ After setting up the docker container we recommend you set up an NGINX reverse p -e CONNECT_WITH_FRANZ=true \ -e DATA_DIR=data \ -p :3333 \ - -v :/config \ - -v :/app/database \ + -v :/data \ -v :/app/recipes \ --restart unless-stopped \ getferdi/ferdi-server -- cgit v1.2.3-54-g00ecf From 0f1bf1e42217f43f4846e4397b26759c148130a1 Mon Sep 17 00:00:00 2001 From: thursday Date: Sun, 18 Jul 2021 00:44:03 -0400 Subject: Update README.md --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 715208d..ec5563a 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,10 @@ Official Server software for the [Ferdi Messaging Browser](https://getferdi.com) - [Contributing to Ferdi-server's development](#contributing-to-ferdi-servers-development) - [License](#license) -## Why use a custom Ferdi server? +## Why use a custom Ferdi-server? A custom server allows you to manage the data of all registered users yourself and add your own recipes to the repository. -If you are not interested in doing this you can use our official instance of Ferdi server at . +If you are not interested in doing this you can use our official instance of Ferdi-server at . ## Features - [x] User registration and login @@ -30,16 +30,16 @@ If you are not interested in doing this you can use our official instance of Fer - [x] Workspace support - [x] Functioning service store - [x] User dashboard -- [x] Export/import data to other Ferdi-servers +- [x] Export/import data to other Ferdi servers - [ ] Password recovery - [ ] Recipe update ## Setup ### with Docker -The easiest way to set up Ferdi server on your server is with Docker. +The easiest way to set up Ferdi-server on your server is with Docker. -The Docker image can be run as is, with the default SQLite database or you can modifying your ENV variables to use an external database (e.g. MySQL, MariaDB, Postgres, etc). -After setting up the docker container we recommend you set up an NGINX reverse proxy to access Ferdi-server outside of your home network and protect it with an SSL certificate. +The Docker image can be run as is, with the default SQLite database or you can modify your ENV variables to use an external database (e.g. MySQL, MariaDB, Postgres, etc). +After setting up the docker container we recommend you set up an NGINX reverse proxy to access Ferdi server outside of your home network and protect it with an SSL certificate. **Warning**, please note that the use of the previous `config.txt` is now deprecated and a number of environmental variables have changed, specifically the default database name and location, the internal container port, and an additional `DATA_DIR` variable has been added. Make sure to pass the correct environmental variables to your container at runtime. If you are an existing Ferdi-server user please see [the Ferdi docker documentation](./docker/README.md) and the example [docker-compose.yml](./docker/docker-compose.yml) for more information about migrating to the new image. @@ -83,7 +83,7 @@ After setting up the docker container we recommend you set up an NGINX reverse p Alternatively, you can also use docker-compose v2 schema. An example can be found [in the docker folder](./docker/docker-compose.yml). -3. 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). +3. Optionally, you can [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). For more information on configuring the Docker image, please read [the ferdi docker documentation](./docker/README.md). @@ -118,7 +118,7 @@ franz-server's configuration is saved inside an `.env` file. Besides AdonisJS's ## Importing your Franz account -ferdi-server allows you to import your full Franz account, including all its settings. +Ferdi-server allows you to import your full Franz account, including all its settings. To 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. -- cgit v1.2.3-54-g00ecf From a7ee89f9170348e8835bf7f328a0d879c97a4dfe Mon Sep 17 00:00:00 2001 From: thursday Date: Sun, 18 Jul 2021 00:47:07 -0400 Subject: Update README.md --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index c9237cf..840ca34 100644 --- a/docker/README.md +++ b/docker/README.md @@ -65,7 +65,7 @@ To create the docker container with the proper parameters: To start the application, use - docker-compose up + docker-compose up -d The server will be launched at [http://localhost:3333/](http://localhost:3333/) address. **Existing users please note:** The latest updates to Ferdi-server and the Ferdi-server Docker image introduce changes to the default SQLite database name and location, as well as the internal containeer port. Please see the comments in the sample [./docker/docker-compose.yml](https://github.com/getferdi/server/tree/master/docker/docker-compose.yml) in order to continue using your existing database. -- cgit v1.2.3-54-g00ecf From 38991cade3ee2898f057b087a1af2140407c99ab Mon Sep 17 00:00:00 2001 From: thursday Date: Sun, 18 Jul 2021 00:47:50 -0400 Subject: Update docker/docker-compose.yml Co-authored-by: Cromefire_ --- docker/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 7a67b87..577c546 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -11,7 +11,7 @@ services: - DB_PORT=3306 - DB_USER=root - DB_PASSWORD=password - - DB_DATABASE=ferdi # existing Ferdi-server users who use the built-in sqlite database should use the database name "development" + - DB_DATABASE=ferdi - DB_SSL=false - MAIL_CONNECTION=smtp - SMPT_HOST=127.0.0.1 -- cgit v1.2.3-54-g00ecf From 1e7416aa921375a264434fc1b8644027f70e87d9 Mon Sep 17 00:00:00 2001 From: thursday Date: Sun, 18 Jul 2021 00:48:16 -0400 Subject: Update docker/docker-compose.yml Co-authored-by: Cromefire_ --- docker/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 577c546..6f9adf3 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -24,7 +24,7 @@ services: - IS_DASHBOARD_ENABLED=true - IS_REGISTRATION_ENABLED=true - CONNECT_WITH_FRANZ=false - - DATA_DIR=/data # existing Ferdi-server users should ensure that they add this variable to ensure data persistence. + - DATA_DIR=/data volumes: - ferdi-database-vol:/data # existing Ferdi-server users who use the built-in sqlite database should use the volume name "/app/database" - ferdi-recipes-vol:/app/recipes -- cgit v1.2.3-54-g00ecf From c584dd81bbaad01b4ac58980fe18541cd5dd8a9b Mon Sep 17 00:00:00 2001 From: thursday Date: Sun, 18 Jul 2021 00:48:34 -0400 Subject: Update docker/docker-compose.yml Co-authored-by: Cromefire_ --- docker/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 6f9adf3..775d3e5 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -26,7 +26,7 @@ services: - CONNECT_WITH_FRANZ=false - DATA_DIR=/data volumes: - - ferdi-database-vol:/data # existing Ferdi-server users who use the built-in sqlite database should use the volume name "/app/database" + - ferdi-database-vol:/data - ferdi-recipes-vol:/app/recipes ports: - 3333:3333 # existing Ferdi-server users will neeed to update their portt mappings from 80:3333 to 3333:3333. -- cgit v1.2.3-54-g00ecf From 4ea7a59fd2441ddc322edcffe04e12b2d05fac9d Mon Sep 17 00:00:00 2001 From: thursday Date: Sun, 18 Jul 2021 00:48:57 -0400 Subject: Update docker/docker-compose.yml Co-authored-by: Cromefire_ --- docker/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 775d3e5..6d10cce 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -29,7 +29,7 @@ services: - ferdi-database-vol:/data - ferdi-recipes-vol:/app/recipes ports: - - 3333:3333 # existing Ferdi-server users will neeed to update their portt mappings from 80:3333 to 3333:3333. + - 3333:3333 restart: unless-stopped volumes: ferdi-database-vol: -- cgit v1.2.3-54-g00ecf From 95d60b83a7946e37b78641e76d40a90eeb6a804a Mon Sep 17 00:00:00 2001 From: thursday Date: Sun, 18 Jul 2021 00:57:18 -0400 Subject: Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ec5563a..a04f741 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ If you are not interested in doing this you can use our official instance of Fer - [x] Workspace support - [x] Functioning service store - [x] User dashboard -- [x] Export/import data to other Ferdi servers +- [x] Export/import data to other Ferdi-servers - [ ] Password recovery - [ ] Recipe update @@ -39,7 +39,7 @@ If you are not interested in doing this you can use our official instance of Fer The easiest way to set up Ferdi-server on your server is with Docker. The Docker image can be run as is, with the default SQLite database or you can modify your ENV variables to use an external database (e.g. MySQL, MariaDB, Postgres, etc). -After setting up the docker container we recommend you set up an NGINX reverse proxy to access Ferdi server outside of your home network and protect it with an SSL certificate. +After setting up the docker container we recommend you set up an NGINX reverse proxy to access Ferdi-server outside of your home network and protect it with an SSL certificate. **Warning**, please note that the use of the previous `config.txt` is now deprecated and a number of environmental variables have changed, specifically the default database name and location, the internal container port, and an additional `DATA_DIR` variable has been added. Make sure to pass the correct environmental variables to your container at runtime. If you are an existing Ferdi-server user please see [the Ferdi docker documentation](./docker/README.md) and the example [docker-compose.yml](./docker/docker-compose.yml) for more information about migrating to the new image. @@ -85,7 +85,7 @@ After setting up the docker container we recommend you set up an NGINX reverse p 3. Optionally, you can [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). -For more information on configuring the Docker image, please read [the ferdi docker documentation](./docker/README.md). +For more information on configuring the Docker image, please read [the Ferdi docker documentation](./docker/README.md). ### Manual setup @@ -120,7 +120,7 @@ franz-server's configuration is saved inside an `.env` file. Besides AdonisJS's Ferdi-server allows you to import your full Franz account, including all its settings. -To 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. +To 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. ## Transferring user data -- cgit v1.2.3-54-g00ecf From 9bd5f72605cfd0da81c0c03f78286767d615514a Mon Sep 17 00:00:00 2001 From: thursday Date: Sun, 18 Jul 2021 01:00:03 -0400 Subject: Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a04f741..6a45b08 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ The easiest way to set up Ferdi-server on your server is with Docker. The Docker image can be run as is, with the default SQLite database or you can modify your ENV variables to use an external database (e.g. MySQL, MariaDB, Postgres, etc). After setting up the docker container we recommend you set up an NGINX reverse proxy to access Ferdi-server outside of your home network and protect it with an SSL certificate. -**Warning**, please note that the use of the previous `config.txt` is now deprecated and a number of environmental variables have changed, specifically the default database name and location, the internal container port, and an additional `DATA_DIR` variable has been added. Make sure to pass the correct environmental variables to your container at runtime. If you are an existing Ferdi-server user please see [the Ferdi docker documentation](./docker/README.md) and the example [docker-compose.yml](./docker/docker-compose.yml) for more information about migrating to the new image. +**Warning**, please note that the use of the previous `config.txt` is now deprecated and a number of environmental variables have changed, specifically the default database name and location, the internal container port, and an additional `DATA_DIR` variable has been added. Make sure to pass the correct environmental variables to your container at runtime. If you are an existing Ferdi-server user, please see [the Ferdi docker documentation](./docker/README.md) for more information about migrating to the new image. 1. Pull the Docker image -- cgit v1.2.3-54-g00ecf From 43b328237fccb997489b31f250790b072a2a6c18 Mon Sep 17 00:00:00 2001 From: thursday Date: Sun, 18 Jul 2021 01:45:27 -0400 Subject: Update README.md --- docker/README.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/docker/README.md b/docker/README.md index 840ca34..1b0e4aa 100644 --- a/docker/README.md +++ b/docker/README.md @@ -20,7 +20,9 @@ A custom Ferdi-server allows you to experience the full potential of the Ferdi C Here are some example snippets to help you get started creating a container. -The 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 a webserver such as NGINX. +The 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 need to create a reverse proxy to access Ferdi-server outside of your home network, using a webserver such as NGINX. + +**Existing users, please note:** The latest updates to Ferdi-server and the Ferdi-server Docker image introduce changes to the default SQLite database name and location, as well as the internal containeer port. Please see the comments in the [Migration section](#migrating-from-an-existing-ferdi-server) below in order to continue using your existing Ferdi-server database. ### docker @@ -68,14 +70,12 @@ To create the docker container with the proper parameters: docker-compose up -d The server will be launched at [http://localhost:3333/](http://localhost:3333/) address. -**Existing users please note:** The latest updates to Ferdi-server and the Ferdi-server Docker image introduce changes to the default SQLite database name and location, as well as the internal containeer port. Please see the comments in the sample [./docker/docker-compose.yml](https://github.com/getferdi/server/tree/master/docker/docker-compose.yml) in order to continue using your existing database. - ## Configuration Container images are configured using parameters passed at runtime (such as those above). An explanaition of the default parameters is included below, but please see [the Docker documentation](https://docs.docker.com/get-started/overview/) for additional information. -**Warning, the use of `config.txt` is now deprecated. Please make sure to pass the correct environmental variables to your container at runtime.** If any environmental parameter is not passed to the container, its value will be taken from the `/config/config.txt` file. +**Warning, the use of `config.txt` is now deprecated. Please make sure to pass the correct environmental variables to your container at runtime. ** | Parameter | Function | | :----: | --- | @@ -128,6 +128,15 @@ To use a different email sender than the default, SMTP, enter the correct inform | SparkPost | SPARKPOST_API_KEY | | Mailgun | MAILGUN_DOMAIN, MAILGUN_API_REGION, MAILGUN_API_KEY | | (**Deprecated**) Ethereal | A disposable account is created automatically if you choose this option. | + +## Migrating from an existing Ferdi-server + +| Parameter | Function | +| :----: | --- | +| `-p 3333:3333` | existing Ferdi-server users will need to update their port mappings from `80:3333` to `3333:3333` | +| `-e DB_PASSWORD=development` | existing Ferdi-server users who use the built-in sqlite database should use the database name `development` | +| `-e DATA_DIR=/app/database` | existing Ferdi-server users should ensure that they add this variable to ensure data persistence | +| `-v =/app/databases` | existing Ferdi-server users who use the built-in sqlite database should use the volume name `/app/database` | ## NGINX config block To access Ferdi-server from outside of your home network on a subdomain use this server block: -- cgit v1.2.3-54-g00ecf From 412d75137ab9ae329bad17181a37dace46127b2b Mon Sep 17 00:00:00 2001 From: thursday Date: Sun, 18 Jul 2021 02:04:34 -0400 Subject: Update README.md --- docker/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/README.md b/docker/README.md index 1b0e4aa..d427d3e 100644 --- a/docker/README.md +++ b/docker/README.md @@ -22,7 +22,7 @@ Here are some example snippets to help you get started creating a container. The 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 need to create a reverse proxy to access Ferdi-server outside of your home network, using a webserver such as NGINX. -**Existing users, please note:** The latest updates to Ferdi-server and the Ferdi-server Docker image introduce changes to the default SQLite database name and location, as well as the internal containeer port. Please see the comments in the [Migration section](#migrating-from-an-existing-ferdi-server) below in order to continue using your existing Ferdi-server database. +**Existing users, please note:** The latest updates to Ferdi-server and the Ferdi-server Docker image introduce changes to the default SQLite database name and location, as well as the internal container port. The new container port is `3333`. If you would like to keep your existing SQLite database, you will need to add the `DATA_DIR` variable and change it to `/app/database`, to match your existing data volume. You will also need to change the `DB_DATABASE` variable to `development` to match your existing database. Please see the parameters in the [Migration section](#migrating-from-an-existing-ferdi-server) below. ### docker @@ -101,8 +101,8 @@ Container images are configured using parameters passed at runtime (such as thos | `-e IS_REGISTRATION_ENABLED=true` | for specifying whether to allow user registration, default is true | | `-e CONNECT_WITH_FRANZ=true` | for specifying whether to enable connections to the Franz server, default is true | | `-e DATA_DIR=data` | for specifying the SQLite database folder, default is data | -| `-v :/data` | this will store Ferdi-server's data (its database, among other things) on the docker host for persistence. See the [Docker docs](https://docs.docker.com/storage/volumes/) for more information on the use of container volumes | -| `-v :/app/recipes` | this will store Ferdi-server's recipes on the docker host for persistence | +| `-v :/data` | this will store Ferdi-server's data (its database, among other things) on the docker host for persistence. See the [Docker docs](https://docs.docker.com/storage/volumes/) for more information on the use of container volumes | +| `-v :/app/recipes` | this will store Ferdi-server's recipes on the docker host for persistence | By enabling the `CONNECT_WITH_FRANZ` option, Ferdi-server can: - Show the full Franz recipe library instead of only custom recipes @@ -136,7 +136,7 @@ To use a different email sender than the default, SMTP, enter the correct inform | `-p 3333:3333` | existing Ferdi-server users will need to update their port mappings from `80:3333` to `3333:3333` | | `-e DB_PASSWORD=development` | existing Ferdi-server users who use the built-in sqlite database should use the database name `development` | | `-e DATA_DIR=/app/database` | existing Ferdi-server users should ensure that they add this variable to ensure data persistence | -| `-v =/app/databases` | existing Ferdi-server users who use the built-in sqlite database should use the volume name `/app/database` | +| `-v =/app/databases` | existing Ferdi-server users who use the built-in sqlite database should use the volume name `/app/database` | ## NGINX config block To access Ferdi-server from outside of your home network on a subdomain use this server block: -- cgit v1.2.3-54-g00ecf From 2f0dc9ccb9b3957fdddfaae1470613643df54d31 Mon Sep 17 00:00:00 2001 From: thursday Date: Sun, 18 Jul 2021 02:38:58 -0400 Subject: Update README.md --- docker/README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docker/README.md b/docker/README.md index d427d3e..fa7ff78 100644 --- a/docker/README.md +++ b/docker/README.md @@ -64,11 +64,9 @@ To create the docker container with the proper parameters: ### docker-compose You can use the provided sample [docker-compose.yml](https://github.com/getferdi/server/tree/master/docker/docker-compose.yml) if you are happy with the default environmental variables. This will pull the latest image from Docker Hub or use a local copy of the image which you can build using the instructions provided in the [Building locally section](#building-locally). - - To start the application, use - - docker-compose up -d -The server will be launched at [http://localhost:3333/](http://localhost:3333/) address. + + To start the application, use `docker-compose up -d`. +The server will be launched at [http://localhost:3333/](http://localhost:3333/) address. ## Configuration @@ -135,7 +133,7 @@ To use a different email sender than the default, SMTP, enter the correct inform | :----: | --- | | `-p 3333:3333` | existing Ferdi-server users will need to update their port mappings from `80:3333` to `3333:3333` | | `-e DB_PASSWORD=development` | existing Ferdi-server users who use the built-in sqlite database should use the database name `development` | -| `-e DATA_DIR=/app/database` | existing Ferdi-server users should ensure that they add this variable to ensure data persistence | +| `-e DATA_DIR=/app/database` | existing Ferdi-server users should add this environmental variable to ensure data persistence | | `-v =/app/databases` | existing Ferdi-server users who use the built-in sqlite database should use the volume name `/app/database` | ## NGINX config block -- cgit v1.2.3-54-g00ecf From e67cdfca499a2ef7c8af0102b56aa29806f49904 Mon Sep 17 00:00:00 2001 From: thursday Date: Sun, 18 Jul 2021 04:26:56 -0400 Subject: Update README.md --- docker/README.md | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/docker/README.md b/docker/README.md index fa7ff78..3d8bd5f 100644 --- a/docker/README.md +++ b/docker/README.md @@ -129,14 +129,30 @@ To use a different email sender than the default, SMTP, enter the correct inform ## Migrating from an existing Ferdi-server +If you are an existing Ferdi-server user using the built-in `SQlite` database, you should include the following variables: | Parameter | Function | | :----: | --- | -| `-p 3333:3333` | existing Ferdi-server users will need to update their port mappings from `80:3333` to `3333:3333` | +| `-p 3333:3333` | existing Ferdi-server users will need to update their container port mappings from `80:3333` to `3333:3333` | | `-e DB_PASSWORD=development` | existing Ferdi-server users who use the built-in sqlite database should use the database name `development` | -| `-e DATA_DIR=/app/database` | existing Ferdi-server users should add this environmental variable to ensure data persistence | +| `-e DATA_DIR=/app/database` | existing Ferdi-server users who use the built-in sqlite database should add this environmental variable to ensure data persistence | | `-v =/app/databases` | existing Ferdi-server users who use the built-in sqlite database should use the volume name `/app/database` | + +If you are an existing Ferdi-server user who usees an external database or different variables for the built-in `SQlite` database, you should updatae your parameterse acordingly. For exaple, if you aree using an exterenal MariaDB or MYSql database your unique parameters might look like this: +| Parameter | Function | +| :----: | --- | +| `-e DB_CONNECTION=mysql` | for specifying the database being used | +| `-e DB_HOST=192.168.10.1` | for specifying the database host machine IP | +| `-e DB_PORT=3306` | for specifying the database port | +| `-e DB_USER=ferdi` | for specifying the database user | +| `-e DB_PASSWORD=ferdipw` | for specifying the database password| +| `-e DB_DATABASE=adonis` | for specifying the database to be used| +| `-v :/app/database` | this will strore Ferdi-server's database on the docker host for persistence | +| `-v :/app/recipes` | this will strore Ferdi-server's recipes on the docker host for persistence | + +**In eithr case, pleasee be sure to pass the correct variables to the new Ferdi-server container in order maintain access to your existing database.** ## NGINX config block + To access Ferdi-server from outside of your home network on a subdomain use this server block: ``` @@ -159,14 +175,17 @@ server { ``` ## Importing your Franz account + Ferdi-server allows you to import your full Franz account, including all its settings. To 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. ## Transferring user data + Please refer to ## Creating and using custom recipes + Ferdi-server allows to extends the Franz recipe catalogue with custom Ferdi recipes. For documentation on how to create a recipe, please visit [the official guide by Franz](https://github.com/meetfranz/plugins/blob/master/docs/integration.md). @@ -179,6 +198,7 @@ To add your recipe to Ferdi-server, open `http://[YOUR FERDI-SERVER]/new` in you - `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. ### Listing custom recipes + Inside Ferdi, searching for `ferdi:custom` will list all your custom recipes. ## Support Info @@ -191,6 +211,7 @@ Inside Ferdi, searching for `ferdi:custom` will list all your custom recipes. Below are the instructions for updating the container to get the most recent version of Ferdi-server: ### Via Docker Run/Create + * Update the image: `docker pull getferdi/ferdi-server` * Stop the running container: `docker stop ferdi-server` * Delete the container: `docker rm ferdi-server` @@ -199,6 +220,7 @@ Below are the instructions for updating the container to get the most recent ver * You can also remove the old dangling images: `docker image prune` ### Via Docker Compose + * Update all images: `docker-compose pull` * or update a single image: `docker-compose pull ferdi-server` * Let compose update all containers as necessary: `docker-compose up -d` -- cgit v1.2.3-54-g00ecf From e669a20c0573bcff1097db2a58e0215a245f1010 Mon Sep 17 00:00:00 2001 From: thursday Date: Sun, 18 Jul 2021 04:33:12 -0400 Subject: Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d7ed503..5103ad0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,5 +23,5 @@ RUN ["npm", "i", "-g", "@adonisjs/cli"] HEALTHCHECK --interval=5m --timeout=3s CMD curl -sSf http://localhost:${PORT}/health COPY docker/entrypoint.sh /entrypoint.sh -COPY docker/.env /data/.env +COPY docker/.env /app/.env CMD ["/entrypoint.sh"] -- cgit v1.2.3-54-g00ecf From 7e0f6b5e3a845af0e4d88e8164ce38253a0bd5c6 Mon Sep 17 00:00:00 2001 From: thursday Date: Sun, 18 Jul 2021 16:34:27 -0400 Subject: Update .dockerignore Trying to build without node_modules in the docker ignore to see if that will avoid the current problems running the container without installing the server at runtime. --- .dockerignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index 110334e..99ed609 100644 --- a/.dockerignore +++ b/.dockerignore @@ -14,7 +14,7 @@ docker !docker/entrypoint.sh !docker/.env -node_modules +#node_modules -- cgit v1.2.3-54-g00ecf From 3898a5352715386fadd19d832937819dd12c2e0f Mon Sep 17 00:00:00 2001 From: thursday Date: Mon, 19 Jul 2021 03:47:23 -0400 Subject: Update .dockerignore --- .dockerignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index 99ed609..110334e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -14,7 +14,7 @@ docker !docker/entrypoint.sh !docker/.env -#node_modules +node_modules -- cgit v1.2.3-54-g00ecf From 45c1b800ed88cc4ddfddd828932385bbb4edc319 Mon Sep 17 00:00:00 2001 From: thursday Date: Wed, 21 Jul 2021 01:32:18 -0400 Subject: Update Dockerfile Added su-exec to work towards running ferdi-server as a non-root user. --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5103ad0..9c2b1a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,9 +13,9 @@ FROM node:lts-alpine WORKDIR /app LABEL maintainer="xthursdayx" -ENV HOST=0.0.0.0 PORT=3333 DATA_DIR="/data" +ENV HOST=0.0.0.0 PORT=3333 DATA_DIR="/data" -RUN ["apk", "add", "--no-cache", "sqlite-libs", "curl"] +RUN ["apk", "add", "--no-cache", "sqlite-libs", "curl", "su-exec"] COPY --from=build /server-build /app RUN ["npm", "i", "-g", "@adonisjs/cli"] -- cgit v1.2.3-54-g00ecf From cf6cfb9a0c036284325945e1c67b81f1bee1016e Mon Sep 17 00:00:00 2001 From: thursday Date: Wed, 21 Jul 2021 02:36:00 -0400 Subject: Update .env.example Added PUID and PGID values to run as non-root --- .env.example | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 69d4d3c..0c470e9 100644 --- a/.env.example +++ b/.env.example @@ -18,9 +18,11 @@ DB_PORT=3306 DB_USER=root DB_PASSWORD= DB_DATABASE=ferdi - DB_SSL=false +PUID=1000 +PGID=1000 + HASH_DRIVER=bcrypt IS_CREATION_ENABLED=true -- cgit v1.2.3-54-g00ecf From 5903e822846f8708bee2b3aa9e2ddde2da46d4f7 Mon Sep 17 00:00:00 2001 From: thursday Date: Wed, 21 Jul 2021 02:50:11 -0400 Subject: Update entrypoint.sh Attempting to launch the server with su-exec in order to run it as a non-root user. --- docker/entrypoint.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index a897339..3c7cb10 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -32,4 +32,6 @@ export APP_KEY node ace migration:run --force -exec node server.js +chown -R ${PUID:-1000}:${PGID:-1000) $DATA_DIR /app + +su-exec ${PUID:-1000}:${PGID:-1000} node server.js -- cgit v1.2.3-54-g00ecf From 4515cc9c0157aa71c6cfc0cd002b8a6eed1b423e Mon Sep 17 00:00:00 2001 From: thursday Date: Wed, 21 Jul 2021 02:53:32 -0400 Subject: Update docker-compose.yml Added PUID and PGID values --- docker/docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 6d10cce..bd66ba2 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -25,6 +25,8 @@ services: - IS_REGISTRATION_ENABLED=true - CONNECT_WITH_FRANZ=false - DATA_DIR=/data + - PUID=1000 + - PGID=1000 volumes: - ferdi-database-vol:/data - ferdi-recipes-vol:/app/recipes -- cgit v1.2.3-54-g00ecf From 1699a1cd6a762a2d02524bc94f2798eebab5bb00 Mon Sep 17 00:00:00 2001 From: thursday Date: Wed, 21 Jul 2021 04:00:23 -0400 Subject: Update entrypoint.sh --- docker/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 3c7cb10..0679530 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -32,6 +32,6 @@ export APP_KEY node ace migration:run --force -chown -R ${PUID:-1000}:${PGID:-1000) $DATA_DIR /app +chown -R ${PUID:-1000}:${PGID:-1000} $DATA_DIR /app su-exec ${PUID:-1000}:${PGID:-1000} node server.js -- cgit v1.2.3-54-g00ecf From bb0c7ea545d78f1e7aa8a88e445cc16efa737d70 Mon Sep 17 00:00:00 2001 From: thursday Date: Wed, 21 Jul 2021 04:23:33 -0400 Subject: Update package.json Adding the node mysql helper --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 6673fb9..aaff8d1 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "btoa": "^1.2.1", "fs-extra": "^8.1.0", "node-fetch": "^2.6.1", + "mysql": "^2.18.1", "pg": "^7.18.2", "sqlite3": "^4.1.0", "targz": "^1.0.1", -- cgit v1.2.3-54-g00ecf From 6ca1e396ef9ac1099eb17e471f3b646c8c9d7c72 Mon Sep 17 00:00:00 2001 From: thursday Date: Wed, 21 Jul 2021 04:50:40 -0400 Subject: Added mysql to package-lock.json Added mysql and dependences to package-lock.json --- package-lock.json | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/package-lock.json b/package-lock.json index d67550c..ea72c61 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4205,6 +4205,38 @@ "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=" }, + "mysql": { + "version": "2.18.1", + "resolved": "https://registry.npmjs.org/mysql/-/mysql-2.18.1.tgz", + "integrity": "sha512-Bca+gk2YWmqp2Uf6k5NFEurwY/0td0cpebAucFpY/3jhrwrVGuxU2uQFCHjU19SJfje0yQvi+rVWdq78hR5lig==", + "requires": { + "bignumber.js": "9.0.0", + "readable-stream": "2.3.7", + "safe-buffer": "5.1.2", + "sqlstring": "2.3.1" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, "nan": { "version": "2.14.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", -- cgit v1.2.3-54-g00ecf From 43dd8bfbe19446ae26b703dfafe2de1788a72449 Mon Sep 17 00:00:00 2001 From: thursday Date: Wed, 21 Jul 2021 05:23:57 -0400 Subject: Added mysql Based on the package.json that was generated after installing mysql inside of a running ferdi-server container using the command: npm install --save mysql --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index aaff8d1..2d907b5 100644 --- a/package.json +++ b/package.json @@ -41,8 +41,8 @@ "atob": "^2.1.2", "btoa": "^1.2.1", "fs-extra": "^8.1.0", + "mysql": "2.18.1", "node-fetch": "^2.6.1", - "mysql": "^2.18.1", "pg": "^7.18.2", "sqlite3": "^4.1.0", "targz": "^1.0.1", -- cgit v1.2.3-54-g00ecf From 93550a4d7ebce34c35f5e0533f5333562ba4cb5c Mon Sep 17 00:00:00 2001 From: thursday Date: Wed, 21 Jul 2021 05:32:14 -0400 Subject: Update package-lock.json Based on the package-lock.json that was generated after installing mysql inside of a running ferdi-server container using the command: npm install --save mysql --- package-lock.json | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index ea72c61..6c4f605 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1212,6 +1212,11 @@ "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz", "integrity": "sha1-mrVie5PmBiH/fNrF2pczAn3x0Ms=" }, + "bignumber.js": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", + "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==" + }, "bl": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz", @@ -4212,13 +4217,13 @@ "requires": { "bignumber.js": "9.0.0", "readable-stream": "2.3.7", - "safe-buffer": "5.1.2", + "safe-buffer": "5.1.2", "sqlstring": "2.3.1" }, "dependencies": { "readable-stream": { "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", "requires": { "core-util-is": "~1.0.0", @@ -6626,6 +6631,11 @@ "request": "^2.87.0" } }, + "sqlstring": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz", + "integrity": "sha1-R1OT/56RR5rqYtyvDKPRSYOn+0A=" + }, "sshpk": { "version": "1.16.1", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", -- cgit v1.2.3-54-g00ecf From 8bfe57ddafc20488bf31931eeb76ce497f9e596b Mon Sep 17 00:00:00 2001 From: thursday Date: Wed, 21 Jul 2021 06:19:22 -0400 Subject: Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9c2b1a8..31dc994 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ COPY . /server-build RUN ["npm", "ci", "--production", "--build-from-source", "--sqlite=/usr/local"] FROM node:lts-alpine -# TODO: implement process to run ferdi-server as non-root user. See comments on https://github.com/getferdi/server/pull/48/ + WORKDIR /app LABEL maintainer="xthursdayx" -- cgit v1.2.3-54-g00ecf From 8fa3f93c734ea9305e9bd5b3100816eb373b64a0 Mon Sep 17 00:00:00 2001 From: thursday Date: Mon, 23 Aug 2021 18:09:33 +0000 Subject: Update entrypoint.sh Fixed error causing Ferdi-server's Adonis APP_KEY not to be read from FERDI_APP_KEY.txt on container restart, which was causing the following error: ``` RuntimeException: E_MISSING_APP_KEY: Make sure to define appKey inside config/app.js file before using Encryption provider > More details: https://err.sh/adonisjs/errors/E_MISSING_APP_KEY RuntimeException: E_MISSING_APP_KEY: Make sure to define appKey inside config/app.js file before using Encryption provider > More details: https://err.sh/adonisjs/errors/E_MISSING_APP_KEY at Function.missingAppKey (/app/node_modules/@adonisjs/generic-exceptions/src/RuntimeException.js:54:12) at new Encryption (/app/node_modules/@adonisjs/framework/src/Encryption/index.js:33:33) at Object.closure (/app/node_modules/@adonisjs/framework/providers/AppProvider.js:257:14) at Ioc._resolveBinding (/app/node_modules/@adonisjs/fold/src/Ioc/index.js:231:68) at Ioc.make (/app/node_modules/@adonisjs/fold/src/Ioc/index.js:807:19) at /app/node_modules/@adonisjs/fold/src/Ioc/index.js:318:19 at Array.map () at Ioc._makeInstanceOf (/app/node_modules/@adonisjs/fold/src/Ioc/index.js:317:44) at Ioc.make (/app/node_modules/@adonisjs/fold/src/Ioc/index.js:799:19) at AuthManager.getScheme (/app/node_modules/@adonisjs/auth/src/Auth/Manager.js:86:16) at Auth.authenticator (/app/node_modules/@adonisjs/auth/src/Auth/index.js:118:40) at new Auth (/app/node_modules/@adonisjs/auth/src/Auth/index.js:68:39) at Context. (/app/node_modules/@adonisjs/auth/providers/AuthProvider.js:151:14) at Context.wrappedCallback [as auth] (/app/node_modules/macroable/index.js:132:61) at Server._handleException (/app/node_modules/@adonisjs/framework/src/Server/index.js:253:63) at /app/node_modules/@adonisjs/framework/src/Server/index.js:441:14 ``` --- docker/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 0679530..2d1fd89 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -18,7 +18,7 @@ EOL if [[ -f "${DATA_DIR}/FERDI_APP_KEY.txt" ]]; then echo " " echo "**** App Key found ****" - APP_KEY=$(echo "${APP_KEY}") + APP_KEY=$(cat /data/FERDI_APP_KEY.txt) echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" elif [[ -z "${APP_KEY}" ]]; then echo "**** Generating Ferdi-server app key for first run ****" -- cgit v1.2.3-54-g00ecf From d3ad6f43b9e15df91020576a042621089db2ca2f Mon Sep 17 00:00:00 2001 From: thursday Date: Thu, 16 Sep 2021 17:32:28 -0400 Subject: Update entrypoint.sh --- docker/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 2d1fd89..abd0ed3 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -18,7 +18,7 @@ EOL if [[ -f "${DATA_DIR}/FERDI_APP_KEY.txt" ]]; then echo " " echo "**** App Key found ****" - APP_KEY=$(cat /data/FERDI_APP_KEY.txt) + APP_KEY=$(cat "${DATA_DIR}/FERDI_APP_KEY.txt") echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" elif [[ -z "${APP_KEY}" ]]; then echo "**** Generating Ferdi-server app key for first run ****" -- cgit v1.2.3-54-g00ecf From 1122af152e71d4d353ff8de36807f8f8d1393244 Mon Sep 17 00:00:00 2001 From: thursday Date: Fri, 17 Sep 2021 08:28:46 +0000 Subject: Fixed shebang and simplfied if statement. --- docker/entrypoint.sh | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index abd0ed3..2a91839 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -1,6 +1,6 @@ -#!/bin/sh +#!/bin/bash -echo << EOL +cat << EOL ------------------------------------- ____ ___ / __/__ _______/ (_) @@ -15,23 +15,20 @@ https://opencollective.com/getferdi/ EOL # Create APP key if needed -if [[ -f "${DATA_DIR}/FERDI_APP_KEY.txt" ]]; then - echo " " - echo "**** App Key found ****" - APP_KEY=$(cat "${DATA_DIR}/FERDI_APP_KEY.txt") - echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" -elif [[ -z "${APP_KEY}" ]]; then +if [[ -z ${APP_KEY} && ! -f "${DATA_DIR}/FERDI_APP_KEY.txt" ]]; then echo "**** Generating Ferdi-server app key for first run ****" adonis key:generate APP_KEY=$(grep APP_KEY .env | cut -d '=' -f2) echo "${APP_KEY}" > "${DATA_DIR}/FERDI_APP_KEY.txt" echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" +else APP_KEY=$(cat "${DATA_DIR}/FERDI_APP_KEY.txt") + echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" fi export APP_KEY node ace migration:run --force -chown -R ${PUID:-1000}:${PGID:-1000} $DATA_DIR /app +chown -R "${PUID:-1000}":"${PGID:-1000}" "$DATA_DIR" /app -su-exec ${PUID:-1000}:${PGID:-1000} node server.js +su-exec "${PUID:-1000}":"${PGID:-1000}" node server.js#!/bin/bash -- cgit v1.2.3-54-g00ecf From 7a73d967e9c99cd953689869f99c12566d316b57 Mon Sep 17 00:00:00 2001 From: thursday Date: Fri, 17 Sep 2021 08:42:07 +0000 Subject: Fixed NGINX config example indentation. --- docker/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docker/README.md b/docker/README.md index 3d8bd5f..33e78c0 100644 --- a/docker/README.md +++ b/docker/README.md @@ -161,15 +161,15 @@ server { listen 443 ssl http2; server_name ferdi.my.website; - # all ssl related config moved to ssl.conf + # all ssl related config moved to ssl.conf include /config/nginx/ssl.conf; location / { - proxy_pass http://:3333; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $host; - proxy_set_header X-Forwarded-Proto $scheme; + proxy_pass http://:3333; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-Proto $scheme; } } ``` -- cgit v1.2.3-54-g00ecf