Skip to content

Commit 8aafb41

Browse files
authored
Merge pull request #9 from linuxserver/pre-release
Modifications to make container release ready
2 parents be6118e + 8ff6a1b commit 8aafb41

File tree

8 files changed

+115
-24
lines changed

8 files changed

+115
-24
lines changed

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM lsiobase/alpine.nginx:3.7
1+
FROM lsiobase/alpine.nginx:3.8
22

33
# set version label
44
ARG BUILD_DATE
@@ -41,7 +41,6 @@ RUN \
4141
tar xf \
4242
/tmp/bookstack.tar.gz -C \
4343
/var/www/html/ --strip-components=1 && \
44-
cp /var/www/html/.env.example /var/www/html/.env && \
4544
echo "**** install composer ****" && \
4645
cd /tmp && \
4746
curl -sS https://getcomposer.org/installer | php && \

Dockerfile.aarch64

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM lsiobase/alpine.nginx.arm64:3.7
1+
FROM lsiobase/alpine.nginx.arm64:3.8
22

33
# Add qemu to build on x86_64 systems
44
COPY qemu-aarch64-static /usr/bin
@@ -44,7 +44,6 @@ RUN \
4444
tar xf \
4545
/tmp/bookstack.tar.gz -C \
4646
/var/www/html/ --strip-components=1 && \
47-
cp /var/www/html/.env.example /var/www/html/.env && \
4847
echo "**** install composer ****" && \
4948
cd /tmp && \
5049
curl -sS https://getcomposer.org/installer | php && \

Dockerfile.armhf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM lsiobase/alpine.nginx.armhf:3.7
1+
FROM lsiobase/alpine.nginx.armhf:3.8
22

33
# Add qemu to build on x86_64 systems
44
COPY qemu-arm-static /usr/bin
@@ -44,7 +44,6 @@ RUN \
4444
tar xf \
4545
/tmp/bookstack.tar.gz -C \
4646
/var/www/html/ --strip-components=1 && \
47-
cp /var/www/html/.env.example /var/www/html/.env && \
4847
echo "**** install composer ****" && \
4948
cd /tmp && \
5049
curl -sS https://getcomposer.org/installer | php && \

Jenkinsfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,11 +415,11 @@ pipeline {
415415
sh "docker manifest push --purge ${IMAGE}:latest || :"
416416
sh "docker manifest create ${IMAGE}:latest ${IMAGE}:amd64-latest ${IMAGE}:arm32v6-latest ${IMAGE}:arm64v8-latest"
417417
sh "docker manifest annotate ${IMAGE}:latest ${IMAGE}:arm32v6-latest --os linux --arch arm"
418-
sh "docker manifest annotate ${IMAGE}:latest ${IMAGE}:arm64v8-latest --os linux --arch arm64 --variant armv8"
418+
sh "docker manifest annotate ${IMAGE}:latest ${IMAGE}:arm64v8-latest --os linux --arch arm64 --variant v8"
419419
sh "docker manifest push --purge ${IMAGE}:${EXT_RELEASE}-ls${LS_TAG_NUMBER} || :"
420420
sh "docker manifest create ${IMAGE}:${META_TAG} ${IMAGE}:amd64-${META_TAG} ${IMAGE}:arm32v6-${META_TAG} ${IMAGE}:arm64v8-${META_TAG}"
421421
sh "docker manifest annotate ${IMAGE}:${META_TAG} ${IMAGE}:arm32v6-${META_TAG} --os linux --arch arm"
422-
sh "docker manifest annotate ${IMAGE}:${META_TAG} ${IMAGE}:arm64v8-${META_TAG} --os linux --arch arm64 --variant armv8"
422+
sh "docker manifest annotate ${IMAGE}:${META_TAG} ${IMAGE}:arm64v8-${META_TAG} --os linux --arch arm64 --variant v8"
423423
sh "docker manifest push --purge ${IMAGE}:latest"
424424
sh "docker manifest push --purge ${IMAGE}:${META_TAG}"
425425
}
@@ -474,7 +474,7 @@ pipeline {
474474
-e DOCKERHUB_USERNAME=$DOCKERUSER \
475475
-e DOCKERHUB_PASSWORD=$DOCKERPASS \
476476
-e GIT_REPOSITORY=${LS_USER}/${LS_REPO} \
477-
-e DOCKER_REPOSITORY=${DOCKERHUB_IMAGE} \
477+
-e DOCKER_REPOSITORY=${IMAGE} \
478478
-e GIT_BRANCH=master \
479479
lsiodev/readme-sync bash -c 'node sync' '''
480480
}

docker-compose.advanced.yml.sample

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: '3'
2+
services:
3+
sql:
4+
container_name: bookstack_sql
5+
image: linuxserver/mariadb
6+
volumes:
7+
- ./data/sql:/config
8+
networks:
9+
- net
10+
environment:
11+
- PUID=setyourID
12+
- PGID=setyourGID
13+
- MYSQL_ROOT_PASSWORD=SetAPassword
14+
bookstack:
15+
container_name: bookstack
16+
image: linuxserver/bookstack
17+
volumes:
18+
- ./data/bookstack:/config
19+
environment:
20+
- ADVANCED_MODE=1
21+
- PUID=setyourID
22+
- PGID=setyourGID
23+
networks:
24+
- net
25+
networks:
26+
net:

docker-compose.basic.yml.sample

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version: '3'
2+
services:
3+
sql:
4+
container_name: bookstack_sql
5+
image: linuxserver/mariadb
6+
volumes:
7+
- ./data/sql:/config
8+
networks:
9+
- net
10+
environment:
11+
- PUID=setyourID
12+
- PGID=setyourGID
13+
- MYSQL_ROOT_PASSWORD=SetAPassword
14+
bookstack:
15+
container_name: bookstack
16+
image: linuxserver/bookstack
17+
volumes:
18+
- ./data/bookstack:/config
19+
environment:
20+
- DB_USER=bookstack
21+
- DB_PASS=SetAPassword
22+
- DB_DATABASE=bookstack
23+
- DB_HOST=bookstack_sql
24+
- "APP_URL=https://your.url.when.using.reverse.proxy"
25+
- PUID=setyourID
26+
- PGID=setyourGID
27+
networks:
28+
- net
29+
networks:
30+
net:

readme-vars.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ param_env_vars:
2929
- { env_var: "DB_USER", env_value: "<yourdbuser>", desc: "for specifying the database user" }
3030
- { env_var: "DB_PASS", env_value: "<yourdbpass>", desc: "for specifying the database password" }
3131
- { env_var: "DB_DATABASE", env_value: "bookstackapp", desc: "for specifying the database to be used" }
32+
- { env_var: "APPURL", env_value: "your.site.here.xyz", desc: "for specifying the url your application will be accessed on "}
33+
- { env_var: "ADVANCED_MODE", env_value: "1", desc: "enables advanced mode for direct editing of the .env - scroll down for details on this"}
3234

3335
param_usage_include_ports: true
3436
param_ports:
@@ -57,8 +59,23 @@ app_setup_block: |
5759
5860
Default username is admin@admin.com with password of **password**
5961
62+
If you intend to use this application behind a reverse proxy, such as our LetsEncrypt container or Traefik you will need to make sure that the `APPURL` environment variable is set, or it will not work
63+
6064
Documentation can be found at https://www.bookstackapp.com/docs/
6165
66+
### Advanced Mode
67+
We have implemented a special 'advanced mode' where users who wish to leverage the built in SMTP or LDAP functionality, will have the ability to edit the .env by hand. With `ADVANCED_MODE=1` set when
68+
the container is created, it will copy the .env.example to /config within the container. You can then edit this file on the host system (make sure you read the BookStack docs) and restart the
69+
container when finished. When the container starts, it copies /config/.env to /var/www/html/.env within the container for the web app to use. It will do this every time the container restarts.
70+
71+
Note, the APP_KEY is still set by PHP environment so you do not need to worrry about this.
72+
73+
### Composer
74+
75+
Some simple docker-compose files are included for you to get started with. You will still need to manually configure the SQL server, but the compose files will get the stack running for you.
76+
6277
# changelog
6378
changelogs:
79+
- { date: "08.10.18:", desc: "Advanced mode, symlink changes, sed fixing, docs updated, added some composer files"}
80+
- { date: "23.09.28:", desc: "Updates pre-release"}
6481
- { date: "02.07.18:", desc: "Initial Release." }

root/etc/cont-init.d/50-config

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,50 @@
11
#!/usr/bin/with-contenv bash
22

3-
# create our folders
3+
# create directory structure
44
mkdir -p \
5-
/config/storage \
6-
/config/uploads
5+
/config/www/{uploads,files,images}
76

8-
# make symlinks
9-
[[ ! -L /var/www/html/storage ]] && \
10-
ln -sf /config/storage /var/www/html/storage
11-
[[ ! -L /var/www/html/public/uploads ]] && \
12-
ln -sf /config/uploads /var/www/html/public/uploads
7+
# create symlinks
8+
symlinks=( \
9+
/var/www/html/storage/uploads/files \
10+
/var/www/html/storage/uploads/images \
11+
/var/www/html/public/uploads )
1312

1413
for i in "${symlinks[@]}"
1514
do
1615
[[ -e "$i" && ! -L "$i" ]] && rm -rf "$i"
1716
[[ ! -L "$i" ]] && ln -s /config/www/"$(basename "$i")" "$i"
1817
done
1918

19+
# Check for ADVANCED_MODE to be set. If set, copy sample env file to /config and then copy to /var/www/html.env so advanced users can make their own customisations
20+
# If not set, runs in basic mode where .example.env is copied to /var/www/html/.env and seds are applied to set documented variables
21+
if [ "$ADVANCED_MODE" == 1 ];
22+
then
23+
echo "Advanced Mode Enabled - Syncing .env from /config to /var/www/html - if you're doing this you better read the BookStack documentation. Restart container after making changes to .env"
24+
[[ ! -f "/config/.env" ]] && \
25+
cp /var/www/html/.env.example /config/.env
26+
cp /config/.env /var/www/html/.env
27+
elif [ -z "$ADVANCED_MODE" ];
28+
then
29+
echo "Basic Mode Enabled - Using sed to set BookStack variables from Docker environment variables - check the docs"
30+
cp /var/www/html/.env.example /var/www/html/.env
31+
# set up .env
32+
sed -i "s/APP_KEY=SomeRandomString/APP_KEY=$key/g" /var/www/html/.env
33+
sed -i "s/DB_HOST=localhost/DB_HOST=${DB_HOST}/g" /var/www/html/.env
34+
sed -i "s/DB_DATABASE=database_database/DB_DATABASE=${DB_DATABASE}/g" /var/www/html/.env
35+
sed -i "s/DB_USERNAME=database_username/DB_USERNAME=${DB_USER}/g" /var/www/html/.env
36+
sed -i "s/DB_PASSWORD=database_user_password/DB_PASSWORD=${DB_PASS}/g" /var/www/html/.env
37+
else
38+
echo "Nothing to do with .env - what did you do homer?"
39+
fi
40+
41+
# Check to see if appurl is set, and whether advanced mode is set. Will set .env APP_URL if variable present, and advanced mode not set
42+
if [ ! -z "$APP_URL" -a -z "$ADVANCED_MODE" ];
43+
then
44+
echo "App URL Set"
45+
sed -i "s,#\sAPP_URL.*,APP_URL=${APP_URL},g" /var/www/html/.env
46+
fi
47+
2048
# Create API key if needed
2149
if [ ! -f "/config/BOOKSTACK_APP_KEY.txt" ]
2250
then
@@ -26,13 +54,6 @@ if [ ! -f "/config/BOOKSTACK_APP_KEY.txt" ]
2654
echo "App Key set to $key you can modify the file to update /config/BOOKSTACK_APP_KEY.txt"
2755
fi
2856

29-
# set up .env
30-
sed -i "s/APP_KEY=SomeRandomString/APP_KEY=$key/g" /var/www/html/.env
31-
sed -i "s/DB_HOST=localhost/DB_HOST=${DB_HOST}/g" /var/www/html/.env
32-
sed -i "s/DB_DATABASE=database_database/DB_DATABASE=${DB_DATABASE}/g" /var/www/html/.env
33-
sed -i "s/DB_USERNAME=database_username/DB_USERNAME=${DB_USER}/g" /var/www/html/.env
34-
sed -i "s/DB_PASSWORD=database_user_password/DB_PASSWORD=${DB_PASS}/g" /var/www/html/.env
35-
3657
# update database - will set up database if fresh, or, migrate existing
3758
php /var/www/html/artisan migrate --force
3859

0 commit comments

Comments
 (0)