Skip to content

Commit 3faa118

Browse files
author
Curtis Rissi
committed
style and formatting fixes
1 parent 0174289 commit 3faa118

5 files changed

+68
-60
lines changed

_drafts/2016-08-11-getting-back-into-the-swing-of-things.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22
layout: post
33
title: 2016-08-11-getting-back-into-the-swing-of-things
44
permalink: getting-back-into-the-swing-of-things
5-
date: '2016-08-11 21:20:00'
5+
date: '2016-08-10 01:20:00'
66
tags: [Blogging, Jekyll]
77
cover: http://assets.boringgeek.com/closedLaptopWithGlassesOnDesk.jpg
88
description: "Getting back into the swing of things with blogging and making content again."
99
comments: true
1010
---
1111

12-
This is a test of getting back into the swing of blogging and working with drafts.
12+
This is a test of getting back into the swing of blogging and working with drafts.
13+
14+
15+
```php
16+
git commit -m "Removed directory from tracking and added to .gitignore" sdfsdfsfssdf
17+
```

_posts/2014-07-22-how-to-setup-ghost-on-elastic-beanstalk.md

+49-48
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ To get started, you will need access and familiarity with the following AWS tool
2121
5. EBS - for ephemeral storage
2222
6. IAM - to allow access to mount EBS volumes
2323

24-
###Setup Simple Email Service
24+
### Setup Simple Email Service
2525
The first step in this process is to get yourself setup with SES. This will be your blogs email mechanism and will allow you to track things like bounces, complaints and successes all from with the AWS console. Now, to be honest, you could just use your GMail account or any other SMTP server you access to. However, if you're planning on making your blog a success - getting the stats on bounces and complaints is worth setting up SES.
2626

27-
####Setup
27+
#### Setup
2828
1. Created a Verified Email
2929
1. Log into the AWS console and select the SES service from the menu
3030
2. Under the "Verified Senders" heading on the left navigation, click "Email Addresses"
@@ -41,10 +41,10 @@ The first step in this process is to get yourself setup with SES. This will be y
4141
1. If you don't already have production access to send email via SES, you'll need to request it. From the SES Dashboard, click the "Request Production Access" button at the top of the screen.
4242
2. This will take you to a support screen to request a "Service Limit Increase". Fill out the form with accurate information and submit it. They will review your request and either approve it or contact you with any questions.
4343

44-
###Setup Persistent Storage
44+
### Setup Persistent Storage
4545
By default, Ghost stores images and other data within the `content` directory. However, since we're using Elastic Beanstalk, if your instance becomes unhealthy, AWS will kill it - and take that `content` directory with it. To get around this, we're going to use a combination of EBS and ebextension configs to mount persistent storage and symlink those directories over to it. To get started we'll need to create an EBS volume.
4646

47-
####Create an EBS Volume
47+
#### Create an EBS Volume
4848
1. From the EC2 console, click the `volumes` link on the left navigation.
4949
2. Click the `Create Volume` button.
5050
3. Follow the wizard to create a volume
@@ -59,7 +59,7 @@ Now you have a volume, however, this is basically the equivalent of adding a dri
5959
3. Run `sudo mkfs -t ext4 device_name` swapping out `device_name` for that of your particular device.
6060
4. Logout of the shell and unmount the volume from that instance. If you created that instance for this step, now is a good time to terminate the instance as well.
6161

62-
####Create an IAM User
62+
#### Create an IAM User
6363
In order to allow our scripts to mount the EBS volume, we will need to create an IAM user and grant it the specific permissions needed to accomplish this.
6464

6565
1. From the IAM Console, click the `Users` link on the left navigation
@@ -85,26 +85,26 @@ In order to allow our scripts to mount the EBS volume, we will need to create an
8585
15. Click the `Add Statement`
8686

8787

88-
###Prepare Ghost for Installation
88+
### Prepare Ghost for Installation
8989
Based on our configuration within AWS, we need to make some minor tweaks to our Ghost codebase before we can begin the installation.
9090

