How can I find MariaDB URL to be used with Keycloak? - mariadb

I was using Keycloak 16. Now that I want to upgrade to Keycloak 20, I see that they have changed a lot.
This is my docker-compose.yml file from 16:
version: "3.9"
services:
accounts:
image: jboss/keycloak:latest
container_name: Accounts
ports:
- 8080:8080
environment:
- KEYCLOAK_FRONTEND_URL=https://accounts.example.local/auth
- PROXY_ADDRESS_FORWARDING=true
- KEYCLOAK_USER=user
- KEYCLOAK_PASSWORD=pass
- DB_VENDOR=mariadb
- DB_ADDR=database
- DB_DATABASE=accounts
- DB_USER=db_user
- DB_PASSWORD=db_pass
logging:
driver: none
restart: always
database:
image: mariadb
container_name: AccountsDatabase
ports:
- 3306:3306
environment:
- MARIADB_ROOT_PASSWORD=root_pass
- MYSQL_DATABASE=accounts
- MYSQL_USER=db_user
- MYSQL_PASSWORD=db_pass
volumes:
- /Temp/AccountsDatabases:/var/lib/mysql
logging:
driver: none
restart: always
admin:
image: adminer
container_name: AccountsAdminer
restart: always
logging:
driver: none
ports:
- 8080:8080
environment:
- ADMINER_DEFAULT_SERVER=database
Now it seems that Keycloak needs a database URL.
I can't find out how can I connect MariaDB to Keycloak. I can't find out the URL of my MariaDB URL and the Keycloak blog says that they won't provide examples for any database other than their first class PostreSQL.
I'm stuck at this point. Any help is appreciated.

Their documents show KC_DB_URL is a JDBC URL.
So the simple form of jdbc:mariadb://host/database seems used in their tests, so for you:
environment:
- KEYCLOAK_FRONTEND_URL=https://accounts.example.local/auth
- PROXY_ADDRESS_FORWARDING=true
- KEYCLOAK_USER=user
- KEYCLOAK_PASSWORD=pass
- KB_DB_URL=jdbc:mariadb://database/accounts
- KB_DB_USER=db_user
- KB_DB_PASSWORD=db_pass
note: I'm hoping/assuming the JDBC driver for MariaDB is in their container which it may not be.

Related

Can't get a Docker image of both PHPMyAdmin and MariaDB to work together

I'm using Docker and a docker-compose.yml file to pop up a WordPress site using Bitnami and MariaDB. With just these two services alone, everything is fine, but I have no way to view/access the data in MariaDB. To solve the issue, I added the PHPMyAdmin service to the compose file since I'm familiar with that service. However, one of two problems happen: either all three services stay up and work fine and I can't login to PHPMyAdmin, or MariaDB shuts down every time immediately after starting up and the whole image doesn't work.
This configuration keeps the image up, but doesn't let me login to PHPMyAdmin...
services:
# Database
mariadb:
image: docker.io/bitnami/mariadb:latest
container_name: test_mariadb_database
volumes:
- 'mariadb_data:/bitnami/mariadb'
environment:
# ALLOW_EMPTY_PASSWORD is recommended only for development.
- ALLOW_EMPTY_PASSWORD=yes
- MARIADB_USER=test_bn_wp
- MARIADB_DATABASE=test_bitnami_wordpress
networks:
- test_bn
# phpmyadmin
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: test_pma
links:
- mariadb
environment:
PMA_HOST: mariadb
PMA_PORT: 3306
PMA_ARBITRARY: 1
restart: always
ports:
- 8081:80
# Wordpress
wordpress:
image: docker.io/bitnami/wordpress:latest
ports:
- '80:8080'
- '443:8443'
restart: always
container_name: test_bitnami_wordpress
volumes: ['./docroot:/bitnami/wordpress']
depends_on:
- mariadb
environment:
# ALLOW_EMPTY_PASSWORD is recommended only for development.
- ALLOW_EMPTY_PASSWORD=yes
- WORDPRESS_DATABASE_HOST=mariadb
- WORDPRESS_DATABASE_PORT_NUMBER=3306
- WORDPRESS_DATABASE_USER=test_bn_wp
- WORDPRESS_DATABASE_NAME=test_bitnami_wordpress
networks:
- test_bn
networks:
test_bn:
volumes:
mariadb_data:
driver: local
wordpress_data:
driver: local
So I change to this configuration, thinking that the password can't be blank, but it causes MariaDB to shut down immediately after starting up, thus rendering the whole image useless...
services:
# Database
mariadb:
image: docker.io/bitnami/mariadb:latest
container_name: test_mariadb_database
volumes:
- 'mariadb_data:/bitnami/mariadb'
environment:
# ALLOW_EMPTY_PASSWORD is recommended only for development.
- ALLOW_EMPTY_PASSWORD=no
- MARIADB_USER=test_bn_wp
- MARIADB_PASSWORD=test_password
- MARIADB_ROOT_PASSWORD=test_password
- MARIADB_DATABASE=test_bitnami_wordpress
networks:
- test_bn
# phpmyadmin
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: test_pma
links:
- mariadb
environment:
PMA_HOST: mariadb
PMA_PORT: 3306
PMA_ARBITRARY: 1
restart: always
ports:
- 8081:80
# Wordpress
wordpress:
image: docker.io/bitnami/wordpress:latest
ports:
- '80:8080'
- '443:8443'
restart: always
container_name: test_bitnami_wordpress
volumes: ['./docroot:/bitnami/wordpress']
depends_on:
- mariadb
environment:
# ALLOW_EMPTY_PASSWORD is recommended only for development.
- ALLOW_EMPTY_PASSWORD=yes
- WORDPRESS_DATABASE_HOST=mariadb
- WORDPRESS_DATABASE_PORT_NUMBER=3306
- WORDPRESS_DATABASE_USER=test_bn_wp
- WORDPRESS_DATABASE_NAME=test_bitnami_wordpress
networks:
- test_bn
networks:
test_bn:
volumes:
mariadb_data:
driver: local
wordpress_data:
driver: local
Edit - This is the error I get when trying to login to PHPMyAdmin with the first config.

Bad Gateway for WordPress containers behind Traefik reverse proxy in docker-compose

Firstly, I'd like to say that I'm not a server admin. I'm a web programmer tasked with setting up a development server and I have no idea what I'm doing. I may not be doing things according to best practice or the way you might do them. Unfortunately, with Traefik, there are 3 ways to do everything and so 2/3 of the answers that I've come across aren't compatible with my implementation and I can't figure out how to make them work. Furthermore, this isn't my only (or even primary) job duty.
Here's the setup:
Single-server docker environment on a Linode server with Ubuntu 20.04
I have one stack with Traefik, Traefik Hub, Portainer, and WhoAmI configured and working (mostly) correctly. I don't have the DNS challenge working right with Let's Encrypt, but I don't really care about that at this point. I don't really need a wildcard certificate.
I created a mariadb container. We're mostly a WordPress shop and I'd like to have one container for all the databases we work with rather than configuring a database on an environment-by-environment basis.
I created an external bridge network, named "maverick-net" and all of the stacks are connected to it.
I have a self-hosted GitHub runner listening for changes to the "dev" branch of the project. The runner pulls down the latest repo, writes GitHub secrets to a local .env file, runs composer install and then docker-compose up -d. (That's the reason behind the obscenely-long bind mount paths.)
I'm trying to make the code for these WordPress projects reusable as much as possible, so there's a lot of .env variables in the different files. At some point I'll probably move those over to docker secrets, but at this point it's a development server and not as critical.
My issue is that I haven't been able to get a WordPress site up and running, and I keep hitting a "Bad Gateway" error. When I curl the URL from inside the traefik container, I get... wait for it... "Bad Gateway."
Clearly there's something I'm missing, but I've been slamming my head against a brick wall for weeks trying different approaches to get this running and I need help. There has to be something I'm not getting about docker networks in general because my wp-cli container never has been able to connect to the database, regardless of whether I start it in the same stack or if i try to connect to it on the maverick-net network.
My traefik stack (side note, I'd really like to split these command entries into static and dynamic config files, but that's a task for another day):
version: "3.9"
secrets:
linode_token:
file: "../secrets/linode_token.secret"
services:
traefik:
container_name: traefik
image: "traefik:latest"
command:
- --log.level=DEBUG
- --log.filePath=./traefik.log
- --accessLog=true
- --accessLog.filePath=./access.log
- --accessLog.bufferingSize=100
- --accessLog.filters.statusCodes=400-499
- --api
- --api.dashboard=true
- --api.insecure=false
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --providers.docker
- --providers.docker.watch=true
- --providers.docker.exposedbydefault=false
- --certificatesresolvers.leresolver.acme.dnsChallenge=true
- --certificatesresolvers.leresolver.acme.dnsChallenge.provider=linodev4
- --certificatesresolvers.leresolver.acme.httpchallenge=true
- --certificatesresolvers.leresolver.acme.httpchallenge.entrypoint=web
- --certificatesresolvers.leresolver.acme.email=xxxxxxxxxxx#xxxxxxxxx.xxx
- --certificatesresolvers.leresolver.acme.storage=./acme.json
#- --certificatesresolvers.leresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory
- --certificatesresolvers.leresolver.acme.caserver=https://acme-v02.api.letsencrypt.org/directory
- --experimental.hub=true
- --hub.tls.insecure=true
- --metrics.prometheus.addrouterslabels=true
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ~/certs-data/acme.json:/data/letsencrypt/acme.json
- ./static.yml:/static.yml:ro
- ./configs:/configs
- ~/certs-data/:/data/letsencrypt/
secrets:
- "linode_token"
environment:
TZ: America/Chicago
LINODE_TOKEN_FILE: "/run/secrets/linode_token"
labels:
- "traefik.enable=true"
- "traefik.docker.network=maverick-net"
- "traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)"
- "traefik.http.routers.http-catchall.entrypoints=web"
- "traefik.http.routers.http-catchall.middlewares=redirect-to-https"
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
- "traefik.http.routers.traefik.tls.certresolver=leresolver"
- "traefik.http.routers.traefik.rule=Host(`XXXXX.XXXXXXXXXX.XXX`)"
- "traefik.http.routers.traefik.entrypoints=websecure"
- "traefik.http.routers.traefik.service=api#internal"
- "traefik.http.routers.traefik.middlewares=traefik-auth"
- "traefik.http.middlewares.traefik-auth.basicauth.users=XXXX:$$apr1$$XXXXX$$XXXXXXXXXXXXXXX"
- "traefik.http.routers.api.entrypoints=websecure"
networks:
- maverick-net
hub-agent:
image: ghcr.io/traefik/hub-agent-traefik:experimental
pull_policy: always
container_name: hub-agent
restart: on-failure
command:
- run
- --hub.token=XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX
- --auth-server.advertise-url=http://hub-agent
- --traefik.host=traefik
- --traefik.tls.insecure=true
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
depends_on:
- traefik
networks:
- maverick-net
portainer:
image: portainer/portainer-ce:latest
command: -H unix:///var/run/docker.sock
container_name: portainer
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
labels:
# Frontend
- "traefik.enable=true"
- "traefik.http.routers.frontend.rule=Host(`XXXXX.XXXXXXXXXX.XXX`)"
- "traefik.http.routers.frontend.entrypoints=websecure"
- "traefik.http.services.frontend.loadbalancer.server.port=9000"
- "traefik.http.routers.frontend.service=frontend"
- "traefik.http.routers.frontend.tls.certresolver=leresolver"
networks:
- maverick-net
whoami:
image: "traefik/whoami"
container_name: "whoami"
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami.rule=Host(`XXXXX.XXXXXXXXXX.XXX`)"
- "traefik.http.routers.whoami.entrypoints=websecure"
- "traefik.http.routers.whoami.tls.certresolver=leresolver"
networks:
- maverick-net
volumes:
portainer_data:
networks:
maverick-net:
external: true
My mariadb stack:
version: "3"
networks:
# enable connection with Traefik
maverick-net:
external: true
services:
mariadb:
container_name: mariadb
image: mariadb:10.7
restart: always
volumes:
- "/home/xxxxxxxxxx/docker/mariadb/data:/var/lib/mysql"
expose:
- "3306"
env_file: .env
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PWD}
MYSQL_USER: ${ADMIN_DB_USER}
MYSQL_PASSWORD: ${ADMIN_DB_PWD}
networks:
- maverick-net
And finally my WordPress stack:
version: '3.8'
networks:
maverick-net:
external: true
# volumes:
# db_data:
services:
# mariadb:
# container_name: ${WORDPRESS_DB_NAME}-db
# image: mariadb:10.7
# restart: always
# volumes:
# - "db_data:/var/lib/mysql"
# env_file: .env
# environment:
# MYSQL_ROOT_PASSWORD: ${MARIADB_ROOT_PASSWORD}
# MYSQL_USER: ${ADMIN_DB_USER}
# MYSQL_PASSWORD: ${ADMIN_DB_PWD}
wordpress:
container_name: ${WORDPRESS_DB_NAME}-wp
image: wordpress:6.0.2-fpm
volumes:
- type: bind
source: ${PROJECT_ROOT}/${WORDPRESS_DB_NAME}/${PROJECT_NAME}/${PROJECT_NAME}/wp
target: /var/www/html
restart: always
env_file: .env
environment:
WORDPRESS_DB_HOST: mariadb
MARIADB_ROOT_PASSWORD: ${MARIADB_ROOT_PASSWORD}
WORDPRESS_DATABASE_USER: ${WORDPRESS_DB_USER}
WORDPRESS_DATABASE_PASSWORD: ${WORDPRESS_DB_PASSWORD}
WORDPRESS_DATABASE_NAME: ${WORDPRESS_DB_NAME}
labels:
# The labels are useful for Traefik only
- "traefik.enable=true"
- "traefik.docker.network=maverick-net"
# Get the routes from https
- "traefik.http.routers.${WORDPRESS_DB_NAME}.rule=Host(`${DEV_URL}`)"
- "traefik.http.routers.${WORDPRESS_DB_NAME}.entrypoints=websecure"
- "traefik.http.routers.${WORDPRESS_DB_NAME}.tls.certresolver=leresolver"
networks:
- maverick-net
wordpress-cli:
container_name: ${WORDPRESS_DB_NAME}-cli
image: wordpress:cli
volumes:
- type: bind
source: ${PROJECT_ROOT}/${WORDPRESS_DB_NAME}/${PROJECT_NAME}/${PROJECT_NAME}/wp
target: /var/www/html
env_file: .env
environment:
WORDPRESS_DB_HOST: mariadb
MARIADB_ROOT_PASSWORD: ${MARIADB_ROOT_PASSWORD}
WORDPRESS_DATABASE_USER: ${WORDPRESS_DB_USER}
WORDPRESS_DATABASE_PASSWORD: ${WORDPRESS_DB_PASSWORD}
WORDPRESS_DATABASE_NAME: ${WORDPRESS_DB_NAME}
networks:
- maverick-net
depends_on:
- wordpress
As far as I know, you can connect to containers in the same network by using their service name.
So for example you are trying to curl to the Wordpress container from the Traefik Container.
curl 'http://wordpress/'
Should work.
In another project I use an nginx container with php-fpm.
I need to send my curl requests to the nginx container, because the php-fpm container does not handle server requests directly:
// does not work
curl 'http://php-debug/index.html'
// result
curl: (7) Failed to connect to php-debug port 80: Connection refused
// https also does not work
curl 'https://php-fpm/index.html'
// result
curl: (7) Failed to connect to php-fpm port 443: Connection refused
// This does work
curl 'http://nginx/index.html'
// result
<HTML...
For some reason https: curl requests fail, but on http I get the correct result so for local development I think it's ok.
If you are interested in a more managed solution, you can check out warden.dev. It contains a template for Wordpress too (which I use succesfully for local development). I have been using this exclusively. If you have questions how to setup WP CLI on this solution, feel free to contact me.
It comes with portainer, traefik, ssl and dns and mailhog.
Configuration is pretty straight forward, I can set up a new project within an hour and connect to the database and containers in my IDE.
https://docs.warden.dev/environments/types.html#wordpress

