inventaire service: use a custom entrypoint script
to initialize the local config from env variables
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,3 @@
|
|||||||
inventaire
|
|
||||||
.env
|
.env
|
||||||
data
|
data
|
||||||
log
|
log
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
inventaire:
|
inventaire:
|
||||||
image: inventaire:latest
|
image: inventaire/inventaire:latest
|
||||||
volumes:
|
|
||||||
- ./inventaire:/opt/inventaire
|
|
||||||
env_file: .env
|
env_file: .env
|
||||||
depends_on:
|
depends_on:
|
||||||
- couchdb
|
- couchdb
|
||||||
|
|||||||
13
dotenv
13
dotenv
@@ -6,12 +6,21 @@ PROJECT_ROOT=/opt/inventaire
|
|||||||
|
|
||||||
# Generic user, to modify only for good reason
|
# Generic user, to modify only for good reason
|
||||||
COUCHDB_USER=couchdb
|
COUCHDB_USER=couchdb
|
||||||
|
|
||||||
# Consider passwords with no less than 32 charracters, for example:
|
# Consider passwords with no less than 32 charracters, for example:
|
||||||
# cat /dev/urandom | tr -dc A-Za-z0-9-_ | head -c 32
|
# cat /dev/urandom | tr -dc A-Za-z0-9-_ | head -c 32
|
||||||
COUCHDB_PASSWORD=your_password
|
COUCHDB_PASSWORD=your_password
|
||||||
|
|
||||||
NODE_ENV=production
|
NODE_ENV=production
|
||||||
NODE_APP_INSTANCE=federated
|
NODE_APP_INSTANCE=federated
|
||||||
# Matching the port defined in inventaire/config/production-federated.cjs
|
|
||||||
|
# Conventional port for Inventaire server in federated mode
|
||||||
INVENTAIRE_PORT=3016
|
INVENTAIRE_PORT=3016
|
||||||
|
|
||||||
|
INSTANCE_NAME='My Inventaire Instance'
|
||||||
|
|
||||||
|
# Will be displayed on landing screen
|
||||||
|
ORG_NAME='Example Organization'
|
||||||
|
ORG_URL='https://inventaire.example.org'
|
||||||
|
|
||||||
|
# Users receiving emails from the instance can reply to this
|
||||||
|
CONTACT_ADDRESS='contact@inventaire.example.org'
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ RUN npm ci \
|
|||||||
|
|
||||||
WORKDIR /opt/inventaire
|
WORKDIR /opt/inventaire
|
||||||
|
|
||||||
|
COPY docker-entrypoint.sh docker-entrypoint.sh
|
||||||
|
|
||||||
# Avoid using npm script to start the server
|
# Avoid using npm script to start the server
|
||||||
# See https://adambrodziak.pl/dockerfile-good-practices-for-node-and-npm#heading-use-node-not-npm-to-start-the-server
|
# See https://adambrodziak.pl/dockerfile-good-practices-for-node-and-npm#heading-use-node-not-npm-to-start-the-server
|
||||||
CMD [ "./scripts/typescript/start_built_server.sh" ]
|
ENTRYPOINT [ "./docker-entrypoint.sh" ]
|
||||||
26
inventaire/docker-entrypoint.sh
Executable file
26
inventaire/docker-entrypoint.sh
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# Overwrite the local config with environment variables every time the container is restarted
|
||||||
|
cat > ./config/local.cjs << EOF
|
||||||
|
module.exports = {
|
||||||
|
port: '${INVENTAIRE_PORT}',
|
||||||
|
publicHostname: '${PUBLIC_HOSTNAME}',
|
||||||
|
instanceName: '${INSTANCE_NAME}',
|
||||||
|
orgName: '${ORG_NAME}',
|
||||||
|
orgUrl: '${ORG_URL}',
|
||||||
|
contactAddress: '${CONTACT_ADDRESS}',
|
||||||
|
|
||||||
|
db: {
|
||||||
|
username: '${COUCHDB_USER}',
|
||||||
|
password: '${COUCHDB_PASSWORD}',
|
||||||
|
hostname: 'couchdb',
|
||||||
|
},
|
||||||
|
elasticsearch: {
|
||||||
|
origin: 'http://elasticsearch:9200',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
./scripts/typescript/start_built_server.sh
|
||||||
Reference in New Issue
Block a user