HOW TO UPGRADE GHOST ON OPENSHIFT

本文详细介绍如何使用Git方式在OpenShift平台上升级Ghost博客系统,包括拉取源代码、更新最新版本、编辑package.json文件等步骤。

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.

转载于:https://www.cnblogs.com/chendeshen/p/4189953.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值