Commit 2408b87f authored by Paul Desplanque's avatar Paul Desplanque

Add folder for static content

parent ee2828c8
......@@ -2,4 +2,5 @@ apache-logs/
certbot-logs/
vhosts/
certs/
static/
laststart.var
......@@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- Static folder Apache can serve directly
## [1.3.0] - 2018-06-26
### Added
......
......@@ -63,11 +63,15 @@ Be sure you have no other program listening to the ports 80 and 443. To launch t
```
# ./start
```
By default all important data go to the SLARP installation directory. However you can adjust the values of 4 environment variables before starting: `VHOSTS_DIR`, `CERTS_DIR`, `APACHE_LOGS_DIR` and `CERTBOT_LOGS_DIR`. For example
By default all important data go to the SLARP installation directory. However you can adjust the values of these environment variables before starting: `VHOSTS_DIR`, `CERTS_DIR`, `APACHE_LOGS_DIR` and `CERTBOT_LOGS_DIR`.
Additionnally, you can use `STATIC_DIR` to define which path of your host will be mounted (read-only) into `/var/www/static` in the container. By default it uses the "static" directory in the SLARP installation directory. The main purpose of this is to make Apache serving the static content of your backends directly.
If a directory does not exist, the start command creates it.
For example
```
# VHOSTS_DIR=/path/to/your/vhosts CERTS_DIR=/path/to/your/certificates ./start
```
runs the service with a customized location for the *vhosts* and the *certs*, but still keeps logs where SLARP is installed.
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 directly, put your files in `/your-slarp-installation/static`.
Now a container named "slarp-reverse-proxy" is running, but for now it has nothing to forward.
......
......@@ -12,8 +12,9 @@ APP_VARFILE="$SELF_DIR/laststart.var"
[ -z "$VHOSTS_DIR" ] && VHOSTS_DIR="$SELF_DIR"/vhosts
[ -z "$APACHE_LOGS_DIR" ] && APACHE_LOGS_DIR="$SELF_DIR"/apache-logs
[ -z "$CERTBOT_LOGS_DIR" ] && CERTBOT_LOGS_DIR="$SELF_DIR"/certbot-logs
[ -z "$STATIC_DIR" ] && STATIC_DIR="$SELF_DIR"/static
for dir in "$CERTS_DIR" "$VHOSTS_DIR" "$APACHE_LOGS_DIR" "$CERTBOT_LOGS_DIR"; do
for dir in "$CERTS_DIR" "$VHOSTS_DIR" "$APACHE_LOGS_DIR" "$CERTBOT_LOGS_DIR" "$STATIC_DIR"; do
mkdir -p "$dir" || {
echo "Could not create $dir - aborting" >&2
exit 74
......@@ -27,6 +28,7 @@ echo CERTS_DIR="$CERTS_DIR" > "$APP_VARFILE" || {
echo VHOSTS_DIR="$VHOSTS_DIR" >> "$APP_VARFILE"
echo APACHE_LOGS_DIR="$APACHE_LOGS_DIR" >> "$APP_VARFILE"
echo CERTBOT_LOGS_DIR="$CERTBOT_LOGS_DIR" >> "$APP_VARFILE"
echo STATIC_DIR="$STATIC_DIR" >> "$APP_VARFILE"
docker run -d --restart on-failure \
--name $APP_NAME \
......@@ -35,6 +37,7 @@ docker run -d --restart on-failure \
-v "$VHOSTS_DIR":/etc/apache2/sites-enabled \
-v "$APACHE_LOGS_DIR":/var/log/apache2 \
-v "$CERTBOT_LOGS_DIR":/var/log/letsencrypt \
-v "$STATIC_DIR":/var/www/static:ro \
-p 80:80 -p 443:443 \
$APP_NAME:latest bash -c \
"cron &&
......
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