Skip to content

Commit

Permalink
Updated to Ghost 0.9.
Browse files Browse the repository at this point in the history
Added Docker Cloud support and updated README.
Added styling for blockquotes.
Updated Sass and Bourbon Neat and included source maps.
Other dependency updates.
  • Loading branch information
Donovan Muller committed Sep 4, 2016
1 parent da22756 commit 97d537d
Show file tree
Hide file tree
Showing 20 changed files with 238 additions and 99 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
node_modules
app/bower_components
dist*
/dist*
.tmp
.sass-cache
.idea
*.iml
*.map

# Ghost
*.db
Expand Down
129 changes: 93 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
![Brage Theme Screenshot](http://i.imgur.com/0ydeDsH.png)

**Live demo at [brage.switchbit.io](http://brage.switchbit.io/)**
**Live demo at [brage.switchbit.io](https://brage.switchbit.io/)**

# Brage Ghost Theme

A [Ghost](https://ghost.org/) theme built using Gulp.

This theme can be used as is or as a seed project for developing your own Ghost theme using Gulp to simplify and speed up development.

Please read the following post for a more detailed description of the various Gulp tasks: **[blog.switchbit.io/developing-a-ghost-theme-with-gulp](http://blog.switchbit.io/developing-a-ghost-theme-with-gulp)**
Please read the following blog series for a more detailed description: **[blog.switchbit.io/tag/ghost-tag](https://blog.switchbit.io/tag/ghost-tag/)**

To make developing a custom Ghost theme as seamless as possible, you would expect the following:

Expand All @@ -26,6 +26,8 @@ As well as the usual suspects for optimising our assets.
The layout of the Gulp tasks as well as some of the configurations are inspired by Stefan Imhoff's ["Introduction to Gulp.js 15: Performance Improvements with WebP and Gzip"](http://stefanimhoff.de/2014/gulp-tutorial-15-performance-improvements-webp-gzip/)

## Using the Brage theme as is

### By building a release

If you simply want to use the Brage theme for your own Ghost blog then you can [download](https://github.com/switchbitio/brage-ghost-theme/releases) the latest release
or if you prefer building it yourself, clone this repository and run:
Expand All @@ -38,6 +40,95 @@ $ gulp dist && gulp zip

Then upload the `brage-ghost-theme.zip` to your Ghost Pro instance or [install](https://www.digitalocean.com/community/questions/installing-themes-in-ghost) on your own hosted Ghost instance.

### By running it with Docker Compose

> #### Blog URL
>
> You must specify the blog URL by setting the `BLOG_URL` environment variable.
> For example, if you would like a blog URL of `http://my-blog.com`, then `BLOG_URL` must be
> set to `http://my-blog.com`.
If you choose to run your Ghost blog as Docker containers, you can stand up a complete production instance of Ghost,
with the Brage theme installed, by running the following:

```
# You MUST have docker-compose > 1.4.0 installed
$ gulp ghost:docker
```

This will use `docker-compose` to build the images and stand up the following containers:

* `brage_content` - A volume container that will contain your Ghost content, theme files etc.
* `brage_ghost` - Container that will contain your Ghost instance. This is separated from your blog content so that you can upgrade Ghost versions or configurations without losing your content.
* `brage_nginx` - An nginx container pre-configured and optimised to serve your Ghost blog

You can navigate to [http://localhost](http://localhost)
or the blog URL referenced by `BLOG_URL` to view your Ghost instance.

**NOTE:** You must first setup your blog by going to [http://localhost/ghost](http://localhost/ghost) and following the instructions.
Once you're done setting up your blog.

### By running in Docker Cloud

You can run your Brage themed Ghost instance in [Docker Cloud](https://cloud.docker.com/_/dashboard/onboarding) by using the
Ghost Nginx Stack and the [Brage Docker image](https://hub.docker.com/r/donovanmuller/ghost-with-brage-theme/).

> Make sure you have a Docker Cloud account that has a valid Cloud Provider connected.
> If you don't have an existing cloud provider, I recommend using [Digital Ocean](https://m.do.co/c/9063364d02d8) (note: this is a referral link).
#### Nginx Ghost Stack

The [Nginx Ghost Stack](https://github.com/donovanmuller/nginx-ghost-stack) provides the necessary
platform to proxy a Ghost instance with the following features:

* Optimised asset caching strategies
* SLL/TLS encryption using [Let's Encrypt](https://letsencrypt.org/)
* All content is served using HTTP/2 when possible

Click the button below to create and deploy a Nginx Ghost Stack.

[![Deploy to Docker Cloud](https://files.cloud.docker.com/images/deploy-to-dockercloud.svg)](https://cloud.docker.com/stack/deploy/?repo=https://github.com/donovanmuller/nginx-ghost-stack)

#### Brage Ghost Stack

Once you have the Nginx Ghost Stack successfully running in Docker Cloud, click the button below
to create the Brage Ghost Stack, which will be proxied by the Nginx Ghost Stack.

[![Deploy to Docker Cloud](https://files.cloud.docker.com/images/deploy-to-dockercloud.svg)](https://cloud.docker.com/stack/deploy/?repo=https://github.com/switchbitio/brage-ghost-theme/docker/cloud)

**Before deploying the Stack** make sure to provide the necessary details matching your blog for the following
environment variables in the Stack file:

```yaml
...

ghost:
image: donovanmuller/ghost-with-brage-theme:0.9
volumes_from:
- ghost-content
environment:
- VIRTUAL_HOST=?
- LETSENCRYPT_HOST=?
- LETSENCRYPT_EMAIL=?
- BLOG_URL=?
restart: always
```
Once you've added your specific values you can click the "Create & Deploy" button.
The Nginx Ghost Stack should take care of requesting and installing your certificate and configuring
the Nginx proxy. After a few seconds your blog should be available at `BLOG_URL`.

*Please see [Part 5](https://blog.switchbit.io/developing-a-ghost-theme-with-gulp-part-5) of the Developing a Ghost theme with Gulp for a more detailed guide.*

### Mail configuration

By default [Mailgun](http://www.mailgun.com/) is used as the mail provider.
Set the following environment variables (`MAILGUN_USER` and `MAILGUN_PASSWORD`) for the `brage_ghost` container to the correct values for your Mailgun account.
You can also add these to `docker/ghost/Dockerfile`.

Alternatively, configure Ghost mail in `docker/ghost/config-prod.js` according to these instructions: [http://support.ghost.org/mail](http://support.ghost.org/mail).
Don't forget to rebuild (this is done for you with `gulp ghost:docker`) your images after making any changes.

## Developing your own theme

If you want to use Brage Ghost theme as a seed project to develop your own theme and assuming you have Gulp installed, install all dependencies:
Expand Down Expand Up @@ -92,40 +183,6 @@ $ gulp dist && gulp zip
The theme `.zip` will be located in the `dist` directory.
You can now upload your theme to your Ghost Pro instance or install on your self hosted Ghost instance.

## Run as Docker containers

If you choose to run your Ghost blog as Docker containers, you can stand up a complete production instance of Ghost, with the Brage theme installed, by running the following:

```
# You MUST have docker-compose > 1.4.0 installed
$ gulp ghost:docker
```

This will use `docker-compose` to build the images and stand up the following containers:

* `brage_content` - A volume container that will contain your Ghost content, theme files etc.
* `brage_ghost` - Container that will contain your Ghost instance. This is separated from your blog content so that you can upgrade Ghost versions or configurations without losing your content.
* `brage_nginx` - An nginx container pre-configured and optimised to serve your Ghost blog

You can navigate to [http://localhost:2368](http://localhost:2368) or the blog URL configured in `docker/ghost/config-prod.js` to view your Ghost instance.

**NOTE:** You must first setup your blog by going to [http://localhost:2368/ghost](http://localhost:2368/ghost) and following the instructions.
Once you're done setting up your blog, don't forget to select the Brage theme under `Settings > General > Theme`.

### Mail configuration

By default [Mailgun](http://www.mailgun.com/) is used as the mail provider.
Set the following environment variables (`MAILGUN_USER` and `MAILGUN_PASSWORD`) for the `brage_ghost` container to the correct values for your Mailgun account.
You can also add these to `docker/ghost/Dockerfile`.

Alternatively, configure Ghost mail in `docker/ghost/config-prod.js` according to these instructions: [http://support.ghost.org/mail](http://support.ghost.org/mail).
Don't forget to rebuild (this is done for you with `gulp ghost:docker`) your images after making any changes.

### Blog URL

The default blog URL is brage.switchbit.io.
Change the URL to that of your blog in `docker/ghost/config-prod.js` and don't forget to rebuild your Ghost image.

## License

See the LICENSE file for license rights and limitations (MIT).
Expand Down
7 changes: 7 additions & 0 deletions app/assets/scss/base/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,10 @@ p, li {
font-size: 1.2rem;
color: $black;
}

blockquote {
padding: 20px 40px;
background-color: lighten($code-grey, 2%);
margin: 0;
border-bottom: $secondary-colour 1px solid;
}
1 change: 0 additions & 1 deletion app/assets/scss/screen.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// endbower

// Bourbon Neat - http://neat.bourbon.io/

//$visual-grid: true;

@import "grid-settings.scss";
Expand Down
6 changes: 4 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"name": "Brage",
"version": "1.2.0",
"description": "Brage Ghost theme"
"version": "1.3.0",
"description": "Brage Ghost theme",
"repository": "switchbitio/brage-ghost-theme",
"license" : "MIT"
}
15 changes: 15 additions & 0 deletions docker/cloud/docker-cloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ghost-content:
image: donovanmuller/ghost-content:0.9
command: echo "Ghost content volume"
autoredeploy: false

ghost:
image: donovanmuller/ghost-with-brage-theme:0.9
volumes_from:
- ghost-content
environment:
- VIRTUAL_HOST=?
- LETSENCRYPT_HOST=?
- LETSENCRYPT_EMAIL=?
- BLOG_URL=?
restart: always
2 changes: 1 addition & 1 deletion docker/content/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM ghost:0.8
FROM ghost:0.9

VOLUME $GHOST_CONTENT
72 changes: 72 additions & 0 deletions docker/docker-compose.https.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
version: "2"

services:

nginx-ghost-proxy-template:
image: donovanmuller/nginx-ghost-proxy-template:1
container_name: nginx-ghost-proxy-template
command: echo "Ghost Nginx proxy configuration volume"

letsencrypt-certs:
image: busybox
container_name: letsencrypt-certs
volumes:
- "/etc/nginx/certs"
command: echo "Letsencrypt certificate volume"

nginx-proxy:
image: nginx:1
container_name: nginx-proxy
ports:
- "80:80"
- "443:443"
volumes_from:
- letsencrypt-certs
- nginx-ghost-proxy-template
networks:
- proxy-tier

nginx-gen:
image: jwilder/docker-gen:0.7.3
container_name: nginx-gen
volumes:
- "/var/run/docker.sock:/tmp/docker.sock:ro"
volumes_from:
- nginx-proxy
- nginx-ghost-proxy-template
entrypoint: /usr/local/bin/docker-gen -notify-sighup nginx-proxy -watch -only-exposed -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf

letsencrypt-nginx-proxy-companion:
image: jrcs/letsencrypt-nginx-proxy-companion:latest
container_name: letsencrypt-nginx-proxy-companion
volumes_from:
- nginx-proxy
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
environment:
- NGINX_DOCKER_GEN_CONTAINER=nginx-gen

content:
build: content
container_name: ghost-content
command: echo "Ghost content volume"

ghost:
build: ghost
container_name: ghost
volumes_from:
- content
environment:
- VIRTUAL_HOST=?
- VIRTUAL_NETWORK=nginx-proxy
- VIRTUAL_PORT=2368
- LETSENCRYPT_HOST=?
- LETSENCRYPT_EMAIL=?
- BLOG_URL=http://brage.switchbit.local.io
networks:
- proxy-tier

networks:
proxy-tier:
external:
name: nginx-proxy
8 changes: 5 additions & 3 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ nginx:
ports:
- "80:80"
links:
- brage-ghost
- ghost

brage-ghost:
ghost:
build: ghost
ports:
- "2368:2368"
volumes_from:
- content
environment:
- BLOG_URL=http://brage.switchbit.local.io

content:
build: content
command: echo "Brage ghost blog content volume"
command: echo "Ghost content volume"
10 changes: 5 additions & 5 deletions docker/ghost/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FROM ghost:0.8
FROM ghost:0.9

WORKDIR $GHOST_SOURCE
ADD dist/ content/themes/brage
RUN sed -i.bak s/casper/brage/g "/usr/src/ghost/core/server/data/schema/default-settings.json"

ADD config-prod.js config.example.js

ENV NODE_ENV production
ENV BLOG_URL ?
ENV MAILGUN_USER ?
ENV MAILGUN_PASSWORD ?

COPY brage-entrypoint.sh /brage-entrypoint.sh
RUN ["chmod", "+x", "/brage-entrypoint.sh"]
ENTRYPOINT ["/brage-entrypoint.sh"]
CMD ["npm", "start"]
EXPOSE 2368
11 changes: 0 additions & 11 deletions docker/ghost/brage-entrypoint.sh

This file was deleted.

2 changes: 1 addition & 1 deletion docker/ghost/config-prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var path = require('path'),

config = {
production: {
url: 'http://brage.switchbit.io',
url: process.env.BLOG_URL,

database: {
client: 'sqlite3',
Expand Down
2 changes: 1 addition & 1 deletion docker/nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nginx:1-alpine
FROM nginx:1

COPY nginx.conf /etc/nginx/nginx.conf
COPY brage-blog /etc/nginx/sites-enabled/brage-blog
Expand Down
Loading

0 comments on commit 97d537d

Please sign in to comment.