码迷,mamicode.com
首页 > 其他好文 > 详细

HOW TO UPGRADE GHOST ON OPENSHIFT

时间:2014-12-28 15:30:18      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:

First congratulations for the release of Ghost 0.4.2 this week!

As the title indicates, this post is not about how to install Ghost on OpenShift, it’s about how to upgrade it.

Installing Ghost on OpenShift is quite easy with the quickstart script while upgrading it is not so straight forward. It really took me some time to figure out how to upgrade it in the OpenShift way.

Yes, the OpenShift way, the best practice to upgrade Ghost on OpenShift, which is the git way.

The Git Way

OpenShift utilize git for source code management. Upgrading Ghost means updating its source code.

To upgrade Ghost in the OpenShift way, you need to pull the source code from OpenShift server, update it with the latest Ghost source, then push it back to OpenShift server. If you are familiar with git, you may already know how to do it properly. If you’re not, here are the details.

 

You may want to get yourself familiar with git by reading this simple guide first.

Step 1: Pull the source code from OpenShift server to local machine

For Linux users, simply type the following command to checkout the repository.

git clone ssh://your-openshift-repo-url

You can get the URL of the repository from the OpenShift application console.

If you already have the repository cloned, you can run git pull to update your local tree.

Step 2: Update the working directory with the latest Ghost source

Download the latest version of Ghost, extract the files directly to the directory of your local tree. By doing this, all existing files will be up to date and all new files will be added. For Linux users, simply type the following command.

unzip -uo ghost-latest.zip -d path-to-your-git-repo

Step 3: Edit package.json

We need to change the line

"main": "./core/index"

to

"main": "index.js"

in package.json.

This step is a must, otherwise it won’t work on OpenShift.

Step 4: Stage all changes

Run the following command to make all changes staged.

git add .

If you are not confident, you can run git add -i to review all changes.

Step 5: Commit the changes

After all these changes we’ve made, we must commit them to the head tree by the following command.

git commit -m ‘upgrade to ghost 0.4.2‘

Step 6: Push it back to OpenShift

Here comes the final step, just run

git push

Upon running this command, OpenShift will take care of everything else and redeploy the application. After the command finishes, your new Ghost will be ready to go.

Conclusion

Although OpenShift provides ssh access by which you can make changes directly on remote server, git should always be your first consideration.

Whenever you want to make changes for your application, it is better to work in your local tree and then push back to OpenShift. That’s the work flow suggested by OpenShift.

For example if you want to install a new theme for Ghost, extract the theme files to the proper directory in your local tree, then do a git add, git commit and git push. That is the best practice.

HOW TO UPGRADE GHOST ON OPENSHIFT

标签:

原文地址:http://www.cnblogs.com/chendeshen/p/4189953.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!