Commit eb148b10 authored by Paul Desplanque's avatar Paul Desplanque

Re-use last startup parameters

parent dcc5595b
......@@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](
- Static folder Apache can serve directly (bind mount from host)
- Auto mount of web_static_* volumes at startup
### Changed
- The start command applies the last start parameters if it finds them and if no env var is supplied
## [1.3.0] - 2018-06-26
......@@ -73,6 +73,8 @@ For example
runs the service with a customized location for the *vhosts* and the *certs*, but still keeps logs where SLARP is installed. Also, if you want to serve static contents, put your files into `/your-slarp-installation/static`.
The current in-use parameters (default or user-defined) are written in `laststart.var` at startup, so you don't need to redefine them by setting environment variables each time you restart SLARP, because the start command checks this file. Instead of using env vars on the start command line you could edit `laststart.var` like a classic configuration file, however don't modify it while SLARP is running because some commands could not work properly.
If you have docker volumes whose name start with "web_static_*", the start command mounts them into `/var/www/static_*`. This feature is an alternative to the bind mount of the `static` folder, and is designed to serve directly the static data your backend containers are likely to share. For exemple, if you have a "web_static_searx" volume (let's say it's created as you start a "searx" container), this volume is mounted into `/var/www/static_searx` in the reverse proxy container.
Now a container named "slarp-reverse-proxy" is running, but for now it has nothing to forward.
......@@ -8,10 +8,23 @@ APP_VARFILE="$SELF_DIR/laststart.var"
function get_laststart_var {
if [ ! -r "$APP_VARFILE" ] || [ ! -f "$APP_VARFILE" ]; then
echo ""
grep $1 "$APP_VARFILE" | cut -d= -f2
[ -z "$CERTS_DIR" ] && CERTS_DIR=$(get_laststart_var CERTS_DIR)
[ -z "$CERTS_DIR" ] && CERTS_DIR="$SELF_DIR"/certs
[ -z "$VHOSTS_DIR" ] && VHOSTS_DIR=$(get_laststart_var VHOSTS_DIR)
[ -z "$VHOSTS_DIR" ] && VHOSTS_DIR="$SELF_DIR"/vhosts
[ -z "$APACHE_LOGS_DIR" ] && APACHE_LOGS_DIR=$(get_laststart_var APACHE_LOGS_DIR)
[ -z "$APACHE_LOGS_DIR" ] && APACHE_LOGS_DIR="$SELF_DIR"/apache-logs
[ -z "$CERTBOT_LOGS_DIR" ] && CERTBOT_LOGS_DIR=$(get_laststart_var CERTBOT_LOGS_DIR)
[ -z "$CERTBOT_LOGS_DIR" ] && CERTBOT_LOGS_DIR="$SELF_DIR"/certbot-logs
[ -z "$STATIC_DIR" ] && STATIC_DIR=$(get_laststart_var STATIC_DIR)
[ -z "$STATIC_DIR" ] && STATIC_DIR="$SELF_DIR"/static
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment