Image: mikirisec/mikiri-waf-api. Volume: /mikiri-waf-api. Port: 8080.
The first start leaves Nginx running and does not start the API. The API starts on the next start, after settings.py points at PostgreSQL. The database is created in Deploying the PostgreSQL Docker container.
mkdir -p /opt/mikiri-waf/mikiri-waf-api
touch /opt/mikiri-waf/mikiri-waf-api/first-launch
mikiri-waf network:docker run -d --name mikiri-waf-api --network mikiri-waf \
-p 8080:8080 \
-v /opt/mikiri-waf/mikiri-waf-api:/mikiri-waf-api \
mikirisec/mikiri-waf-api:latest
The entrypoint copies settings.py, the Nginx configuration and the log directories into the volume, then deletes first-launch. settings.py is created with mode 0555.
chmod u+w /opt/mikiri-waf/mikiri-waf-api/settings.py
DB_HOST = 'mikiri-waf-db'
DB_PORT = '5432'
DB_NAME = 'api'
DB_USER = 'api'
DB_PASS = 'YOUR_PASSWORD'
first-launch is already gone, so this start runs mikiri-waf-api and mikiri-waf-api-aux:docker restart mikiri-waf-api
docker update --restart unless-stopped mikiri-waf-api
Logs are written to /opt/mikiri-waf/mikiri-waf-api/log/mikiri-waf/.
| In the volume | In the container | Contents |
|---|---|---|
settings.py |
/var/www/mikiri-waf-api/settings.py |
Main configuration |
conf.d/ |
/etc/nginx/conf.d/ |
Server and upstream configuration |
snippets/ |
/etc/nginx/snippets/ |
Custom includes |
log/mikiri-waf/ |
/var/log/mikiri-waf/ |
API and auxiliary logs |
A volume that still has nginx/mikiri-waf-api.conf is migrated into conf.d/ on start. init.py is always taken from the image.
docker pull mikirisec/mikiri-waf-api:latest
docker stop mikiri-waf-api
docker rm mikiri-waf-api
docker run -d --name mikiri-waf-api --network mikiri-waf --restart unless-stopped \
-p 8080:8080 \
-v /opt/mikiri-waf/mikiri-waf-api:/mikiri-waf-api \
mikirisec/mikiri-waf-api:latest
Do not create first-launch again. If the package version changed, the previous volume contents are copied to old/. The working files stay in place.