Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Ghost is a free, open, simple blogging platform. Visit the project's website at <http://ghost.org>, or read the docs on <http://support.ghost.org>.

## Ghost version 1.X
## Ghost version 4.X

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)

Expand Down Expand Up @@ -60,10 +60,9 @@ heroku config:set S3_BUCKET_REGION=us-east-1 --app YOURAPPNAME

### How this works

This repository is a [Node.js](https://nodejs.org) web application that specifies [Ghost as a dependency](https://docs.ghost.org/v1.0.0/docs/using-ghost-as-an-npm-module), and makes a deploy button available.
This repository is a [Node.js](https://nodejs.org) web application that specifies [Ghost as a dependency](https://www.npmjs.com/package/ghost), and makes a deploy button available.

* Ghost and Casper theme versions are declared in the Node app's [`package.json`](package.json)
* Scales across processor cores in larger dynos via [Node cluster API](https://nodejs.org/dist/latest-v6.x/docs/api/cluster.html)
* Ghost, Casper theme, and Lyra theme versions are declared in the Node app's [`package.json`](package.json)

## Updating source code

Expand Down Expand Up @@ -95,7 +94,7 @@ See more about [deploying to Heroku with git](https://devcenter.heroku.com/artic

### Upgrading Ghost

On each deployment, the Heroku Node/npm build process will **auto-upgrade Ghost to the newest 1.x version**. To prevent this behavior, use npm 5+ (or yarn) to create a lockfile.
On each deployment, the Heroku Node/npm build process will **auto-upgrade Ghost to the newest 4.x version**. To prevent this behavior, use npm 5+ (or yarn) to create a lockfile.

```bash
npm install
Expand Down
5 changes: 1 addition & 4 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
"postdeploy": "bin/init-deployment"
},
"success_url": "/ghost",
"addons": [
"jawsdb",
"mailgun"
],
"addons": ["jawsdb", "mailgun"],
"env": {
"PUBLIC_URL": {
"description": "The HTTPS URL of this app: either your custom domain or default 'herokuapp.com' hostname.",
Expand Down
7 changes: 5 additions & 2 deletions bin/common/env-values.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
module.exports = {
mysqlDatabaseUrl: process.env.MYSQL_DATABASE_URL || process.env.JAWSDB_URL || process.env.CLEARDB_DATABASE_URL
}
mysqlDatabaseUrl:
process.env.MYSQL_DATABASE_URL ||
process.env.JAWSDB_URL ||
process.env.CLEARDB_DATABASE_URL
};
120 changes: 61 additions & 59 deletions bin/create-config
Original file line number Diff line number Diff line change
@@ -1,50 +1,82 @@
#!/usr/bin/env node
// Ghost Configuration for Heroku

var fs = require('fs');
var path = require('path');
var url = require('url');
const fs = require('fs');
const path = require('path');
const url = require('url');

var envValues = require('./common/env-values');
var appRoot = path.join(__dirname, '..');
const envValues = require('./common/env-values');
const appRoot = path.join(__dirname, '..');

function createConfig() {
var fileStorage, storage;
const getMysqlConfig = connectionUrl => {
if (connectionUrl === null) {
return {};
}

const dbConfig = url.parse(connectionUrl);
if (dbConfig === null) {
return {};
}

const dbAuth = dbConfig.auth ? dbConfig.auth.split(':') : [];
const dbUser = dbAuth[0];
const dbPassword = dbAuth[1];

let dbName;
if (dbConfig.pathname === null) {
dbName = 'ghost';
} else {
dbName = dbConfig.pathname.split('/')[1];
}

const dbConnection = {
host: dbConfig.hostname,
port: dbConfig.port || '3306',
user: dbUser,
password: dbPassword,
database: dbName
};
return dbConnection;
};

const createConfig = () => {
let fileStorage;
let storage;

if (!!process.env.S3_ACCESS_KEY_ID) {
fileStorage = true
fileStorage = true;
storage = {
active: 's3',
's3': {
accessKeyId: process.env.S3_ACCESS_KEY_ID,
s3: {
accessKeyId: process.env.S3_ACCESS_KEY_ID,
secretAccessKey: process.env.S3_ACCESS_SECRET_KEY,
bucket: process.env.S3_BUCKET_NAME,
region: process.env.S3_BUCKET_REGION,
assetHost: process.env.S3_ASSET_HOST_URL
bucket: process.env.S3_BUCKET_NAME,
region: process.env.S3_BUCKET_REGION,
assetHost: process.env.S3_ASSET_HOST_URL
}
}
};
} else if (!!process.env.BUCKETEER_AWS_ACCESS_KEY_ID) {
fileStorage = true
fileStorage = true;
storage = {
active: 's3',
's3': {
accessKeyId: process.env.BUCKETEER_AWS_ACCESS_KEY_ID,
s3: {
accessKeyId: process.env.BUCKETEER_AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.BUCKETEER_AWS_SECRET_ACCESS_KEY,
bucket: process.env.BUCKETEER_BUCKET_NAME,
region: process.env.S3_BUCKET_REGION,
assetHost: process.env.S3_ASSET_HOST_URL
bucket: process.env.BUCKETEER_BUCKET_NAME,
region: process.env.S3_BUCKET_REGION,
assetHost: process.env.S3_ASSET_HOST_URL
}
}
};
} else {
fileStorage = false
storage = {}
fileStorage = false;
storage = {};
}

config = {
url: process.env.PUBLIC_URL,
logging: {
level: "info",
transports: ["stdout"]
level: 'info',
transports: ['stdout']
},
mail: {
transport: 'SMTP',
Expand All @@ -56,8 +88,8 @@ function createConfig() {
}
}
},
fileStorage: fileStorage,
storage: storage,
fileStorage,
storage,
database: {
client: 'mysql',
connection: getMysqlConfig(envValues.mysqlDatabaseUrl),
Expand All @@ -74,37 +106,7 @@ function createConfig() {
};

return config;
}

function getMysqlConfig(connectionUrl) {
if (connectionUrl == null) {
return {};
}

var dbConfig = url.parse(connectionUrl);
if (dbConfig == null) {
return {};
}

var dbAuth = dbConfig.auth ? dbConfig.auth.split(':') : [];
var dbUser = dbAuth[0];
var dbPassword = dbAuth[1];

if (dbConfig.pathname == null) {
var dbName = 'ghost';
} else {
var dbName = dbConfig.pathname.split('/')[1];
}

var dbConnection = {
host: dbConfig.hostname,
port: dbConfig.port || '3306',
user: dbUser,
password: dbPassword,
database: dbName
};
return dbConnection;
}
};

var configContents = JSON.stringify(createConfig(), null, 2);
const configContents = JSON.stringify(createConfig(), null, 2);
fs.writeFileSync(path.join(appRoot, 'config.production.json'), configContents);
18 changes: 9 additions & 9 deletions bin/wait-for-db
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#!/usr/bin/env node

var mysql = require('mysql');
var envValues = require('./common/env-values');
const mysql = require('mysql');
const envValues = require('./common/env-values');

console.error(`Awaiting MySQL database…`);
pingDatabaseUntilConnected();

function pingDatabaseUntilConnected() {
var connection = mysql.createConnection(envValues.mysqlDatabaseUrl);
connection.query('SELECT 1', function (error, results, fields) {
const pingDatabaseUntilConnected = () => {
const connection = mysql.createConnection(envValues.mysqlDatabaseUrl);
connection.query('SELECT 1', (error, results, fields) => {
if (error) {
console.error(`Database not yet available: ${error.message}`);
setTimeout(pingDatabaseUntilConnected, 5000);
Expand All @@ -18,4 +15,7 @@ function pingDatabaseUntilConnected() {
process.exit(0);
}
});
}
};

console.error(`Awaiting MySQL database…`);
pingDatabaseUntilConnected();
5 changes: 1 addition & 4 deletions config.development.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
"transport": "Direct"
},
"logging": {
"transports": [
"file",
"stdout"
]
"transports": ["file", "stdout"]
},
"process": "local",
"paths": {
Expand Down
13 changes: 13 additions & 0 deletions content/settings/routes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
routes:
/signup/: members/signup
/signin/: members/signin
/account/: members/account

collections:
/:
permalink: /{slug}/
template: index

taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
1 change: 1 addition & 0 deletions content/themes/lyra
Loading