Skip to content

Commit cf57a0d

Browse files
authored
Prepare for container version-3Variables (#133)
* Prepare for container version-3 - Review documentation - Stop setting config.php for librebooking >= v4 - Stop disabling captcha by default
1 parent 97fa449 commit cf57a0d

4 files changed

Lines changed: 133 additions & 157 deletions

File tree

BUILD.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ This is the easiest and fastest way.
3333

3434
```sh
3535
# Set the application release (ex: develop or v4.0.0)
36-
LB_RELEASE=develop
37-
if [ "${LB_RELEASE}" == "develop" ]; then
38-
APP_GH_REF="refs/heads/${LB_RELEASE}"
36+
APP_RELEASE=develop
37+
if [ "${APP_RELEASE}" == "develop" ]; then
38+
APP_GH_REF="refs/heads/${APP_RELEASE}"
3939
else
40-
APP_GH_REF="refs/tags/${LB_RELEASE}"
40+
APP_GH_REF="refs/tags/${APP_RELEASE}"
4141
fi
4242

4343
# Build the docker image
4444
docker buildx build \
4545
--build-arg APP_GH_REF=${APP_GH_REF} \
46-
--tag librebooking/librebooking:$(echo ${LB_RELEASE} | sed -e "s/^v//") \
46+
--tag librebooking/librebooking:$(echo ${APP_RELEASE} | sed -e "s/^v//") \
4747
--output type=docker \
4848
.
4949
```

RUN.md

Lines changed: 91 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
11
# Run the docker container
22

33
The image contains the apache web server and the librebooking application files.
4-
It needs to be linked to a MariaDB database container.
4+
It needs to be linked to a running MariaDB database container.
55

66
## Environment variables
77

8-
The following environment variables are used when the file `/config/config.php`
9-
**does not exist**:
8+
From version-3, this docker image makes full usage of the
9+
[environment variables override](https://github.com/LibreBooking/app/blob/develop/docs/source/BASIC-CONFIGURATION.rst).
1010

11-
| Env | Default | Example | Required | config.php settings |
12-
| - | - | - | - | - |
13-
| `LB_DB_NAME` | - | librebooking | **Yes** | `['settings']['database']['name']` |
14-
| `LB_DB_USER` | - | lb_user | **Yes** | `['settings']['database']['user']` |
15-
| `LB_DB_USER_PWD` | - | myPassw0rd | **Yes** | `['settings']['database']['password']` |
16-
| `LB_ENV` | production | devel | **No** | `['settings']['log']['level']` |
11+
### Required variables
1712

18-
The following environment variables are **always** used:
13+
| Variable | Defaults | Description |
14+
| -------- | -------- | ----------- |
15+
| LB_DATABASE_NAME | | Database name |
16+
| LB_DATABASE_USER | | Database user |
17+
| LB_DATABASE_PASSWORD | | Database password |
18+
| LB_DATABASE_HOSTSPEC | | Database network address |
19+
| LB_INSTALL_PASSWORD | | Librebooking installation password |
20+
| LB_DEFAULT_TIMEZONE | | Timezone |
21+
| LB_LOGGING_FOLDER | `/var/log/librebooking` | Logs folder |
22+
| LB_LOGGING_LEVEL | `none` | Logging level |
23+
| LB_LOGGING_SQL | `false` | SQL logging |
1924

20-
| Env | Default | Example | Required | config.php settings |
21-
| - | - | - | - | - |
22-
| `LB_DB_HOST` | - | lb-db | **Yes** | `['settings']['database']['hostspec']` |
23-
| `LB_INSTALL_PWD` | - | installPWD | **Yes** | `['settings']['install.password']` |
24-
| `TZ` | - | Europe/Zurich | **Yes** | `['settings']['default.timezone']` |
25-
| `LB_LOG_FOLDER` | /var/log/librebooking | | **No** | `['settings']['logging']['folder']` |
26-
| `LB_LOG_LEVEL` | none | debug | **No** | `['settings']['logging']['level']` |
27-
| `LB_LOG_SQL` | false | true | **No** | `['settings']['logging']['sql']` |
28-
| `LB_PATH` | - | book | **No** | N/A - URL path prefix (usually none) |
25+
### Optional variables
26+
27+
| Variable | Description |
28+
| -------- | ----------- |
29+
| APP_PATH | URL path |
2930

3031
## Optional mounts
3132

@@ -63,9 +64,9 @@ where the:
6364
php -f /var/www/html/Jobs/sendreminders.php`
6465
```
6566

66-
Based on the value of the environment variable `LB_LOG_LEVEL`, the
67+
Based on the value of the environment variable `LB_LOGGING_LEVEL`, the
6768
background jobs will output to the `app.log` file inside the log
68-
folder defined by the environment variable `LB_LOG_FOLDER`.
69+
folder defined by the environment variable `LB_LOGGING_FOLDER`.
6970

7071
## Examples of running librebooking
7172

@@ -103,16 +104,15 @@ This example is meant for testing the application within your private network.
103104
--network mynet \
104105
--publish 80:80 \
105106
--volume librebooking-conf:/config \
106-
--env LB_DB_NAME=librebooking \
107-
--env LB_DB_USER=lb_user \
108-
--env LB_DB_USER_PWD=db_user_pwd \
109-
--env LB_DB_HOST=librebooking-db \
110-
--env LB_INSTALL_PWD=app_install_pwd \
111-
--env LB_ENV=dev \
112-
--env LB_LOG_FOLDER=/var/log/librebooking \
113-
--env LB_LOG_LEVEL=DEBUG \
114-
--env LB_LOG_SQL=false \
115-
--env TZ=Europe/Zurich \
107+
--env LB_DATABASE_NAME=librebooking \
108+
--env LB_DATABASE_USER=lb_user \
109+
--env LB_DATABASE_PASSWORD=db_user_pwd \
110+
--env LB_DATABASE_HOSTSPEC=librebooking-db \
111+
--env LB_INSTALL_PASSWORD=app_install_pwd \
112+
--env LB_LOGGING_FOLDER=/var/log/librebooking \
113+
--env LB_LOGGING_LEVEL=DEBUG \
114+
--env LB_LOGGING_SQL=false \
115+
--env LB_DEFAULT_TIMEZONE=Europe/Zurich \
116116
librebooking/librebooking:develop
117117
```
118118

@@ -124,15 +124,14 @@ This example is meant for testing the application within your private network.
124124
--detach \
125125
--network mynet \
126126
--volume librebooking-conf:/config \
127-
--env LB_DB_NAME=librebooking \
128-
--env LB_DB_USER=lb_user \
129-
--env LB_DB_USER_PWD=db_user_pwd \
130-
--env LB_DB_HOST=librebooking-db \
131-
--env LB_ENV=dev \
132-
--env LB_LOG_FOLDER=/var/log/librebooking \
133-
--env LB_LOG_LEVEL=DEBUG \
134-
--env LB_LOG_SQL=false \
135-
--env TZ=Europe/Zurich \
127+
--env LB_DATABASE_NAME=librebooking \
128+
--env LB_DATABASE_USER=lb_user \
129+
--env LB_DATABASE_PASSWORD=db_user_pwd \
130+
--env LB_DATABASE_HOSTSPEC=librebooking-db \
131+
--env LB_LOGGING_FOLDER=/var/log/librebooking \
132+
--env LB_LOGGING_LEVEL=DEBUG \
133+
--env LB_LOGGING_SQL=false \
134+
--env LB_DEFAULT_TIMEZONE=Europe/Zurich \
136135
librebooking/librebooking:develop
137136
```
138137

@@ -167,16 +166,15 @@ value of the environment variables to your needs:
167166
volumes:
168167
- app_conf:/config
169168
environment:
170-
- LB_DB_NAME=librebooking
171-
- LB_DB_USER=lb_user
172-
- LB_DB_USER_PWD=db_user_pwd
173-
- LB_DB_HOST=db
174-
- LB_INSTALL_PWD=app_install_pwd
175-
- LB_ENV=dev
176-
- LB_LOG_FOLDER=/var/log/librebooking
177-
- LB_LOG_LEVEL=DEBUG
178-
- LB_LOG_SQL=false
179-
- TZ=Europe/Zurich
169+
- LB_DATABASE_NAME=librebooking
170+
- LB_DATABASE_USER=lb_user
171+
- LB_DATABASE_PASSWORD=db_user_pwd
172+
- LB_DATABASE_HOSTSPEC=db
173+
- LB_INSTALL_PASSWORD=app_install_pwd
174+
- LB_LOGGING_FOLDER=/var/log/librebooking
175+
- LB_LOGGING_LEVEL=DEBUG
176+
- LB_LOGGING_SQL=false
177+
- LB_DEFAULT_TIMEZONE=Europe/Zurich
180178
jobs:
181179
image: librebooking/librebooking:develop
182180
restart: always
@@ -187,15 +185,14 @@ value of the environment variables to your needs:
187185
volumes:
188186
- app_conf:/config
189187
environment:
190-
- LB_DB_NAME=librebooking
191-
- LB_DB_USER=lb_user
192-
- LB_DB_USER_PWD=db_user_pwd
193-
- LB_DB_HOST=db
194-
- LB_ENV=dev
195-
- LB_LOG_FOLDER=/var/log/librebooking
196-
- LB_LOG_LEVEL=DEBUG
197-
- LB_LOG_SQL=false
198-
- TZ=Europe/Zurich
188+
- LB_DATABASE_NAME=librebooking
189+
- LB_DATABASE_USER=lb_user
190+
- LB_DATABASE_PASSWORD=db_user_pwd
191+
- LB_DATABASE_HOSTSPEC=db
192+
- LB_LOGGING_FOLDER=/var/log/librebooking
193+
- LB_LOGGING_LEVEL=DEBUG
194+
- LB_LOGGING_SQL=false
195+
- LB_DEFAULT_TIMEZONE=Europe/Zurich
199196
200197
volumes:
201198
db_conf:
@@ -272,17 +269,16 @@ the value of the environment variables to your needs:
272269
volumes:
273270
- lb1_conf:/config
274271
environment:
275-
- LB_DB_NAME=lb1
276-
- LB_INSTALL_PWD_FILE=/run/secrets/lb_install_pwd
277-
- LB_DB_USER=lb1
278-
- LB_DB_USER_PWD_FILE=/run/secrets/lb_user_pwd
279-
- LB_DB_HOST=db
280-
- LB_ENV=production
281-
- LB_LOG_FOLDER=/var/log/librebooking
282-
- LB_LOG_LEVEL=ERROR
283-
- LB_LOG_SQL=false
284-
- LB_PATH=book
285-
- TZ=Europe/Zurich
272+
- APP_PATH=book
273+
- LB_DATABASE_NAME=lb1
274+
- LB_INSTALL_PASSWORD_FILE=/run/secrets/lb_install_pwd
275+
- LB_DATABASE_USER=lb1
276+
- LB_DATABASE_PASSWORD_FILE=/run/secrets/lb_user_pwd
277+
- LB_DATABASE_HOSTSPEC=db
278+
- LB_LOGGING_FOLDER=/var/log/librebooking
279+
- LB_LOGGING_LEVEL=ERROR
280+
- LB_LOGGING_SQL=false
281+
- LB_DEFAULT_TIMEZONE=Europe/Zurich
286282
- VIRTUAL_HOST=acme.org
287283
- VIRTUAL_PATH=/book
288284
- LETSENCRYPT_HOST=acme.org
@@ -299,14 +295,14 @@ the value of the environment variables to your needs:
299295
volumes:
300296
- lb1_conf:/config
301297
environment:
302-
- LB_DB_NAME=lb1
303-
- LB_DB_USER=lb1
304-
- LB_DB_USER_PWD_FILE=/run/secrets/lb_user_pwd
305-
- LB_DB_HOST=db
306-
- LB_LOG_FOLDER=/var/log/librebooking
307-
- LB_LOG_LEVEL=ERROR
308-
- LB_LOG_SQL=false
309-
- TZ=Europe/Zurich
298+
- LB_DATABASE_NAME=lb1
299+
- LB_DATABASE_USER=lb1
300+
- LB_DATABASE_PASSWORD_FILE=/run/secrets/lb_user_pwd
301+
- LB_DATABASE_HOSTSPEC=db
302+
- LB_LOGGING_FOLDER=/var/log/librebooking
303+
- LB_LOGGING_LEVEL=ERROR
304+
- LB_LOGGING_SQL=false
305+
- LB_DEFAULT_TIMEZONE=Europe/Zurich
310306
secrets:
311307
- lb_user_pwd
312308
lb2:
@@ -319,16 +315,15 @@ the value of the environment variables to your needs:
319315
- ./uploads/images:/var/www/html/Web/uploads/images
320316
- ./uploads/reservation:/var/www/html/Web/uploads/reservation
321317
environment:
322-
- LB_DB_NAME=lb2
323-
- LB_INSTALL_PWD_FILE=/run/secrets/lb_install_pwd
324-
- LB_DB_USER=lb2
325-
- LB_DB_USER_PWD_FILE=/run/secrets/lb_user_pwd
326-
- LB_DB_HOST=db
327-
- LB_ENV=production
328-
- LB_LOG_FOLDER=/var/log/librebooking
329-
- LB_LOG_LEVEL=ERROR
330-
- LB_LOG_SQL=false
331-
- TZ=Europe/Zurich
318+
- LB_DATABASE_NAME=lb2
319+
- LB_INSTALL_PASSWORD_FILE=/run/secrets/lb_install_pwd
320+
- LB_DATABASE_USER=lb2
321+
- LB_DATABASE_PASSWORD_FILE=/run/secrets/lb_user_pwd
322+
- LB_DATABASE_HOSTSPEC=db
323+
- LB_LOGGING_FOLDER=/var/log/librebooking
324+
- LB_LOGGING_LEVEL=ERROR
325+
- LB_LOGGING_SQL=false
326+
- LB_DEFAULT_TIMEZONE=Europe/Zurich
332327
- VIRTUAL_HOST=acme.org
333328
- LETSENCRYPT_HOST=acme.org
334329
secrets:
@@ -344,14 +339,14 @@ the value of the environment variables to your needs:
344339
volumes:
345340
- lb2_conf:/config
346341
environment:
347-
- LB_DB_NAME=lb2
348-
- LB_DB_USER=lb2
349-
- LB_DB_USER_PWD_FILE=/run/secrets/lb_user_pwd
350-
- LB_DB_HOST=db
351-
- LB_LOG_FOLDER=/var/log/librebooking
352-
- LB_LOG_LEVEL=ERROR
353-
- LB_LOG_SQL=false
354-
- TZ=Europe/Zurich
342+
- LB_DATABASE_NAME=lb2
343+
- LB_DATABASE_USER=lb2
344+
- LB_DATABASE_PASSWORD_FILE=/run/secrets/lb_user_pwd
345+
- LB_DATABASE_HOSTSPEC=db
346+
- LB_LOGGING_FOLDER=/var/log/librebooking
347+
- LB_LOGGING_LEVEL=ERROR
348+
- LB_LOGGING_SQL=false
349+
- LB_DEFAULT_TIMEZONE=Europe/Zurich
355350
secrets:
356351
- lb_user_pwd
357352

bin/cron.sh

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
set -eu
33

44
# Constants
5-
readonly DFT_LOG_FLR="/var/log/librebooking"
6-
readonly DFT_LOG_LEVEL="none"
7-
readonly DFT_LOG_SQL=false
8-
readonly DFT_LB_ENV="production"
9-
readonly DFT_LB_PATH=""
5+
readonly DFT_LOGGING_FLR="/var/log/librebooking"
6+
readonly DFT_LOGGING_LEVEL="none"
7+
readonly DFT_LOGGING_SQL=false
8+
readonly DFT_APP_PATH=""
109

1110
file_env() {
1211
local var="$1"
@@ -31,17 +30,16 @@ file_env() {
3130
# Initialize variables
3231
file_env LB_DB_USER_PWD
3332

34-
LB_LOG_FOLDER=${LB_LOG_FOLDER:-${DFT_LOG_FLR}}
35-
LB_LOG_LEVEL=${LB_LOG_LEVEL:-${DFT_LOG_LEVEL}}
36-
LB_LOG_SQL=${LB_LOG_SQL:-${DFT_LOG_SQL}}
37-
LB_ENV=${LB_ENV:-${DFT_LB_ENV}}
38-
LB_PATH=${LB_PATH:-${DFT_LB_PATH}}
33+
LB_LOGGING_FOLDER=${LB_LOGGING_FOLDER:-${DFT_LOGGING_FLR}}
34+
LB_LOGGING_LEVEL=${LB_LOGGING_LEVEL:-${DFT_LOGGING_LEVEL}}
35+
LB_LOGGING_SQL=${LB_LOGGING_SQL:-${DFT_LOGGING_SQL}}
36+
APP_PATH=${APP_PATH:-${DFT_APP_PATH}}
3937

4038
# Set the php timezone file
41-
if [ -f /usr/share/zoneinfo/${TZ} ]; then
39+
if [ -f /usr/share/zoneinfo/${LB_DEFAULT_TIMEZONE} ]; then
4240
INI_FILE="/usr/local/etc/php/conf.d/librebooking.ini"
4341
echo "[Date]" >> ${INI_FILE}
44-
echo "date.timezone=\"${TZ}\"" >> ${INI_FILE}
42+
echo "date.timezone=\"${LB_DEFAULT_TIMEZONE}\"" >> ${INI_FILE}
4543
fi
4644

4745
# Link the configuration file

0 commit comments

Comments
 (0)