14 Jan 2015
io.js is still beta stability - so please proceed with caution.
I threw together a quick io.js cartridge that can be used on OpenShift.
Two options for testing:
- Bare bones cartridge:
rhc create-app <name> http://tinyurl.com/OpenShiftIOJS
- Cartridge with an express.js hello world example:
rhc create-app <name> http://tinyurl.com/OpenShiftIOJS --from-code https://github.com/connyay/express-openshift-iojs.git
You can find the source for the cartridge here.
I hope you find this useful! If you have any questions feel free to reach out at @_connyay
25 Nov 2014
Intro
What is PencilBlue?
The first open source content management system to meet all the needs of a modern website.
PencilBlue is a CMS built with modern technologies (Node.js, Mongo, and Angular) and has a lot of potential to shake things up. It is light, fast, and extremely flexible.
What is OpenShift?
OpenShift is an application platform in the cloud where application developers and teams can build, test, deploy, and run their applications.
OpenShift manages your cloud infrastructure so all you have to worry about is development. Updating your application on OpenShift is as simple as git push
.
Prerequisites
- Have created an account with OpenShift
- Have installed the rhc command line tools
- Have setup the rhc command line tools by running
rhc setup
- Have added an ssh key via the online console or the
rhc sshkey-add <name> <path to SSH key file>
command
- Have Mac / Linux (Not really, but Windows users will need to adjust some commands. )
Let’s get started!
- Navigate to the directory you’d like to create your new blog in
-
Create a new app on OpenShift with the following command: (replacing <name>
with your desired application name)
Note: If desired, adding -s
to the below command will automatically scale the application with traffic. This setting has to be set during application creation, and can not be changed.
rhc create-app <name> http://tinyurl.com/OpenShiftNodeDIY http://tinyurl.com/OpenShiftRedisCart mongodb-2.4
- What is this command doing?
- After the
create-app
is finished (it will probably take a bit) navigate into the cloned directory (cd <name>
)
- Add a reference to PencilBlue upstream
git remote add upstream https://github.com/pencilblue/pencilblue.git
- Fetch upstream remote
git fetch upstream
- Pull in master from PencilBlue
git reset --hard upstream/master
-
Create (or download) a config.js file
vi config.js
or
curl -O https://gist.githubusercontent.com/connyay/76102b76413588f68d12/raw/config.js
Your config.js
should look like this:
- Add an
.openshift/action_hooks
directory
mkdir -p .openshift/action_hooks
-
Create (or download) an .openshift build action_hook
vi .openshift/action_hooks/build
or
curl -o .openshift/action_hooks/build https://gist.githubusercontent.com/connyay/76102b76413588f68d12/raw/build
Your build
action_hook should look like this:
- Make the build action hook executable
chmod +x .openshift/action_hooks/build
- git add -> git commit -> git push
git add -f config.js && git add -A && git commit -m 'Hello PencilBlue!' && git push origin master -f
- Visit your new PencilBlue website at: http://<your app name>-<your namespace>.rhcloud.com
Prefer a shell script? Steps 4-11 can be completed by using this script
(Only tested on Mac)
curl https://gist.githubusercontent.com/connyay/76102b76413588f68d12/raw/setup.sh | bash
Troubleshooting
If navigating to your app in the browser throws an error, then the first thing you’ll want to do is check the logs:
rhc tail <name>
I hope you find this useful! If you have any questions feel free to reach out at @_connyay
18 Sep 2014
I have been unable to get the --from-code
flag to work on openshift… I may be doing something incorrectly, but I am not sure. Every attempt I make results in 504 errors and an overall bad time.
Here is what I am talking about:
rhc create-app <app-name> "http://cartreflect-claytondev.rhcloud.com/reflect?github=connyay/openshift-node-diy" --from-code https://github.com/connyay/rh-labs-angular.git
After getting frustrated with this, I wrote a script. I integrated this script into my cartridge and have found it very useful.
Usage
Make the app
rhc create-app <app name> "http://cartreflect-claytondev.rhcloud.com/reflect?github=connyay/openshift-node-diy"
Go into the directory
cd <app name>
Lay down your code
./init.sh -r <your repo> -t <your tag> -n <app name>
How I use the script (as an example)
./init.sh -r connyay/rh-labs-angular -t 1.0.1 -n <app name>
What the script does
- Removes everything from the directory except for the init script, and the .git directory.
- Downloads the tarball for the repository at the optional tag.
- Replaces references to the ‘boilerplate app name’ to the optional name
- Does the first git push to the repository. (can be disabled with
-no-push
)
I hope you find this useful! If you have any questions feel free to reach out at @_connyay
23 Aug 2014
I am slowly migrating to GitHub pages. Bear with me!