Docker Swarm + Portainer + mySQL + NGINX + CommandBox/ContentBox
start docker swarm
docker swarm init
add the docker portainer service for easy management
docker service create \
--name portainer \
--publish 9000:9000 \
--constraint 'node.role == manager' \
--mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
portainer/portainer \
-H unix:///var/run/docker.sock
login to port 9000, add two named volumes to be used below:
- mysqldata
- nginx
docker swarm join info coming soon
create overlay network (details coming soon)
This may not be necessary now that I'm running all containers as a service (even though I only have 1 instance running)
add mysql service
docker service create \
--name mysql \
--network bluewater \
-p 3306:3306 \
--mount type=volume,source=mysqldata,target=/var/lib/mysql,readonly=false \
--env MYSQL_ROOT_PASSWORD=superSecretPassword! \
mysql:latest
You will need to login and create a database.
start docker contentbox image
docker service create \
--name docker_blusol_io \
--network bluewater \
-e 'installer=true' \
-e 'rewrites=true' \
-e 'cfconfig_whitespaceManagement=white-space-pref' \
-e 'cfconfig_adminPassword=superSecretCFMPassword! \
-e "DB_CONNECTION_STRING=jdbc:mysql: //mysql:3306/blusol_docker?useUnicode=true&characterEncoding=UTF-8&useLegacyDatetimeCode=true" \
-e 'DB_CLASS=org.gjt.mm.mysql.Driver' \
-e 'DB_USER=root' \
-e 'DB_PASSWORD=superSecretPassword! \
ortussolutions/contentbox
adding nginx for reverse proxy
docker service create \
--name nginx \
--network bluewater \
-p 80:80 \
-p 443:443 \
--mount type=volume,source=nginx,target=/etc/nginx,readonly=false \
nginx:latest
/etc/nginx/conf.d/docker.blusol.io.conf
server{
listen 80;
server_name docker.blusol.io;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass "http://docker_blusol_io:8080";
}
}
Resources
https://www.ortussolutions.com/blog/contentbox-docker-image-351-released