mirror of
https://github.com/linuxserver/docker-bookstack.git
synced 2026-02-20 02:30:30 +08:00
Merge pull request #10 from linuxserver/memcached
Added memcached, simplified use for manipulating the .env file, moved some bits around
This commit is contained in:
commit
dcb3229825
1
.gitignore
vendored
1
.gitignore
vendored
@ -41,3 +41,4 @@ $RECYCLE.BIN/
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
docker-compose.yml
|
||||
|
||||
@ -13,10 +13,12 @@ RUN \
|
||||
echo "**** install build packages ****" && \
|
||||
apk add --no-cache \
|
||||
curl \
|
||||
memcached \
|
||||
php7-ctype \
|
||||
php7-dom \
|
||||
php7-gd \
|
||||
php7-mbstring \
|
||||
php7-memcached \
|
||||
php7-mysqlnd \
|
||||
php7-openssl \
|
||||
php7-pdo_mysql \
|
||||
|
||||
@ -16,10 +16,12 @@ RUN \
|
||||
echo "**** install build packages ****" && \
|
||||
apk add --no-cache \
|
||||
curl \
|
||||
memcached \
|
||||
php7-ctype \
|
||||
php7-dom \
|
||||
php7-gd \
|
||||
php7-mbstring \
|
||||
php7-memcached \
|
||||
php7-mysqlnd \
|
||||
php7-openssl \
|
||||
php7-pdo_mysql \
|
||||
|
||||
@ -16,10 +16,12 @@ RUN \
|
||||
echo "**** install build packages ****" && \
|
||||
apk add --no-cache \
|
||||
curl \
|
||||
memcached \
|
||||
php7-ctype \
|
||||
php7-dom \
|
||||
php7-gd \
|
||||
php7-mbstring \
|
||||
php7-memcached \
|
||||
php7-mysqlnd \
|
||||
php7-openssl \
|
||||
php7-pdo_mysql \
|
||||
|
||||
4
Jenkinsfile
vendored
4
Jenkinsfile
vendored
@ -17,11 +17,13 @@ pipeline {
|
||||
BUILDS_DISCORD = credentials('build_webhook_url')
|
||||
GITHUB_TOKEN = credentials('498b4638-2d02-4ce5-832d-8a57d01d97ab')
|
||||
DIST_IMAGE = 'alpine'
|
||||
DIST_TAG = '3.7'
|
||||
DIST_TAG = '3.8'
|
||||
DIST_PACKAGES = 'curl \
|
||||
memcached \
|
||||
php7-openssl \
|
||||
php7-pdo_mysql \
|
||||
php7-mbstring \
|
||||
php7-memcached \
|
||||
php7-tidy \
|
||||
php7-phar \
|
||||
php7-dom \
|
||||
|
||||
@ -30,7 +30,6 @@ param_env_vars:
|
||||
- { env_var: "DB_PASS", env_value: "<yourdbpass>", desc: "for specifying the database password" }
|
||||
- { env_var: "DB_DATABASE", env_value: "bookstackapp", desc: "for specifying the database to be used" }
|
||||
- { env_var: "APPURL", env_value: "your.site.here.xyz", desc: "for specifying the url your application will be accessed on "}
|
||||
- { env_var: "ADVANCED_MODE", env_value: "1", desc: "enables advanced mode for direct editing of the .env - scroll down for details on this"}
|
||||
|
||||
param_usage_include_ports: true
|
||||
param_ports:
|
||||
@ -63,12 +62,10 @@ app_setup_block: |
|
||||
|
||||
Documentation can be found at https://www.bookstackapp.com/docs/
|
||||
|
||||
### Advanced Mode
|
||||
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
|
||||
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
|
||||
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.
|
||||
|
||||
Note, the APP_KEY is still set by PHP environment so you do not need to worrry about this.
|
||||
### Advanced Users
|
||||
If you wish to use the extra functionality of BookStack such as email, memcache, ldap and so on you will need to make your own .env file with guidance from the BookStack documentation.
|
||||
|
||||
When you create the container, do not set any arguements for SQL or APPURL. The container will copy an .env file to /config/www/.env on your host system for you to edit.
|
||||
|
||||
### Composer
|
||||
|
||||
@ -76,6 +73,7 @@ app_setup_block: |
|
||||
|
||||
# changelog
|
||||
changelogs:
|
||||
- { date: "15.10.18:", desc: "Changed functionality for advanced users"}
|
||||
- { date: "08.10.18:", desc: "Advanced mode, symlink changes, sed fixing, docs updated, added some composer files"}
|
||||
- { date: "23.09.28:", desc: "Updates pre-release"}
|
||||
- { date: "02.07.18:", desc: "Initial Release." }
|
||||
|
||||
@ -4,11 +4,18 @@
|
||||
mkdir -p \
|
||||
/config/www/{uploads,files,images}
|
||||
|
||||
# check for .env and copy default if needed
|
||||
[[ ! -f "/config/www/.env" ]] && \
|
||||
cp /var/www/html/.env.example /config/www/.env
|
||||
|
||||
# create symlinks
|
||||
symlinks=( \
|
||||
/var/www/html/storage/uploads/files \
|
||||
/var/www/html/storage/uploads/images \
|
||||
/var/www/html/public/uploads )
|
||||
/var/www/html/public/uploads \
|
||||
/var/www/html/.env \
|
||||
/var/www/html/storage/logs/laravel.log
|
||||
)
|
||||
|
||||
for i in "${symlinks[@]}"
|
||||
do
|
||||
@ -16,44 +23,34 @@ do
|
||||
[[ ! -L "$i" ]] && ln -s /config/www/"$(basename "$i")" "$i"
|
||||
done
|
||||
|
||||
# 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
|
||||
# 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
|
||||
if [ "$ADVANCED_MODE" == 1 ];
|
||||
then
|
||||
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"
|
||||
[[ ! -f "/config/.env" ]] && \
|
||||
cp /var/www/html/.env.example /config/.env
|
||||
cp /config/.env /var/www/html/.env
|
||||
elif [ -z "$ADVANCED_MODE" ];
|
||||
then
|
||||
echo "Basic Mode Enabled - Using sed to set BookStack variables from Docker environment variables - check the docs"
|
||||
cp /var/www/html/.env.example /var/www/html/.env
|
||||
# set up .env
|
||||
sed -i "s/APP_KEY=SomeRandomString/APP_KEY=$key/g" /var/www/html/.env
|
||||
sed -i "s/DB_HOST=localhost/DB_HOST=${DB_HOST}/g" /var/www/html/.env
|
||||
sed -i "s/DB_DATABASE=database_database/DB_DATABASE=${DB_DATABASE}/g" /var/www/html/.env
|
||||
sed -i "s/DB_USERNAME=database_username/DB_USERNAME=${DB_USER}/g" /var/www/html/.env
|
||||
sed -i "s/DB_PASSWORD=database_user_password/DB_PASSWORD=${DB_PASS}/g" /var/www/html/.env
|
||||
else
|
||||
echo "Nothing to do with .env - what did you do homer?"
|
||||
fi
|
||||
|
||||
# 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
|
||||
if [ ! -z "$APP_URL" -a -z "$ADVANCED_MODE" ];
|
||||
then
|
||||
echo "App URL Set"
|
||||
sed -i "s,#\sAPP_URL.*,APP_URL=${APP_URL},g" /var/www/html/.env
|
||||
fi
|
||||
|
||||
# Create API key if needed
|
||||
if [ ! -f "/config/BOOKSTACK_APP_KEY.txt" ]
|
||||
if [ ! -f "/config/BOOKSTACK_APP_KEY.txt" ];
|
||||
then
|
||||
echo "Generating BookStack app key for first run"
|
||||
key=$(php /var/www/html/artisan key:generate --show | tr -d '//' )
|
||||
echo $key > /config/BOOKSTACK_APP_KEY.txt
|
||||
echo "App Key set to $key you can modify the file to update /config/BOOKSTACK_APP_KEY.txt"
|
||||
elif [ -f "/config/BOOKSTACK_APP_KEY.txt" ];
|
||||
then
|
||||
echo "App Key found - setting variable for seds"
|
||||
key=$(cat /config/BOOKSTACK_APP_KEY.txt)
|
||||
fi
|
||||
|
||||
# .env file setup
|
||||
# check to see if db_user is set, if it is then run seds and if not then leave them
|
||||
if [ "${DB_USER}" ];
|
||||
then
|
||||
echo "Running config - db_user set"
|
||||
sed -i "s,APP_KEY=SomeRandomString,APP_KEY=${key},g" /config/www/.env
|
||||
sed -i "s/DB_HOST=localhost/DB_HOST=${DB_HOST}/g" /config/www/.env
|
||||
sed -i "s/DB_DATABASE=database_database/DB_DATABASE=${DB_DATABASE}/g" /config/www/.env
|
||||
sed -i "s/DB_USERNAME=database_username/DB_USERNAME=${DB_USER}/g" /config/www/.env
|
||||
sed -i "s/DB_PASSWORD=database_user_password/DB_PASSWORD=${DB_PASS}/g" /config/www/.env
|
||||
fi
|
||||
|
||||
# set appurl if detected
|
||||
[[ "${APP_URL}" ]] && sed -i "s,#\sAPP_URL.*,APP_URL=${APP_URL},g" /config/www/.env
|
||||
|
||||
# update database - will set up database if fresh, or, migrate existing
|
||||
php /var/www/html/artisan migrate --force
|
||||
|
||||
|
||||
2
root/etc/services.d/memcached/run
Normal file
2
root/etc/services.d/memcached/run
Normal file
@ -0,0 +1,2 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
exec memcached -u abc
|
||||
@ -1,3 +1,2 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
export APP_KEY=$(cat /config/BOOKSTACK_APP_KEY.txt)
|
||||
exec /usr/sbin/php-fpm7 -F
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user