diff options
-rw-r--r-- | .env.example | 2 | ||||
-rw-r--r-- | docker/README.md | 5 | ||||
-rwxr-xr-x | docker/entrypoint.sh | 15 |
3 files changed, 18 insertions, 4 deletions
diff --git a/.env.example b/.env.example index d507d6c..b11a2cc 100644 --- a/.env.example +++ b/.env.example | |||
@@ -10,7 +10,7 @@ CACHE_VIEWS=false | |||
10 | 10 | ||
11 | APP_KEY= | 11 | APP_KEY= |
12 | 12 | ||
13 | DATA_DIR=data | 13 | DATA_DIR=database |
14 | 14 | ||
15 | DB_CONNECTION=sqlite | 15 | DB_CONNECTION=sqlite |
16 | DB_HOST=127.0.0.1 | 16 | 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/) | |||
76 | ## Configuration | 76 | ## Configuration |
77 | 77 | ||
78 | Container 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. | 78 | Container 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. |
79 | After the first run, Ferdi-server's configuration is saved inside the `config.txt` file inside your persistent data directory (`/config` in the container). | 79 | 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). |
80 | 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. | ||
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: | |||
14 | https://opencollective.com/getferdi/ | 14 | https://opencollective.com/getferdi/ |
15 | EOL | 15 | EOL |
16 | 16 | ||
17 | # if config.txt doesn't exist then create one with default values | ||
18 | if [ ! -f /config/config.txt ]; then | ||
19 | cp /app/.env.example /config/config.txt | ||
20 | fi | ||
21 | |||
22 | # use config.txt default values as .env file | ||
23 | if [ -f /app/.env ]; then | ||
24 | rm /app/.env | ||
25 | ln -s /config/config.txt /app/.env | ||
26 | elif [ ! -f /app/.env ]; then | ||
27 | ln -s /config/config.txt /app/.env | ||
28 | fi | ||
29 | |||
17 | # Create APP key if needed | 30 | # Create APP key if needed |
18 | if [ ! -f "/config/FERDI_APP_KEY.txt" ]; | 31 | if [ ! -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 |