forked from thedigitalgarage/dg-ghost-container
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
162 lines (117 loc) · 8.74 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="UTF-8">
<title>Dg-ghost by thedigitalgarage</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="stylesheets/normalize.css" media="screen">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen">
<link rel="stylesheet" type="text/css" href="stylesheets/github-light.css" media="screen">
</head>
<body>
<section class="page-header">
<h1 class="project-name">Dg-ghost</h1>
<h2 class="project-tagline">A Digital Garage Docker image for the Ghost blogging platform.</h2>
<a href="https://github.com/thedigitalgarage/dg-ghost" class="btn">View on GitHub</a>
<a href="https://github.com/thedigitalgarage/dg-ghost/zipball/master" class="btn">Download .zip</a>
<a href="https://github.com/thedigitalgarage/dg-ghost/tarball/master" class="btn">Download .tar.gz</a>
</section>
<section class="main-content">
<h1>
<a id="dg-ghost" class="anchor" href="#dg-ghost" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>dg-ghost</h1>
<p>A Digital Garage Docker image for the <a href="https://github.com/TryGhost/Ghost">Ghost</a> blogging platform.
This image is designed specifically to support the deployment of Ghost via Docker and Kubernetes via the Digital Garage. This image is a bit more configurable than the <a href="https://registry.hub.docker.com/_/ghost/">official Ghost Docker image</a>.</p>
<h1>
<a id="what-is-ghost" class="anchor" href="#what-is-ghost" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>What is Ghost?</h1>
<p>Ghost is a free and open source blogging platform written in JavaScript and distributed under the MIT License, designed to simplify the process of online publishing for individual bloggers as well as online publications.</p>
<p>The concept of the Ghost platform was first floated publicly in November 2012 in a blog post by project founder John O'Nolan, which generated enough response to justify coding a prototype version with collaborator Hannah Wolfe.</p>
<p>The first public version of Ghost, released October 2013, was financed by a successful Kickstarter campaign which achieved its initial funding goal of £25,000 in 11 hours and went on to raise a final total of £196,362 during the 29-day campaign.</p>
<pre><code>wikipedia.org/wiki/Ghost_(blogging_platform)
</code></pre>
<p><img src="https://ghost.org/assets/logos-f93942864f8c9f4a0a9b0ecd6f7f055c.png" alt="ghost"></p>
<h2>
<a id="why-yet-another-container-for-ghost" class="anchor" href="#why-yet-another-container-for-ghost" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Why yet another container for Ghost?</h2>
<p>The official container for Ghost is fine for running in development mode, but it has the wrong
permissions for running in production. That, and the config file doesn't have any easy way to tweak
it.</p>
<p>This container uses the official Ghost image as it's base, has a more "environment aware"
<code>config.js</code> file, and uses these environment variables to tune the config.</p>
<h2>
<a id="quickstart-on-via-docker" class="anchor" href="#quickstart-on-via-docker" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Quickstart on via Docker</h2>
<pre><code>docker run --name some-ghost -d thedigitalgarage/dg-ghost
</code></pre>
<p>This will start Ghost in development mode listening on the default port of 2368.</p>
<p>If you'd like to be able to access the instance from the host without the
contain's IP, standard port mappings can be used:</p>
<pre><code>docker run --name some-ghost -p 8080:2368 -d thedigitalgarage/dg-ghost
</code></pre>
<p>Then, access it via <code>http://localhost:8080</code> or <code>http://host-ip:8080</code> in a browser.</p>
<h2>
<a id="configuration" class="anchor" href="#configuration" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Configuration</h2>
<p>There are three environment variables that can be configured:</p>
<ul>
<li>
<code>GHOST_URL</code>: the URL of your blog (e.g., <code>http://www.example.com</code>)</li>
<li>
<code>MAIL_FROM</code>: the email of the blog installation (e.g., <code>'"Webmaster" <[email protected]>'</code>)</li>
<li>
<code>MAIL_HOST</code>: which host to send email to (e.g., <code>mail.example.com</code>)</li>
</ul>
<p>These can either be set on the Docker command line directly, or stored in a file and passed on
the Docker command line:</p>
<pre><code>sudo cp ghost.example.env /etc/default/ghost
sudo vi /etc/default/ghost
docker run --name some-ghost --env-file /etc/default/ghost -p 8080:2368 -d thedigitalgarage/dg-ghost
</code></pre>
<p>If you have just pulled the Docker image with <code>docker pull thedigitalgarage/dg-ghost</code>, the example
environment file looks like this:</p>
<pre><code># Ghost environment
# Place in /etc/default/ghost
GHOST_URL=http://www.example.com
MAIL_FROM='"Webmaster" <[email protected]>'
MAIL_HOST=mail.example.com
</code></pre>
<h2>
<a id="running-in-production" class="anchor" href="#running-in-production" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Running in production</h2>
<p>The official Ghost image places the blog content in <code>/var/lib/ghost</code> and exports it as a <code>VOLUME</code>.
This allows two main modes of operation:</p>
<h3>
<a id="content-on-host-filesystem" class="anchor" href="#content-on-host-filesystem" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Content on host filesystem</h3>
<p>In this mode, the Ghost blog content lives on the filesystem of the host with the <code>UID</code>:<code>GID</code> of
<code>1000</code>:<code>1000</code>. If this is acceptable, create a directory somewhere, and use the <code>-v</code> Docker command
line option to mount it:</p>
<pre><code>sudo mkdir -p /var/lib/ghost
sudo chown 1000:1000 /var/lib/ghost
docker run --name some-ghost --env-file /etc/default/ghost -p 80:2368 -v /var/lib/ghost:/var/lib/ghost -d ptimof/ghost npm start --production
</code></pre>
<h3>
<a id="content-in-a-data-volume" class="anchor" href="#content-in-a-data-volume" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Content in a data volume</h3>
<p>This is the preferred mechanism to store the blog data. Please see the
<a href="https://docs.docker.com/userguide/dockervolumes/#backup-restore-or-migrate-data-volumes">Docker documentation</a>
for backup, restore, and migration strategies.</p>
<pre><code>docker create -v /var/lib/ghost --name some-ghost-content busybox
docker run --name some-ghost --env-file /etc/default/ghost -p 80:2368 --volumes-from some-ghost-content -d ptimof/ghost npm start --production
</code></pre>
<p>You should now be able to access this instance as <code>http://www.example.com</code> in a browser.</p>
<h3>
<a id="behind-a-reverse-proxy" class="anchor" href="#behind-a-reverse-proxy" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Behind a reverse proxy</h3>
<p>Of course, you should really be running Ghost behind a reverse proxy, and set things up to auto restart. For that,
a reasonable container would be:</p>
<pre><code>docker create --name some-ghost -h ghost.example.com --env-file /etc/default/ghost -p 127.0.0.1:2368:2368 --volumes-from some-ghost-content --restart=on-failure:10 ptimof/ghost npm start --production
docker run some-ghost
</code></pre>
<h2>
<a id="further-reading" class="anchor" href="#further-reading" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Further reading</h2>
<p>If you would like to read more about deploying and runnning this image on Digital Garage, you can find the tutorial on the Digital Garage Community site here:</p>
<ul>
<li>
<a href="http://www.thedigitalgarage.io/community/ghost-deployment/">Deploy Ghost with the Digital Garage Instant App</a>: a tutorial on deploying the Ghost Blogging Platform via Docker and Kubernetes on the Digital Garage.</li>
</ul>
<footer class="site-footer">
<span class="site-footer-owner"><a href="https://github.com/thedigitalgarage/dg-ghost">Dg-ghost</a> is maintained by <a href="https://github.com/thedigitalgarage">thedigitalgarage</a>.</span>
<span class="site-footer-credits">This page was generated by <a href="https://pages.github.com">GitHub Pages</a> using the <a href="https://github.com/jasonlong/cayman-theme">Cayman theme</a> by <a href="https://twitter.com/jasonlong">Jason Long</a>.</span>
</footer>
</section>
</body>
</html>