{"action":"created","comment":{"url":"https://api.github.com/repos/runabove/knowledge-base/pulls/comments/68246361","id":68246361,"diff_hunk":"@@ -0,0 +1,87 @@\n+---\n+layout: post\n+title:  \"How to deploy a Wordpress with Marathon\"\n+categories: docker\n+author: brouberol\n+lang: en\n+---\n+\n+In this tutorial, we'll see how to deploy a wordpress CMS, along with a MySQL database and a PhpMyAdmin management web interface. As the Docker PaaS does not yet support stateful containers, we'll order the database from the [PaaS DB MySQL](https://www.runabove.com/PaaSDBMySQL.xml).\n+\n+## First and foremost\n+\n+This tutorial assumes you already have a [PaaS Docker](https://www.runabove.com/docker-with-mesos-marathon.xml) and [PaaS MySQL](https://www.runabove.com/PaaSDBMySQL.xml) account.\n+\n+If you haven't already read our [introduction to Docker with Mesos and Marathon](/kb/en/docker/introduction-to-docker-with-mesos-marathon.html), you should probably read it before diving in.\n+\n+## Installing the MySQL database\n+\n+For your MySQL instance to be fully operational, you need to complete the following steps:\n+\n+* create a database (eg: wordpress)\n+* create a user account protected by a password, with read-write rights on the previously created database\n+\n+You can refer to the [PaaS DB tutorial](https://www.ovh.co.uk/g2216.getting_started_with_the_mysql_and_postgresql_paas_db) for more details.\n+\n+## Restrict access to the database to your container IPs\n+\n+In order to make your database accessible from your containers, you have to specify which IPs are authorised to connect to your instance. You can get your container IPs using our API. For example\n+\n+```bash\n+$ curl -u \"<username>:<password>\" https://lb.<cluster>.containers.ovh.net/api/v1/slaves/ip\n+{\n+  \"objects\": [\n+    \"165.118.227.114\",\n+    \"165.118.231.44\"\n+  ]\n+}\n+```\n+**Note**: you can derive the value of both `username` and `cluster` from the address of your marathon web ui. For example, if your UI URL is `http://lb.sbg-1.containers.ovh.net/marathon/docker-abcdef-1/`, the value of `cluster` and `username` are respectively `sbg-1` and `docker-abcdef-1`. The password is the one you use to access the Marathon web UI.\n+\n+![whitelist](/kb/images/2016-06-21-deploying-wordpress-on-marathon/whitelist.png)\n+\n+## Deploy the PhpMyAdmin manager\n+\n+We'll use the [https://hub.docker.com/r/phpmyadmin/phpmyadmin/](phpmyadmin/phpmyadmin) image, hosted on the Docker Hub.\n+\n+You'll need to configure the PhpMyAdmin so that it exposes the TCP container port 80 to the load balancer.\n+\n+![pma1](/kb/images/2016-06-21-deploying-wordpress-on-marathon/phpmyadmin.png)\n+\n+You then need to set environment variables, to define the host and port of your MySQL database:\n+\n+* `PMA_HOSTS`: the value listed in the [sunrise manager](https://www.ovh.com/manager/sunrise), section (Paas Database), in the project instance details page, under the name \"Access URL\"\n+* `PMA_PORT`: the value listed in the [sunrise manager](https://www.ovh.com/manager/sunrise), section (Paas Database), in the project instance details page, under the name \"Service port\"\n+\n+Then, add some labels to [redirect your logs to the PaaS logs](/kb/en/docker/marathon-container-logs.html), and [configure the http vhost](/kb/en/docker/marathon-load-balancer.html) of your app.\n+\n+Finally, configure an [HTTP health-check](/kb/en/docker/marathon-health-checks.html) on the path `/`.\n+\n+![pma2](/kb/images/2016-06-21-deploying-wordpress-on-marathon/phpmyadmin2.png)\n+\n+Once your app is displayed as healthy in your marathon web interface, you should be able to access the PhpMyAdmin welcome page by requesting the configured vhost. In the previous screenshot, we set it to `pma.<username>.lb.<cluster>.containers.ovh.net`.\n+\n+![pma3](/kb/images/2016-06-21-deploying-wordpress-on-marathon/phpmyadmin-welcome.png)\n+\n+## Deploy the wordpress container\n+\n+We'll use the official [wordpress image](https://hub.docker.com/_/wordpress/), hosted on the Docker Hub.\n+\n+Similarly to PhpMyAdmin, we need to:\n+\n+* expose the TCP container port 80 on the LB\n+* configure the container environment to define the DB host, port and credentials\n+* add the [Paas Logs label](/kb/en/docker/marathon-container-logs.html) to be able to see the container logs in the PaaS Logs Graylog\n+* configure the container vhost\n+* configure the container HTTP health checks\n+\n+![wp1](/kb/images/2016-06-21-deploying-wordpress-on-marathon/wordpress.png)\n+![wp2](/kb/images/2016-06-21-deploying-wordpress-on-marathon/wordpress2.png)\n+\n+Once again, you should be able to reach the wordpress welcome page by requesting the configured vhost.\n+\n+![wp-welcome](/kb/images/2016-06-21-deploying-wordpress-on-marathon/wordpress-welcome.png)\n+\n+# Conclusion\n+\n+You now have 3 stateless wordpress containers, communicating with a MySQL database, which you can manage from a web interface.","path":"en/_posts/2016-06-21-deploying-wordpress-on-marathon.md","position":87,"original_position":87,"commit_id":"1abd854b63a7125bd24a3271453cf99b5668da59","original_commit_id":"1abd854b63a7125bd24a3271453cf99b5668da59","user":{"login":"brouberol","id":480131,"avatar_url":"https://avatars.githubusercontent.com/u/480131?v=3","gravatar_id":"","url":"https://api.github.com/users/brouberol","html_url":"https://github.com/brouberol","followers_url":"https://api.github.com/users/brouberol/followers","following_url":"https://api.github.com/users/brouberol/following{/other_user}","gists_url":"https://api.github.com/users/brouberol/gists{/gist_id}","starred_url":"https://api.github.com/users/brouberol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brouberol/subscriptions","organizations_url":"https://api.github.com/users/brouberol/orgs","repos_url":"https://api.github.com/users/brouberol/repos","events_url":"https://api.github.com/users/brouberol/events{/privacy}","received_events_url":"https://api.github.com/users/brouberol/received_events","type":"User","site_admin":false},"body":"Ah, good catch! I'll add this side note, and will remove it when we support stateful containers.","created_at":"2016-06-23T14:37:08Z","updated_at":"2016-06-23T14:37:08Z","html_url":"https://github.com/runabove/knowledge-base/pull/138#discussion_r68246361","pull_request_url":"https://api.github.com/repos/runabove/knowledge-base/pulls/138","_links":{"self":{"href":"https://api.github.com/repos/runabove/knowledge-base/pulls/comments/68246361"},"html":{"href":"https://github.com/runabove/knowledge-base/pull/138#discussion_r68246361"},"pull_request":{"href":"https://api.github.com/repos/runabove/knowledge-base/pulls/138"}}},"pull_request":{"url":"https://api.github.com/repos/runabove/knowledge-base/pulls/138","id":74959026,"html_url":"https://github.com/runabove/knowledge-base/pull/138","diff_url":"https://github.com/runabove/knowledge-base/pull/138.diff","patch_url":"https://github.com/runabove/knowledge-base/pull/138.patch","issue_url":"https://api.github.com/repos/runabove/knowledge-base/issues/138","number":138,"state":"open","locked":false,"title":"Add new article: deploy wordpress/mysql/phpmyadmin","user":{"login":"brouberol","id":480131,"avatar_url":"https://avatars.githubusercontent.com/u/480131?v=3","gravatar_id":"","url":"https://api.github.com/users/brouberol","html_url":"https://github.com/brouberol","followers_url":"https://api.github.com/users/brouberol/followers","following_url":"https://api.github.com/users/brouberol/following{/other_user}","gists_url":"https://api.github.com/users/brouberol/gists{/gist_id}","starred_url":"https://api.github.com/users/brouberol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brouberol/subscriptions","organizations_url":"https://api.github.com/users/brouberol/orgs","repos_url":"https://api.github.com/users/brouberol/repos","events_url":"https://api.github.com/users/brouberol/events{/privacy}","received_events_url":"https://api.github.com/users/brouberol/received_events","type":"User","site_admin":false},"body":"Signed-off-by: Balthazar Rouberol <balthazar.rouberol@corp.ovh.com>","created_at":"2016-06-23T13:55:05Z","updated_at":"2016-06-23T14:37:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"72ad9d49489b60a4822e79cdae7e5a6e986bfc23","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/runabove/knowledge-base/pulls/138/commits","review_comments_url":"https://api.github.com/repos/runabove/knowledge-base/pulls/138/comments","review_comment_url":"https://api.github.com/repos/runabove/knowledge-base/pulls/comments{/number}","comments_url":"https://api.github.com/repos/runabove/knowledge-base/issues/138/comments","statuses_url":"https://api.github.com/repos/runabove/knowledge-base/statuses/1abd854b63a7125bd24a3271453cf99b5668da59","head":{"label":"brouberol:master","ref":"master","sha":"1abd854b63a7125bd24a3271453cf99b5668da59","user":{"login":"brouberol","id":480131,"avatar_url":"https://avatars.githubusercontent.com/u/480131?v=3","gravatar_id":"","url":"https://api.github.com/users/brouberol","html_url":"https://github.com/brouberol","followers_url":"https://api.github.com/users/brouberol/followers","following_url":"https://api.github.com/users/brouberol/following{/other_user}","gists_url":"https://api.github.com/users/brouberol/gists{/gist_id}","starred_url":"https://api.github.com/users/brouberol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brouberol/subscriptions","organizations_url":"https://api.github.com/users/brouberol/orgs","repos_url":"https://api.github.com/users/brouberol/repos","events_url":"https://api.github.com/users/brouberol/events{/privacy}","received_events_url":"https://api.github.com/users/brouberol/received_events","type":"User","site_admin":false},"repo":{"id":57949739,"name":"knowledge-base","full_name":"brouberol/knowledge-base","owner":{"login":"brouberol","id":480131,"avatar_url":"https://avatars.githubusercontent.com/u/480131?v=3","gravatar_id":"","url":"https://api.github.com/users/brouberol","html_url":"https://github.com/brouberol","followers_url":"https://api.github.com/users/brouberol/followers","following_url":"https://api.github.com/users/brouberol/following{/other_user}","gists_url":"https://api.github.com/users/brouberol/gists{/gist_id}","starred_url":"https://api.github.com/users/brouberol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brouberol/subscriptions","organizations_url":"https://api.github.com/users/brouberol/orgs","repos_url":"https://api.github.com/users/brouberol/repos","events_url":"https://api.github.com/users/brouberol/events{/privacy}","received_events_url":"https://api.github.com/users/brouberol/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/brouberol/knowledge-base","description":"RunAbove knowledge base website","fork":true,"url":"https://api.github.com/repos/brouberol/knowledge-base","forks_url":"https://api.github.com/repos/brouberol/knowledge-base/forks","keys_url":"https://api.github.com/repos/brouberol/knowledge-base/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brouberol/knowledge-base/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brouberol/knowledge-base/teams","hooks_url":"https://api.github.com/repos/brouberol/knowledge-base/hooks","issue_events_url":"https://api.github.com/repos/brouberol/knowledge-base/issues/events{/number}","events_url":"https://api.github.com/repos/brouberol/knowledge-base/events","assignees_url":"https://api.github.com/repos/brouberol/knowledge-base/assignees{/user}","branches_url":"https://api.github.com/repos/brouberol/knowledge-base/branches{/branch}","tags_url":"https://api.github.com/repos/brouberol/knowledge-base/tags","blobs_url":"https://api.github.com/repos/brouberol/knowledge-base/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brouberol/knowledge-base/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brouberol/knowledge-base/git/refs{/sha}","trees_url":"https://api.github.com/repos/brouberol/knowledge-base/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brouberol/knowledge-base/statuses/{sha}","languages_url":"https://api.github.com/repos/brouberol/knowledge-base/languages","stargazers_url":"https://api.github.com/repos/brouberol/knowledge-base/stargazers","contributors_url":"https://api.github.com/repos/brouberol/knowledge-base/contributors","subscribers_url":"https://api.github.com/repos/brouberol/knowledge-base/subscribers","subscription_url":"https://api.github.com/repos/brouberol/knowledge-base/subscription","commits_url":"https://api.github.com/repos/brouberol/knowledge-base/commits{/sha}","git_commits_url":"https://api.github.com/repos/brouberol/knowledge-base/git/commits{/sha}","comments_url":"https://api.github.com/repos/brouberol/knowledge-base/comments{/number}","issue_comment_url":"https://api.github.com/repos/brouberol/knowledge-base/issues/comments{/number}","contents_url":"https://api.github.com/repos/brouberol/knowledge-base/contents/{+path}","compare_url":"https://api.github.com/repos/brouberol/knowledge-base/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brouberol/knowledge-base/merges","archive_url":"https://api.github.com/repos/brouberol/knowledge-base/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brouberol/knowledge-base/downloads","issues_url":"https://api.github.com/repos/brouberol/knowledge-base/issues{/number}","pulls_url":"https://api.github.com/repos/brouberol/knowledge-base/pulls{/number}","milestones_url":"https://api.github.com/repos/brouberol/knowledge-base/milestones{/number}","notifications_url":"https://api.github.com/repos/brouberol/knowledge-base/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brouberol/knowledge-base/labels{/name}","releases_url":"https://api.github.com/repos/brouberol/knowledge-base/releases{/id}","deployments_url":"https://api.github.com/repos/brouberol/knowledge-base/deployments","created_at":"2016-05-03T07:24:24Z","updated_at":"2016-05-03T07:24:26Z","pushed_at":"2016-06-23T13:57:35Z","git_url":"git://github.com/brouberol/knowledge-base.git","ssh_url":"git@github.com:brouberol/knowledge-base.git","clone_url":"https://github.com/brouberol/knowledge-base.git","svn_url":"https://github.com/brouberol/knowledge-base","homepage":null,"size":10551,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"runabove:master","ref":"master","sha":"00e0d04fbfbc0755cba7bb893eb59e438dee4802","user":{"login":"runabove","id":7061018,"avatar_url":"https://avatars.githubusercontent.com/u/7061018?v=3","gravatar_id":"","url":"https://api.github.com/users/runabove","html_url":"https://github.com/runabove","followers_url":"https://api.github.com/users/runabove/followers","following_url":"https://api.github.com/users/runabove/following{/other_user}","gists_url":"https://api.github.com/users/runabove/gists{/gist_id}","starred_url":"https://api.github.com/users/runabove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/runabove/subscriptions","organizations_url":"https://api.github.com/users/runabove/orgs","repos_url":"https://api.github.com/users/runabove/repos","events_url":"https://api.github.com/users/runabove/events{/privacy}","received_events_url":"https://api.github.com/users/runabove/received_events","type":"Organization","site_admin":false},"repo":{"id":23181374,"name":"knowledge-base","full_name":"runabove/knowledge-base","owner":{"login":"runabove","id":7061018,"avatar_url":"https://avatars.githubusercontent.com/u/7061018?v=3","gravatar_id":"","url":"https://api.github.com/users/runabove","html_url":"https://github.com/runabove","followers_url":"https://api.github.com/users/runabove/followers","following_url":"https://api.github.com/users/runabove/following{/other_user}","gists_url":"https://api.github.com/users/runabove/gists{/gist_id}","starred_url":"https://api.github.com/users/runabove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/runabove/subscriptions","organizations_url":"https://api.github.com/users/runabove/orgs","repos_url":"https://api.github.com/users/runabove/repos","events_url":"https://api.github.com/users/runabove/events{/privacy}","received_events_url":"https://api.github.com/users/runabove/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/runabove/knowledge-base","description":"RunAbove knowledge base website","fork":false,"url":"https://api.github.com/repos/runabove/knowledge-base","forks_url":"https://api.github.com/repos/runabove/knowledge-base/forks","keys_url":"https://api.github.com/repos/runabove/knowledge-base/keys{/key_id}","collaborators_url":"https://api.github.com/repos/runabove/knowledge-base/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/runabove/knowledge-base/teams","hooks_url":"https://api.github.com/repos/runabove/knowledge-base/hooks","issue_events_url":"https://api.github.com/repos/runabove/knowledge-base/issues/events{/number}","events_url":"https://api.github.com/repos/runabove/knowledge-base/events","assignees_url":"https://api.github.com/repos/runabove/knowledge-base/assignees{/user}","branches_url":"https://api.github.com/repos/runabove/knowledge-base/branches{/branch}","tags_url":"https://api.github.com/repos/runabove/knowledge-base/tags","blobs_url":"https://api.github.com/repos/runabove/knowledge-base/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/runabove/knowledge-base/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/runabove/knowledge-base/git/refs{/sha}","trees_url":"https://api.github.com/repos/runabove/knowledge-base/git/trees{/sha}","statuses_url":"https://api.github.com/repos/runabove/knowledge-base/statuses/{sha}","languages_url":"https://api.github.com/repos/runabove/knowledge-base/languages","stargazers_url":"https://api.github.com/repos/runabove/knowledge-base/stargazers","contributors_url":"https://api.github.com/repos/runabove/knowledge-base/contributors","subscribers_url":"https://api.github.com/repos/runabove/knowledge-base/subscribers","subscription_url":"https://api.github.com/repos/runabove/knowledge-base/subscription","commits_url":"https://api.github.com/repos/runabove/knowledge-base/commits{/sha}","git_commits_url":"https://api.github.com/repos/runabove/knowledge-base/git/commits{/sha}","comments_url":"https://api.github.com/repos/runabove/knowledge-base/comments{/number}","issue_comment_url":"https://api.github.com/repos/runabove/knowledge-base/issues/comments{/number}","contents_url":"https://api.github.com/repos/runabove/knowledge-base/contents/{+path}","compare_url":"https://api.github.com/repos/runabove/knowledge-base/compare/{base}...{head}","merges_url":"https://api.github.com/repos/runabove/knowledge-base/merges","archive_url":"https://api.github.com/repos/runabove/knowledge-base/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/runabove/knowledge-base/downloads","issues_url":"https://api.github.com/repos/runabove/knowledge-base/issues{/number}","pulls_url":"https://api.github.com/repos/runabove/knowledge-base/pulls{/number}","milestones_url":"https://api.github.com/repos/runabove/knowledge-base/milestones{/number}","notifications_url":"https://api.github.com/repos/runabove/knowledge-base/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/runabove/knowledge-base/labels{/name}","releases_url":"https://api.github.com/repos/runabove/knowledge-base/releases{/id}","deployments_url":"https://api.github.com/repos/runabove/knowledge-base/deployments","created_at":"2014-08-21T09:24:33Z","updated_at":"2016-05-02T13:45:04Z","pushed_at":"2016-06-23T13:57:35Z","git_url":"git://github.com/runabove/knowledge-base.git","ssh_url":"git@github.com:runabove/knowledge-base.git","clone_url":"https://github.com/runabove/knowledge-base.git","svn_url":"https://github.com/runabove/knowledge-base","homepage":null,"size":19859,"stargazers_count":45,"watchers_count":45,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":81,"mirror_url":null,"open_issues_count":1,"forks":81,"open_issues":1,"watchers":45,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/runabove/knowledge-base/pulls/138"},"html":{"href":"https://github.com/runabove/knowledge-base/pull/138"},"issue":{"href":"https://api.github.com/repos/runabove/knowledge-base/issues/138"},"comments":{"href":"https://api.github.com/repos/runabove/knowledge-base/issues/138/comments"},"review_comments":{"href":"https://api.github.com/repos/runabove/knowledge-base/pulls/138/comments"},"review_comment":{"href":"https://api.github.com/repos/runabove/knowledge-base/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/runabove/knowledge-base/pulls/138/commits"},"statuses":{"href":"https://api.github.com/repos/runabove/knowledge-base/statuses/1abd854b63a7125bd24a3271453cf99b5668da59"}}}}
{"actor":{"display_login":"brouberol"}}