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. --- 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 ++ 11 files changed, 669 insertions(+) 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 (limited to 'docker') 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-70-g09d2 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 (limited to 'docker') 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-70-g09d2 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 (limited to 'docker') 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-70-g09d2 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 (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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 (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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: 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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(-) (limited to 'docker') 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-70-g09d2 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 (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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 (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2 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(+) (limited to 'docker') 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-70-g09d2 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(-) (limited to 'docker') 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-70-g09d2