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:
Related
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.
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.
Is there a way to do this without having to go into the container and install it? Seems kind of weird they wouldn't include this with the Wordpress image. Anyway - Heres what I have at the moment.
How would you do this?
version: '3.3'
services:
db:
image: mysql
restart: always
volumes:
- mysql_data:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=admin
- MYSQL_DATABASE=admin
- MYSQL_USER=admin
- MYSQL_PASSWORD=admin
wordpress:
image: wordpress
depends_on:
- db
ports:
- '1234:80'
restart: always
volumes:
- ./wp-content:/var/www/html/wp-content
environment:
- WORDPRESS_DB_HOST=db:3306
- WORDPRESS_DB_USER=admin
- WORDPRESS_DB_PASSWORD=admin
- WORDPRESS_DB_NAME=admin
- WORDPRESS_TABLE_PREFIX=admin
phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin
restart: always
ports:
- '8080:80'
environment:
- PMA_HOST=db
- MYSQL_ROOT_PASSWORD=admin
volumes:
mysql_data:
driver: local
You can use one of the images tagged with cli, such as:
image: worpress:cli-php7.4
Find the list of available tags on Docker Hub
I have this application.
How can I assign a single ip-address to the web-service and use the database within?
version: "2"
services:
web:
image: kartoffeltoby/typo3:latest
hostname: localhost
container_name: web
ports:
- 80:80
link:
- db:database
volumes:
- ./www/:/var/www/
environment:
- DOCROOT=/var/www/web
- PAGESPEED=Off
db:
image: mysql:5.6
hostname: database
volumes:
- ./DB/:/var/lib/mysql/
- ./db/:/var/tmp/db
environment:
- MYSQL_ROOT_PASSWORD=passwort
The solution is:
network_mode: service:web
version: "2"
services:
typo3:
image: kartoffeltoby/typo3:latest
hostname: axdbw.vagrant
container_name: typo3
volumes:
- ./www/:/var/www/
environment:
- DOCROOT=/var/www/web
- PAGESPEED=Off
networks:
mynet:
ipv4_address: 172.16.47.14
db:
image: mysql:5.6
volumes:
- ./DB/:/var/lib/mysql/
- ./db/:/var/tmp/db
environment:
- MYSQL_ROOT_PASSWORD=passwort
network_mode: service:web
networks:
mynet:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.16.47.0/24
There is no reason to use a specific IP. The solution can be as simple as this:
version: "3"
services:
typo3:
image: kartoffeltoby/typo3:latest
container_name: typo3
networks:
- mynet
db:
image: mysql:5.6
network_mode: "service:typo3"
networks:
mynet:
driver: bridge
This will place the db container onto the same IP as the typo3 container. Beware of possible port collisions.
In my use-case, I had to avoid nasty cross origin errors. Hosting the database on the same IP as my frontend container helped get around those issues.
Question:
Why do I get this error?
ERROR: In file './docker-compose.yml', volume 'mariavolume' must be a mapping not a string.
My docker-compose file is almost identical to this one: https://docs.docker.com/compose/wordpress/
version: '2'
services:
wordpress:
image: wordpress:latest
restart: always
depends_on:
- db
ports:
- 8080:80
environment:
WORDPRESS_DB_PASSWORD: example
WORDPRESS_DB_HOST: 3306
db:
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
volumes:
- maria_volume: /var/lib/mysql
volumes:
maria_volume: ~/mariadb
In my case this was happening because I missed adding a : after the volume name.
Instead of:
volumes:
- mysqldata:
I had typed:
volumes:
- mysqldata
docker-compose up gave me the same error as above.
I've just tackled this issue myself. If you just want a volume to store data, then do as below. This will create/reuse a volume that is persisted to disk as part of the Docker graph driver.
The next question is where is this?.
You can find it inside the docker image - Default Location -
C:\Users\Public\Documents\Hyper-V\Virtual hard disks
db:
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
volumes:
- maria_volume: /var/lib/mysql
volumes:
maria_volume:
Of course, if you are after mapping a host directory into docker rather than having it inside the Docker graph driver. Then you can do it as follows.
db:
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
volumes:
- maria_volume: /var/lib/mysql
volumes:
maria_volume:
driver: local
driver_opts:
o: bind
type: none
device: /C/mariadb
Please note, when mapping over host directories as volume (at least on windows) you can have issues with read/write permissions, something I have yet to resolve myself.
Unfortunately, there is no such a feature.
You can’t map a top-level volume in docker-compose.
Here are the options:
Adding volume per container and map it there. (like what Daniel did here)
Create a volume outside of the compose (with mapping) and use it in your compose.
volumes:
maria_volume:
external:
name: volume-name
try this:
volumes:
- maria_volume: /var/lib/mysql
volumes:
maria_volume:
external:
name: ~/mariadb
correct syntax for volume is
volumes:
first:
where first is just a placeholder name to be used for volume
Try this:
version: '2'
services:
...
db:
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
volumes:
- ~/mariadb:/var/lib/mysql
try this, it works for me
volumes:
- maria_volume: /var/lib/mysql
volumes:
maria_volume:
drive: local
I was running into the same issue as yourself and as a last act of despair I tried putting
volumes:
- maria_volume: /var/lib/mysql
before
environment:
MYSQL_ROOT_PASSWORD: example
I'm not sure what kind of magic applied here but in my case, it worked
Let me know!
For me this works:
In #docker_compose.yml:
volumes:
postgres_data: {}
static: { }