91-
####Download Ghost
91+
#### Download Ghost
9292
1. Down load a copy of Ghost from the [Ghost download page](https://ghost.org/download/)
9393
2. Unzip it somewhere convenient for you to access it
9494

95-
####Modify the Default Node.js HTTP Port
95+
#### Modify the Default Node.js HTTP Port
9696
In order to get node working in Beanstalk, you will need to ensure it using the correct port: `8081`. This is the port used by Elastic Beanstalks HTTP nGinx web server.
9797

9898
1. From within the Ghost directory, create a copy of `config.example.js` and name it `config.js`.
9999
2. Edit the `server` section of the file and change the port reference from `2368` to `8081` in both the "Development" and "Production" sections of the file.
100100

101-
#####Modify the Default URL
101+
##### Modify the Default URL
102102
In order to actually use this as a production instance, you will need to update the `config.js` file to reflect your desired url for your blog.
103103

104104
1. Edit `config.js` and update the `url` value in both the `development` and `production` sections of the file to reflect the correct url
105105
2. Save the file.
106106

107-
####Ensure the Proper Node.js Version
107+
#### Ensure the Proper Node.js Version
108108
Ghost is built to run on Node.js version `0.10.*`, but Beanstalk will default to `0.8.*`. To ensure that your Beanstalk Environment provisions with the proper version, we will need to instruct it to via EB's "[ebextensions](http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers.html)" functionality.
109109

110110
1. In the root of your ghost directory (the one with "content" and "core"), create a new folder called `.ebextensions`.
@@ -117,7 +117,7 @@ Ghost is built to run on Node.js version `0.10.*`, but Beanstalk will default to
117117

118118
This config will get executed during the provisioning of your environment and ensure that your Node.js server starts up with the correct version that Ghost needs.
119119

120-
####Configure the EBS Mount
120+
#### Configure the EBS Mount
121121
As we have the EBS volume and user permissions created, we need to setup another extensions config script that will attach the volume at boot. To do this, we will use an undocumented post-deploy hook that will run the script after the application has been deployed. This is essential as this depends on symbolic links that point `/var/app/current/content/data` and `/var/app/current/content/images` to `/var/app/data/` where we will mount our ebs volume.
122122

123123
1. Create another file in your `.ebextensions` folder called `01_mount_volumes.config` and put the following into it:
@@ -176,44 +176,43 @@ Be sure to update it with the following information:
176176

177177
Also, if you copy and pasted the script from above, it may be a good idea to paste it into a [YAML validator](http://yamllint.com/) to ensure the format is good; things like an extra `tab` will cause all kinds of headaches.
178178

179-
####MySQL RDS Configuration
179+
#### MySQL RDS Configuration
180180
1. Edit the `config.js` file
181-
1. Under both the `development` and `production` sections of the config:
182-
1. Delete the "sqlite3" connection string:
183-
184-
database: {
185-
client: 'sqlite3',
186-
connection: {
187-
filename: path.join(__dirname, '/content/data/ghost-dev.db')
188-
},
189-
debug: false
190-
},
191-
192-
2. Replace it with the RDS connection strings:
193-
194-
database: {
195-
client: 'mysql',
196-
connection: {
197-
host: process.env.RDS_HOSTNAME,
198-
user: process.env.RDS_USERNAME,
199-
password: process.env.RDS_PASSWORD,
200-
database: 'ebdb',
201-
charset: 'utf8'
202-
},
203-
debug: true
204-
},
205-
206-
3. Save the File
181+
2. Under both the `development` and `production` sections of the config:
182+
3. Delete the "sqlite3" connection string:
183+
database: {
184+
client: 'sqlite3',
185+
connection: {
186+
filename: path.join(__dirname, '/content/data/ghost-dev.db')
187+
},
188+
debug: false
189+
},
190+
4. Replace it with the RDS connection strings:
191+
```
192+
database: {
193+
client: 'mysql',
194+
connection: {
195+
host: process.env.RDS_HOSTNAME,
196+
user: process.env.RDS_USERNAME,
197+
password: process.env.RDS_PASSWORD,
198+
database: 'ebdb',
199+
charset: 'utf8'
200+
},
201+
debug: true
202+
},
203+
```
204+
5. Save the File
207205
3. Edit `package.json` to remove the Sqlite requirements.
208206
1. Under the `dependencies` section delete the line for Sqlite.
209207
2. Save and close the file.
210208

211209

212-
####Configure the SMTP Settings for SES
210+
#### Configure the SMTP Settings for SES
213211
1. Edit `config.js`
214212
2. Delete the commented mail section under Development and Production. Replace it with the following:
215213

216-
mail: {
214+
```
215+
mail: {
217216
transport: 'SMTP',
218217
host: 'YOUR-SES-SERVER-NAME',
219218
options: {
@@ -225,19 +224,20 @@ Also, if you copy and pasted the script from above, it may be a good idea to pas
225224
}
226225
}
227226
}
227+
```
228228
3. Be sure to replace the following sections with your SES information
229229
1. Host - replace this with the "Server Name" listed on the SES Consoles "SMTP Settings" page. Mine was `email-smtp.us-west-2.amazonaws.com`, but yours will vary based on the region you configured SES in.
230230
2. user and pass - these will be found in the `credentials.csv` that you downloaded during the SES setup above.
231231
4. Save the file and close it.
232232

233-
####Package it all up
233+
#### Package it all up
234234
Now that the necessary config has been done, we need to zip up the directory and get it;ready for uploading to Elastic Beanstalk.
235235

236236
To do this:
237237

238238
1. Create a zip of your ghost installation. You will want the configuration files and the ghost `core` and `content` folders to be at the root level of the zip.
239239

240-
###Setup and Deploy to Elastic Beanstalk
240+
### Setup and Deploy to Elastic Beanstalk
241241
Now that you have all the preliminary work done, we can go ahead and start setting up our hosting.
242242

243243
1. From the Elastic Beanstalk Console, click the `Create a New Application` button
@@ -275,10 +275,10 @@ Now sit back and wait. It will take about 20 minutes for your RDS instance to co
275275

276276
You will note that the URL does not match the one you put in your `config.js` though. Instead, the url will resemble something along the lines of `my-app-env.elasticbeanstalk.com`. This is expected. To use your own domain name, you will need to create a DNS CNAME the points your domain to the Elastic Beanstalk URL. Instructions on this will vary based how you manage your DNS Service. I recommend using CloudFlare, detailed below.
277277

278-
###Next Steps
278+
### Next Steps
279279
So now that you have your blog up and running, you could just stop there. However, if you really plan on **blogging**, you should consider doing some additional steps to protect your blog from hackers, make it go faster and let it scale - for when it become really popluar.
280280

281-
####CloudFlare
281+
#### CloudFlare
282282
For those of you who aren't familiar with [Cloudflare](http://www.cloudflare.com), its a great - *free* - service to add on top of any site that helps speed it up, keep it safe and reduce load.
283283

284284
Note: CloudFlare replaces your current DNS service, so you'll need access to your domain registrar to update your name servers.
@@ -289,20 +289,21 @@ Here is a high-level overview of some of its benefits:
289289
2. **Overhead**. If the bulk of your content is static, then the majority of your traffic will be served by the caches. This means your server will only see cache refreshes or dynamic content requests and you can size your instances smaller than if they had to server it all. And we all know smaller instances cost less!
290290
2. **Security**. As all traffic routes through them, they scan it for known threats and block them before they reach your servers. This is a huge deal as protecting your site from being hacked will help ensure a happy blogging experience for both you and your readers.
291291

292-
####Centralized Storage
292+
#### Centralized Storage
293293
One of the downsides to Elastic Beanstalk is that the storage is not persistent and its not shared. We solved this for a single instance environment using our second EBS volume for our content directory. However, if you scale your site up beyond a single instance, this won't work. As this affects one of our goals of scaling with demand, this is definitely no bueno. But have no fear, using [S3FS](https://code.google.com/p/s3fs/wiki/FuseOverAmazon), you can mount an S3 bucket as your content directory. This works *pretty well* - so long as you don't use AWS's US-EAST-1 region - and will allow your site to scale to multiple instances without issue. If the load of your site demands, I would highly reccomend doing this.
294294

295-
####Monitoring and Logging
295+
#### Monitoring and Logging
296296
As with any production-level environment, its always a good practice to setup proper monitoring, alerts and logging. Elastic Beanstalk make this quite straight-forward as you get basic infrastructure monitoring out of the box. I would recommend taking some time to setup the basic thresholds and alerts to notify you of any issues that may arise. You can also enable CloudWatch Logging through an ebextensions config that will send all your system logs to CloudWatch where you can create custom alerts based on events within your logs. [Here is a good walkthrough of the process](http://aws.amazon.com/blogs/aws/cloudwatch-log-service/).
297297

298298
Couple these with Google Analytics within your theme or through CloudFlare and you'll have everything you need to monitor traffic and performance for your blog.
299299

300-
###Conclusion
300+
### Conclusion
301301
If everything went correctly, you should now have a stable, durable blogging environment that you can grow with your demand. I hope you found this walkthrough useful. If anything, its a great way to exercise your knowledge of the AWS stack and its many useful services.
302302

303303
If you have any questions or suggestions, feel free to use the comments below or hit me up via [Twitter](http://twitter.com/boringgeek).
304304

305-
####Sources:
305+
#### Sources:
306+
306307
- [Six Steps to Deploy Ghost to AWS Elastic Beanstalk](http://blogs.aws.amazon.com/application-management/post/Tx37ALIK2KLNIVC/Six-Steps-to-Deploy-Ghost-to-AWS-Elastic-Beanstalk)
307308
- [Installing Ghost & Getting Started](http://docs.ghost.org/installation/deploy/)
308309
- [Using Amazon RDS with Node.js](http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs.rds.html)

0 commit comments

Comments
 (0)