diff options
author | Michal Kostewicz <m.kostewicz84@gmail.com> | 2021-02-07 12:43:41 +0100 |
---|---|---|
committer | Michal Kostewicz <m.kostewicz84@gmail.com> | 2021-02-07 12:43:41 +0100 |
commit | 7329a7fd852082f0216b4f67f1912eaa601981fc (patch) | |
tree | 1209c90933e646dbbfa1bbc706eb6ec48d5d5050 /docker/entrypoint.sh | |
parent | Modifying Dockerfile so that it can use the current application code to build... (diff) | |
download | ferdium-server-7329a7fd852082f0216b4f67f1912eaa601981fc.tar.gz ferdium-server-7329a7fd852082f0216b4f67f1912eaa601981fc.tar.zst ferdium-server-7329a7fd852082f0216b4f67f1912eaa601981fc.zip |
Add new configuration for docker with small script to generate or use APP_KEY. docker-compose was adjusted to use DATA_DIR.
Diffstat (limited to 'docker/entrypoint.sh')
-rwxr-xr-x | docker/entrypoint.sh | 40 |
1 files changed, 40 insertions, 0 deletions
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 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | echo << EOL | ||
4 | ------------------------------------- | ||
5 | ____ ___ | ||
6 | / __/__ _______/ (_) | ||
7 | / _// -_) __/ _ / / | ||
8 | _/_/ \__/_/ \_,_/_/ | ||
9 | / __/__ _____ _____ ____ | ||
10 | _\ \/ -_) __/ |/ / -_) __/ | ||
11 | /___/\__/_/ |___/\__/_/ | ||
12 | Brought to you by getferdi.com | ||
13 | Support our Open Collective at: | ||
14 | https://opencollective.com/getferdi/ | ||
15 | EOL | ||
16 | |||
17 | # Create APP key if needed | ||
18 | if [ ! -f "/config/FERDI_APP_KEY.txt" ]; | ||
19 | then | ||
20 | echo " " | ||
21 | echo "**** Generating Ferdi-server app key for first run ****" | ||
22 | adonis key:generate | ||
23 | source .env | ||
24 | 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 ****" | ||
26 | sed -i "s/APP_KEY=/APP_KEY=$APP_KEY/g" /config/config.txt | ||
27 | elif [ -f "/config/FERDI_APP_KEY.txt" ]; | ||
28 | then | ||
29 | echo " " | ||
30 | echo "**** App Key found ****" | ||
31 | APP_KEY=$(cat /config/FERDI_APP_KEY.txt) | ||
32 | sed -i "s/APP_KEY=.*/APP_KEY=$APP_KEY/g" /config/config.txt | ||
33 | echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" | ||
34 | fi | ||
35 | |||
36 | export APP_KEY=$APP_KEY | ||
37 | |||
38 | node ace migration:run --force | ||
39 | |||
40 | exec node server.js | ||