In this small tutorial, I'm assuming you are using Debian Buster as your server OS.
First step: install Docker
Installing Docker is pretty straightforward, and all the instructions are available on the official Docker website.
This can be summed up as (to execute as root):
apt remove docker docker-engine docker.io containerd runc apt update apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
apt update apt install docker-ce docker-ce-cli containerd.io
systemctl start docker systemctl enable docker
Also, do not forget to install docker-compose as these tools make easier the deployment of services:
curl -L "https://github.com/docker/compose/releases/download/1.28.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
And you're all set-up for the rest!
Creating the Docker Compose file
Creating the docker-compose.yml
is fairly easy:
version: '3'
services:
db:
image: mariadb:10
restart: always
environment:
- MYSQL_RANDOM_ROOT_PASSWORD=1
- MYSQL_DATABASE=spip
- MYSQL_USER=spip
- MYSQL_PASSWORD=verysecret
volumes:
- './spip-db:/var/lib/mysql'
spip:
image: ashledombos/spip-web
depends_on:
- php
- db
volumes:
- './spip-core:/var/www/html/core'
- './spip-data:/var/www/html/data'
restart: always
environment:
- SPIP_DB_SERVER=db
- SPIP_DB_LOGIN=spip
- SPIP_DB_PASS=verysecret
- SPIP_DB_NAME=spip
ports:
- '8031:80'
php:
image: 'ashledombos/spip-fpm:3.2'
depends_on:
- db
volumes:
- './spip-core:/var/www/html/core'
- './spip-data:/var/www/html/data'
environment:
- SPIP_DB_SERVER=mysql
- SPIP_DB_HOST=db
- SPIP_DB_LOGIN=spip
- SPIP_DB_PASS=verysecret
- SPIP_DB_PREFIX=spip
- SPIP_ADMIN_NAME=admin
- SPIP_ADMIN_LOGIN=administrator
- SPIP_ADMIN_EMAIL=me@domain.tld
- SPIP_ADMIN_PASS=imverysecret
- PHP_MAX_EXECUTION_TIME=60
- PHP_MEMORY_LIMIT=256M
- PHP_POST_MAX_SIZE=40M
- PHP_UPLOAD_MAX_FILESIZE=32M
- PHP_TIMEZONE=Europe/Paris
Of course, replace the passwords and ports with whatever fits you.
You can also use an environment file to store the passwords (which is recommended if you share your config in a public repo).
Now, all you have to do to start the services is docker-compose up -d
.
All the basics of the docker-compose
command can be seen on their official website.
Setting up the reverse proxy
As a reverse proxy, I am currently using the Caddy server as it is really easy to use and maintain.
It also has automatic SSL certificates (with auto-renew) which I find very practical.
In order to serve Spip to users, you need to add this to your Caddyfile:
https://domain.tld { encode zstd gzip reverse_proxy 127.0.0.1:8031 }
Note: the encode zstd gzip
is only used to compress pages which can improve loading times in certain browsers.
And you should be all set-up, all is left to do is the regular Spip first startup configuration!
Top comments (0)