database error
Closed this issue · 4 comments
This looks like a very promising project, but I can't get it running. Would you mind providing some example instructions?
This is what I see:
$ docker run -d -p 8888:80 ghcr.io/n0rthernl1ghts/wordpress:latest
a01b3c63d8a6763a9a030ddb5d1fb1bed80988f390397079be5269f1baec5370
$ curl -Is http://localhost:8888|grep HTTP
HTTP/1.1 500 Internal Server Error
$ curl -s http://localhost:8888|grep title
<title>Database Error</title>
Hey, have you been able to deploy a database it can connect to? As long as it's a single and not large project, I often deploy separate database instances within the stack.
I have to admit that documentation is bad, to non-existent. I'll work on improving it.
This is the template I built and I've been using for most of my deployments:
version: '3.7'
x-wp-env: &wp-env
WORDPRESS_PLUGIN_LIST: "cloudflare cookie-law-info redis-cache two-factor wp-mail-smtp wp-simple-firewall"
WORDPRESS_DB_USER: example_user
WORDPRESS_DB_NAME: example_database
WORDPRESS_DB_HOST: mariadb
WORDPRESS_DB_PASSWORD: 'XXXXXXXX'
WORDPRESS_TABLE_PREFIX: 'exmpl_'
WORDPRESS_AUTH_KEY: "XXXXXXXX"
WORDPRESS_SECURE_AUTH_KEY: "XXXXXXXX"
WORDPRESS_LOGGED_IN_KEY: "XXXXXXXX"
WORDPRESS_NONCE_KEY: "XXXXXXXX"
WORDPRESS_AUTH_SALT: "XXXXXXXX"
WORDPRESS_SECURE_AUTH_SALT: "XXXXXXXX"
WORDPRESS_LOGGED_IN_SALT: "XXXXXXXX"
WORDPRESS_NONCE_SALT: "XXXXXXXX"
WORDPRESS_DEBUG: 0
WORDPRESS_CONFIG_EXTRA: |
define('WP_SITEURL', 'https://www.example.com');
define('WP_HOME', 'https://www.example.com');
define('WP_CACHE', true);
define('WP_CACHE_KEY_SALT', 'Example-');
define('WP_REDIS_HOST', "cache");
services:
cache:
image: 'redis:alpine'
labels:
- "autoheal=true"
deploy:
resources:
reservations:
memory: 32M
limits:
memory: 64M
networks:
default:
restart: unless-stopped
healthcheck:
test: ["CMD", "/usr/local/bin/redis-cli", "PING"]
interval: 20s
timeout: 3s
retries: 3
wordpress:
image: 'ghcr.io/n0rthernl1ghts/wordpress:6.2.0'
labels:
- "traefik.enable=true"
- "traefik.http.routers.examplewp-http.rule=Host(`www.example.com`)"
- "traefik.http.routers.examplewp-http.entrypoints=web"
- "traefik.http.routers.examplewp-https.tls=true"
- "traefik.http.routers.examplewp-https.tls.certresolver=le"
- "traefik.http.routers.examplewp-https.rule=Host(`www.example.com`)"
- "traefik.http.routers.examplewp-https.entrypoints=websecure"
- "traefik.http.services.examplewp.loadbalancer.server.port=80"
environment: *wp-env
volumes:
- wordpress_data:/var/www/html/wp-content
networks:
default:
ingress:
restart: unless-stopped
deploy:
replicas: 3
update_config:
parallelism: 1
delay: 5s
order: start-first
resources:
reservations:
cpus: '1'
memory: 256M
limits:
cpus: '2'
memory: 512M
healthcheck:
test: ["CMD", "/usr/local/bin/healthcheck", "true"]
interval: 20s
timeout: 10s
retries: 3
start_period: 5s
mariadb:
image: 'nlss/mariadb:latest'
environment:
MARIADB_DATABASE: "example_database,example_database2,example_database3"
MARIADB_USERNAME: "example_user"
MARIADB_PASSWORD: "XXXXXXXX"
MARIADB_ROOT_PASSWORD: "YYYYYYYYYYY"
volumes:
- mariadb_data:/var/lib/mysql
- mariadb_backup:/var/lib/backup
- mariadb_log:/var/log/mysql
networks:
default:
healthcheck:
test: ["CMD", "/usr/bin/healthcheck"]
interval: 30s
timeout: 20s
retries: 3
deploy:
restart_policy:
condition: any
resources:
reservations:
cpus: '1'
memory: 1024M
limits:
cpus: '4'
memory: 2048M
networks:
default:
ingress:
external:
name: "traefik_net"
volumes:
wordpress_data:
mariadb_data:
mariadb_backup:
mariadb_log:
This is swarm-ready stack that deploys WordPress, redis cache and Maria DB server.
Note that only WordPress you can have multiple replicas. For redis and Maria DB you need a different setup.
It includes necessary internal wiring and by running it, you should have a working setup in no time.
- If you don't use Traefik, you'll need to remove
ingress
network.
Thanks for your reply. I've given this a few tries, both with and without Traefik (which I hadn't used before), created a network for traefik and a volume for wordpress_data
.
However, I'm currently stuck on a 500 Internal Server Error
. This happens with both curl http://www.example.com/
and curl http://www.example.com/wp-admin/
(having www.example.com
set to 127.0.0.1
in my /etc/hosts
).
Is there a better way to debug, than just docker logs
for these containers?
thanks again!!
I don't have enough details, nor I can reproduce the issue.
I suggest setting the environment variable WORDPRESS_DEBUG
to 1 and looking at the logs.
It could be helpful to paste the output here.
Since there is no activity, and I couldn't confirm this as an actual issue, I'll close the issue. Feel free to reopen.