Why isn't Hasura generating queries for tables in version 2?

I see "table_name_connection" query instead of "table_name" in "query_root" section. The same hash appears instead of numeric IDs. Everything works in the first version, but this version is already deprecated.
Has anyone solved this problem?
MacOS, docker-compose.yml
version: '3.6'
services:
postgres:
image: postgres:12
restart: always
volumes:
- ./database:/var/lib/postgresql/data
ports:
- 5432:5432
environment:
POSTGRES_DB: ${PROJECT_NAME}
POSTGRES_PASSWORD: ${ADMIN_PASSWORD}
graphql-engine:
image: hasura/graphql-engine:v2.0.9
restart: always
volumes:
- ./database/hasura/metadata:/hasura-metadata
- ./database/hasura/migrations:/hasura-migrations
ports:
- 4321:8080
depends_on:
- "postgres"
environment:
HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:${ADMIN_PASSWORD}#postgres:5432/${PROJECT_NAME}
HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:${ADMIN_PASSWORD}#postgres:5432/${PROJECT_NAME}
# HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:${ADMIN_PASSWORD}#postgres:5432/${PROJECT_NAME}
HASURA_GRAPHQL_ENABLE_CONSOLE: ${DEV_MODE}
HASURA_GRAPHQL_DEV_MODE: ${DEV_MODE}
HASURA_GRAPHQL_ENABLED_LOG_TYPES: ${HASURA_LOGS}
HASURA_GRAPHQL_ADMIN_SECRET: ${ADMIN_PASSWORD}
You have enabled the relay api toggle:

Traefik not routing to other containers

I've set up Traefik and Portainer on my server running Ubuntu 20.04 that is in my front room (I used this guide and this one, but didn't set up the default IP whitelist in the second tutorial as I want it to be a publicly accessible webserver). Both apps work and appear to be using HTTPS. I can manage and create containers in Portainer.
To test out my configuration, I added two containers - MySQL and Wordpress. I added in the Traefik labels from the above tutorials like when I set up Traefik, and I set the Wordpress container's domain name in Portainer, but whenever I try to access the Wordpress site at that domain, I get a Bad Gateway error (just the words 'Bad Gateway', not even a status code).
I'm not sure where I've gone wrong. Here are my configuration files:
traefik.yml:
api:
dashboard: true
entryPoints:
http:
address: ":80"
https:
address: ":443"
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
file:
filename: /config.yml
version: '3'
services:
traefik:
image: traefik:v2.0
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
- proxy
ports:
- 80:80
- 443:443
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./data/traefik.yml:/traefik.yml:ro
- ./data/acme.json:/acme.json
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.entrypoints=http"
- "traefik.http.routers.traefik.rule=Host(`traefik.mywebsite.com`)"
- "traefik.http.middlewares.traefik-auth.basicauth.users=michael:$$apr1$$.m1mfSB0$$6Ypx6rfih8y.vHkNQe9rJ0"
- "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https"
- "traefik.http.routers.traefik.middlewares=traefik-https-redirect"
- "traefik.http.routers.traefik-secure.entrypoints=https"
- "traefik.http.routers.traefik-secure.rule=Host(`traefik.mywebsite.com`)"
- "traefik.http.routers.traefik-secure.middlewares=traefik-auth"
- "traefik.http.routers.traefik-secure.tls=true"
- "traefik.http.routers.traefik-secure.tls.certresolver=http"
- "traefik.http.routers.traefik-secure.service=api#internal"
networks:
proxy:
external: true
certificatesResolvers:
http:
acme:
email: me#myemail.com
storage: acme.json
httpChallenge:
entryPoint: http
config.yml:
http:
middlewares:
https-redirect:
redirectScheme:
scheme: https
docker-compose.yml:
version: '3'
services:
traefik:
image: traefik:v2.0
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
- proxy
ports:
- 80:80
- 443:443
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./data/traefik.yml:/traefik.yml:ro
- ./data/acme.json:/acme.json
- ./data/config.yml:/config.yml:ro
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.entrypoints=http"
- "traefik.http.routers.traefik.rule=Host(`traefik.mywebsite.com`)"
- "traefik.http.middlewares.traefik-auth.basicauth.users=michael:$$apr1$$.m1mfSB0$$6Ypx6rfih8y.vHkNQe9rJ0"
- "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https"
- "traefik.http.routers.traefik.middlewares=traefik-https-redirect"
- "traefik.http.routers.traefik-secure.entrypoints=https"
- "traefik.http.routers.traefik-secure.rule=Host(`traefik.mywebsite.com`)"
- "traefik.http.routers.traefik-secure.middlewares=traefik-auth"
- "traefik.http.routers.traefik-secure.tls=true"
- "traefik.http.routers.traefik-secure.tls.certresolver=http"
- "traefik.http.routers.traefik-secure.service=api#internal"
networks:
proxy:
external: true
Wordpress/MySQL docker-compose.yml:
version: '3.1'
services:
wordpress:
image: wordpress
restart: always
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: admin
WORDPRESS_DB_PASSWORD: password
WORDPRESS_DB_NAME: wordpressdb
volumes:
- wordpress:/var/www/html
networks:
- proxy
labels:
- "traefik.enable=true"
- "traefik.http.routers.wordpress.entrypoints=http"
- "traefik.http.routers.wordpress.rule=Host(`myblog.com`)"
- "traefik.http.routers.wordpress.middlewares=https-redirect#file"
- "traefik.http.routers.wordpress-secure.entrypoints=https"
- "traefik.http.routers.wordpress-secure.rule=Host(`myblog.com`)"
- "traefik.http.routers.wordpress-secure.tls=true"
- "traefik.http.routers.wordpress-secure.tls.certresolver=http"
- "traefik.http.routers.wordpress-secure.service=wordpress"
- "traefik.http.services.wordpress.loadbalancer.server.port=9000"
- "traefik.docker.network=proxy"
db:
image: mysql:5.7
restart: always
environment:
MYSQL_DATABASE: exampledb
MYSQL_USER: username
MYSQL_PASSWORD: password
MYSQL_RANDOM_ROOT_PASSWORD: '1'
volumes:
- db:/var/lib/mysql
networks:
- proxy
labels:
- "traefik.enable=true"
- "traefik.http.routers.mysql.entrypoints=http"
- "traefik.http.routers.mysql.middlewares=https-redirect#file"
- "traefik.http.routers.mysql-secure.entrypoints=https"
- "traefik.http.routers.mysql-secure.tls=true"
- "traefik.http.routers.mysql-secure.tls.certresolver=http"
- "traefik.http.routers.mysql-secure.service=mysql"
- "traefik.http.services.mysql.loadbalancer.server.port=9000"
- "traefik.docker.network=proxy"
volumes:
wordpress:
db:
networks:
proxy:
external: true
I can provide the Portainer docker-compose.yml file too if needed, but I don't really think it's necessary. Any help here would be great!
For network connectivity between the different applications you must create the network in one of your applications. I would do that in your traefik docker-compose.yml
Meaning, that in your traefik compose file you must NOT specify the proxy network as external, because you create it internally in that application like this:
networks:
proxy:
In your Wordpress/MySQL docker-compose.yml you must specify a name for the external network like this:
networks:
proxy:
external:
name: "traefik_proxy"
When you create a new application using compose, everything in the application gets a prefix, that is the directoryname in which the compose file is placed.
Meaning the above example only works if your traefik compose file is placed in a directory named "traefik"
This should fix your issue with connectivity.

