aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Michal Kostewicz <m.kostewicz84@gmail.com>2021-02-07 16:26:58 +0100
committerLibravatar Michal Kostewicz <m.kostewicz84@gmail.com>2021-02-07 16:26:58 +0100
commitbbd2132feede2d8c5e214c4d8a436f5505b9a766 (patch)
treee92dce863e9a573e2160da570c75178af687ed93
parentRevert line which choose DB folder using env. Move Dockerfile to root. Simpli... (diff)
downloadferdium-server-bbd2132feede2d8c5e214c4d8a436f5505b9a766.tar.gz
ferdium-server-bbd2132feede2d8c5e214c4d8a436f5505b9a766.tar.zst
ferdium-server-bbd2132feede2d8c5e214c4d8a436f5505b9a766.zip
Add script which will use config.txt if exist
-rw-r--r--.env.example2
-rw-r--r--docker/README.md5
-rwxr-xr-xdocker/entrypoint.sh15
3 files changed, 18 insertions, 4 deletions
diff --git a/.env.example b/.env.example
index d507d6c..b11a2cc 100644
--- a/.env.example
+++ b/.env.example
@@ -10,7 +10,7 @@ CACHE_VIEWS=false
10 10
11APP_KEY= 11APP_KEY=
12 12
13DATA_DIR=data 13DATA_DIR=database
14 14
15DB_CONNECTION=sqlite 15DB_CONNECTION=sqlite
16DB_HOST=127.0.0.1 16DB_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/)
76## Configuration 76## Configuration
77 77
78Container images are configured using parameters passed at runtime (such as those above). These parameters are separated by a colon and indicate `<external>:<internal>` 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. 78Container images are configured using parameters passed at runtime (such as those above). These parameters are separated by a colon and indicate `<external>:<internal>` 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.
79After the first run, Ferdi-server's configuration is saved inside the `config.txt` file inside your persistent data directory (`/config` in the container). 79After the first run, Ferdi-server's default configuration is saved inside the `config.txt` file inside your persistent data directory (`/config` in the container).
80If 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.
80 81
81| Parameter | Function | 82| Parameter | Function |
82| :----: | --- | 83| :----: | --- |
83| `-p <port>:80` | will map the container's port 80 to a port on the host, default is 3333 | 84| `-p <port>:3333` | will map the container's port 80 to a port on the host, default is 3333 |
84| `-e NODE_ENV=development` | for specifying Node environment, production or development, default is development | 85| `-e NODE_ENV=development` | for specifying Node environment, production or development, default is development |
85| `-e EXTERNAL_DOMAIN=<ferdi-serverdomain>` | for specifying external domain address of the ferdi server | 86| `-e EXTERNAL_DOMAIN=<ferdi-serverdomain>` | for specifying external domain address of the ferdi server |
86| `-e DB_CONNECTION=sqlite` | for specifying the database being used, default is sqlite | 87| `-e DB_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:
14https://opencollective.com/getferdi/ 14https://opencollective.com/getferdi/
15EOL 15EOL
16 16
17# if config.txt doesn't exist then create one with default values
18if [ ! -f /config/config.txt ]; then
19 cp /app/.env.example /config/config.txt
20fi
21
22# use config.txt default values as .env file
23if [ -f /app/.env ]; then
24 rm /app/.env
25 ln -s /config/config.txt /app/.env
26elif [ ! -f /app/.env ]; then
27 ln -s /config/config.txt /app/.env
28fi
29
17# Create APP key if needed 30# Create APP key if needed
18if [ ! -f "/config/FERDI_APP_KEY.txt" ]; 31if [ ! -f "/config/FERDI_APP_KEY.txt" ];
19 then 32 then
20 echo " " 33 echo " "
21 echo "**** Generating Ferdi-server app key for first run ****" 34 echo "**** Generating Ferdi-server app key for first run ****"
22 adonis key:generate 35 adonis key:generate
23 source .env 36 APP_KEY=$(grep APP_KEY .env | cut -d '=' -f2)
24 echo $APP_KEY > /config/FERDI_APP_KEY.txt 37 echo $APP_KEY > /config/FERDI_APP_KEY.txt
25 echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" 38 echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****"
26 sed -i "s/APP_KEY=/APP_KEY=$APP_KEY/g" /config/config.txt 39 sed -i "s/APP_KEY=/APP_KEY=$APP_KEY/g" /config/config.txt