Cross post from /r/docker as I think that forum has given me all the help they can here…
…
I’m a web developer but I have been parachuted into a DevOps role I did not ask for because I have set up a few old school LAMP servers in the past and I’m being pushed for results. The client wants to use Docker for development and deployment of a WordPress site to AWS EB. I can’t get my head around the deployment…
Here is my previous post about setting up the development environment if anyone is interested:
https://www.reddit.com/r/docker/comments/gi1i83/questions_about_docker_as_a_development/
So here’s where I’m at now… I have a docker-compose.yml file (two actually - one for development and one for deployment) and those appear to work. Here is the ‘deploy’ file:
version: “3.3”
services:
wordpress:
container_name: deploy-wordpress
build: ./wordpress
restart: always
environment:
WORDPRESS_DB_HOST: 'my-rds-instance.rds.amazonaws.com:3306'
WORDPRESS_DB_USER: admin
WORDPRESS_DB_PASSWORD: password
WORDPRESS_DB_NAME: wordpress
ports:
- 80:80
I can run ‘docker-compose up’ and it is visible on port 80 and connects to RDS. Great!
But when I try to run ‘eb create eb-wp-test-production’ to deploy to EB it creates an unusable environment with ‘Severe’ health. This is the output of that command (just the errors with the irrelevant stuff taken out):
eb create eb-wp-test-production
error: open(“mysql/ca-key.pem”): Permission denied
fatal: cannot hash mysql/ca-key.pem
[...]
2020-05-13 19:37:28 ERROR [Instance: i-096ff1f0fa0362cc0] Command failed on instance. An unexpected error has occurred [ErrorCode: 0000000001].
2020-05-13 19:37:28 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2020-05-13 19:38:30 ERROR Create environment operation is complete, but with errors. For more information, see troubleshooting documentation.
My understanding was that I just need a Dockerrun.aws.json file to perform this task. Here’s what I have:
{
“AWSEBDockerrunVersion”: “1”,
“Authentication”: {
“Bucket”: “my-bucket-with-docker-conf”,
“Key”: “dockercfg”
},
“Image”: {
“Name”: “my-dockerhub-username/eb_wp_test:v0.2”,
“Update”: “true”
},
“Ports”: [
{
“ContainerPort”: “80”
}
],
“Volumes”: [
{
“HostDirectory”: “/wordpress/src”,
“ContainerDirectory”: “/var/www/html”
}
],
“Logging”: “/var/log/apache2”
}
Questions:
-
Does ‘docker-compose build’ put all the environment variables etc from docker-compose.yml into the image? In other words does docker-compose have anything to do with running the image outside of my local environment?
-
If the answer to the above is no… how do I set it up for use on AWS EB? Just with the Dockerrun.aws.json file?
-
I’m not doing anything with MySQL so what is the error…
error: open(“mysql/ca-key.pem”): Permission denied
fatal: cannot hash mysql/ca-key.pem
… and why do I get it?
- I think I am missing an “Entrypoint” and “Command” in the above file, what should these be for WordPress on Apache? Is this the real problem here?
Thanks in advance for any help anyone can give me!