标签:
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.
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.
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.
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
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.
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.
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‘
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.
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