Last active
January 5, 2016 11:16
-
-
Save puja108/288661c993d282319f44 to your computer and use it in GitHub Desktop.
Ghost and Wordpress using Docker on Giant Swarm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "oghost", | |
"components": { | |
"oghost": { | |
"image": "ghost", | |
"ports": [ | |
"2368/tcp" | |
], | |
"domains": { | |
"2368/tcp": [ | |
"oghost.gigantic.io" | |
] | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "owordpress", | |
"components": { | |
"mysql": { | |
"image": "mysql:5.5", # I want 5.5, our team (cheating here) told me it's nice and small | |
"ports": [ | |
"3306/tcp" | |
], | |
"env": [ | |
"MYSQL_ROOT_PASSWORD=$mypass" # This is how you hand over environment variables to the swarm, same as -e in the docker command line. The $mypass is looked up in the swarmvars.json or can be passed on the command line | |
], | |
"volumes": [ # Here I am creating a bit of storage outside of the container, so the container can restart without the data being lost | |
{ | |
"path": "/var/lib/mysql", | |
"size": "2 GB" | |
} | |
] | |
}, | |
"wordpress": { | |
"image": "wordpress:latest", # I want the latest version here | |
"ports": [ | |
"80/tcp" I tell the swarm that the container is communicating on port 80 | |
], | |
"env": [ | |
"WORDPRESS_DB_PASSWORD=$mypass" # Same as above, passing environment variables to the container | |
] | |
], | |
"volumes": [ # Again storage, this time for wordpress, so that custom files like plugins or uploaded images don't get lost | |
{ | |
"path": "/var/www/html", | |
"size": "2 GB" | |
} | |
], | |
"domains": { | |
"80/tcp": [ | |
"blog.thylmann.net", # This was for testing before I moved my blog completely using the next line | |
"owp.gigantic.io" # Yes, I did it | |
] | |
}, | |
"links": [ # The wordpress container should link to a MySQL container, as it doesn't work without it | |
{ | |
"component": "mysql", | |
"target_port": "3306/tcp" | |
} | |
] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Possible typo report: IIUC, line 14 is missing a '$' in front of 'mypass'...although perhaps 'mypass' would also change there if you want WP accessing mysql with something other than the root password.