DroneCI server 0.8 unable to open database file

I'm struggling to get DroneCI up and running, using the below (sanitized) docker-compose.yaml.
(See link at bottom for output from docker-compose up executions).
# Docker compose file syntax:
version: '2'
services:
drone-server:
image: drone/drone:0.8
ports:
- 5124:8000
- 5125:9000
volumes:
- '/var/lib/drone:/var/lib/drone/:Z'
restart: always
environment:
- DRONE_OPEN=true
- DRONE_HOST=http://drone.COMPANY.intra:80
- DRONE_STASH=true
- DRONE_STASH_GIT_USERNAME=USERNAME
- DRONE_STASH_GIT_PASSWORD=PASSWORD
- DRONE_STASH_CONSUMER_KEY=CONSUMER_KEY
- DRONE_STASH_CONSUMER_RSA=/etc/bitbucket/key.pem
- DRONE_STASH_URL=https://COMPANY_URL.intra
- DRONE_SECRET=SECRET1
volumes:
- '/etc/bitbucket/key.pem:/etc/bitbucket/key.pem:Z'
drone-agent:
image: drone/agent:0.8
restart: always
depends_on:
- drone-server
volumes:
- /var/run/docker.sock:/var/run/docker.sock:Z
environment:
- DRONE_SERVER=http://drone.COMPANY.intra
- DRONE_SECRET=SECRET1
What is it I am missing/not seeing?
I found this, which seems eerily familiar...
However, if that's the root cause, how can I set the permissions of a database file I'm currently assuming resides in the drone/drone:0.8 image?
(Seems strange that it'd be the container creating it though...)
There's also no mention of a database file in the official documentation, neither here nor here =/.
Links:
Original discussion #discourse.drone.io.
(Was advised to try my luck here # S/O).
Link to promised gist with normal (and verbose) - sanitized! - output:
https://gist.github.com/x10an14/d2bca6c0287a281404d2d3385f73a084#file-output-txt-L43
There are (at least) two things wrong with your docker-compose file:
1) you have the volumes: section twice in the config for the drone server, consolidate and put both volume mappings in the same section
2) in the drone agent config, the URL of the drone server is wrong, it shouldn't include the http:// scheme and it's missing the port, try DRONE_SERVER=drone-server:9000
docker-compose.yml
# Docker compose file syntax:
version: '2'
services:
drone-server:
image: drone/drone:0.8
ports:
- 5124:8000
- 5125:9000
volumes:
- '/var/lib/drone:/var/lib/drone/:Z'
- '/etc/bitbucket/key.pem:/etc/bitbucket/key.pem:Z'
restart: always
environment:
- DRONE_OPEN=true
- DRONE_HOST=http://drone.COMPANY.intra:80
- DRONE_STASH=true
- DRONE_STASH_GIT_USERNAME=USERNAME
- DRONE_STASH_GIT_PASSWORD=PASSWORD
- DRONE_STASH_CONSUMER_KEY=CONSUMER_KEY
- DRONE_STASH_CONSUMER_RSA=/etc/bitbucket/key.pem
- DRONE_STASH_URL=https://COMPANY_URL.intra
- DRONE_SECRET=SECRET1
drone-agent:
image: drone/agent:0.8
restart: always
depends_on:
- drone-server
volumes:
- /var/run/docker.sock:/var/run/docker.sock:Z
environment:
- DRONE_SERVER=drone-server:9000
- DRONE_SECRET=SECRET1

Resources