Skip to content
This repository was archived by the owner on Feb 27, 2019. It is now read-only.

Commit d96c429

Browse files
committed
Running Wordpress on SailAbove
1 parent 69d30d8 commit d96c429

File tree

2 files changed

+113
-0
lines changed

2 files changed

+113
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
layout: post
3+
title: "Running Wordpress on SailAbove"
4+
categories: docker
5+
tags: guide, getting-started, wordpress
6+
lang: en
7+
author: gierschv
8+
---
9+
10+
[Wordpress](http://wordpress.org) is a free and open source blogging tool and a
11+
content management system (CMS) based on PHP and MySQL. WordPress is used by
12+
more than 22.0% of the top 10 million websites as of August 2013 and is the most
13+
popular blogging system in use on the Web, at more than 60 million websites.
14+
15+
*Requirements for this guide*: the
16+
[SailAbove command line](https://pypi.python.org/pypi/sail/). See the
17+
[SailAbove getting started](/kb/en/docker/getting-started-with-sailabove-docker.html)
18+
for more information.
19+
20+
# 1. Application architecture
21+
22+
The application that we'll deploy here will be structured as two services: the
23+
*Wordpress* application and a *MySQL* database, we'll use the two existing
24+
official images [Wordpress](https://registry.hub.docker.com/_/wordpress/) and
25+
[MySQL](https://registry.hub.docker.com/_/mysql/) provided and maintained by
26+
Docker Inc.
27+
28+
Since both of these images uses the Docker's
29+
[VOLUME](https://docs.docker.com/reference/builder/#volume) metadata, SailAbove
30+
will automatically provide us a persistent block storage and will configure it
31+
for our two containers.
32+
33+
To safely deploy our application, both services will be exposed on a dedicated
34+
private network provided by RunAbove (in blue on the schema below), and only the
35+
Wordpress web application will be available on a public IP. The Wordpress
36+
application will communicate with its database using a class
37+
[Docker link](https://docs.docker.com/userguide/dockerlinks/) within its private
38+
network.
39+
40+
![Application architecture](/kb/images/2015-01-14-running-wordpress-on-sailabove/containers.png)
41+
42+
# 2. Bookmark the two Docker Images
43+
44+
To easily use the two official images from the Docker Hub on RunAbove, we'll
45+
[bookmark them](/kb/en/docker/boot-a-sailabove-container-from-a-docker-image-hosted-on-the-docker-hub.html)
46+
in our SailAbove account (you must replace ```<application>``` with your
47+
application name, e.g. if your application is named "example", you should have
48+
example/mysql in the examples below):
49+
50+
```bash
51+
$ sail repositories add external <application>/mysql -s https://registry.hub.docker.com/_/mysql/
52+
$ sail repositories add external <application>/wordpress -s https://registry.hub.docker.com/_/wordpress/
53+
```
54+
55+
# 3. Deploy the MySQL service
56+
57+
We'll now add a new SailAbove service named "**wordpress-mysql**" that'll boot
58+
the official MySQL Docker image we just bookmarked.
59+
60+
We explicitely specify that this service will only be exposed on the private
61+
network of the application, and add a random root password in its environment,
62+
as [specified in the image documentation](https://registry.hub.docker.com/_/mysql/).
63+
64+
```bash
65+
$ sail services add --network private -e MYSQL_ROOT_PASSWORD=mysecretpassword <application>/mysql wordpress-mysql
66+
Fetching tag mysql:latest
67+
Fetching meta of layer 310c359af360
68+
Service wordpress-mysql changed state to init
69+
[...]
70+
```
71+
72+
# 4. Deploy the Wordpress service
73+
74+
We can now add the Wordpress application linked to our database with the name
75+
"mysql", as [required by the Docker image](https://registry.hub.docker.com/_/wordpress/).
76+
77+
This service will launch on our application private network and SailAbove
78+
reverse proxy network called "predictor" where its HTTP port (80) will be
79+
published.
80+
81+
```bash
82+
$ sail services add -p 80:80 --link wordpress-mysql:mysql --network predictor --network private <application>/wordpress wordpress
83+
Fetching tag wordpress:latest
84+
Fetching meta of layer dd95974be471
85+
Service wordpress changed state to init
86+
[...]
87+
```
88+
89+
# 5. [Optional] Add a domain name
90+
91+
Optionaly, we can easily attach a domain name to our Wordpress. First we need to
92+
register it on the reverse proxy (here is an example if we wanted to register
93+
"www.example.com"):
94+
95+
```bash
96+
$ sail services domain-attach <application>/wordpress www.example.com
97+
```
98+
99+
Now, we just need to add a CNAME in our DNS zone pointing to our wordpress
100+
service:
101+
102+
```bash
103+
www.example.com CNAME wordpress.<application>.app.sailabove.io.
104+
```
105+
106+
# 6. The end
107+
108+
That's all. Your Wordpress is ready, you can now configure its option by
109+
browsing your own domain url or
110+
```http://wordpress.<application>.app.sailabove.io```.
111+
112+
113+
Loading

0 commit comments

Comments
 (0)