It’s already July! Omg time flies when it comes to summer time.
Update: recently I’ve been very involved in my internship project. I can’t expose the detail but basically I am working with AngularJS extensively. Though I am still very far from an experienced AngularJS developer, I must say IT IS A BEAUTIFUL WEB FRONT-END FRAMEWORK.
Currently I am working on a project called “yolyo” (temporarily name), which is based on an open source forum Discourse. Since Discourse requires quite a bit of computing resources, I decided to use Amazon EC2 as our starting point. As I realized how important it is to configure a virtual instance, I would like to dedicate this post to document all the works I’ve put into to make things work smoothly.
First of all, I would like to thank BitNami providing one-click Discourse installation to deploy on EC2. Otherwise, I would’ve still struggled with all the nitty gritty deployment detail.
How to deploy/update by Git
This has confused me for a long while. I had been used to deploy virtually everything by drag and drop for so long. Though I’ve learnt how to use Git to do versioning, I do not know how to setup the cloud server so that I can simply do git push origin master
to deploy the changes.
Although I finally figured out how to use Git to deploy remote instance, I realized this workflow doesn’t work really well with Discourse. Discourse itself already contains a git repo, so I would need to push to a remote repo and deploy the instance by pulling from this remote repo. (If anyone knows a better deployment strategy, please let me know)
On remote machine
create a git repo as a transition to deploy to a designated directory
- Copy local machine public key to the remote server (ec2 instance)
1
|
|
- Create and initialize a new git repo
1 2 |
|
- Configure the post-receive hook in order to put the files into desired directory
1 2 3 4 5 |
|
- Make the post-receive file executable
1
|
|
- Configure
hooks/post-update
file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
- Make
hooks/post-update
executible
1
|
|
On local machine
I’m lazy to explicitly write out the steps here. I will just refer to the StackOverflow page that helped me solve this problem.
Side note
After all the above hassle I suddenly realized that I do not need any of these setup. Because I shall rely on a remote (e.q. GitHub) to host the repo, so the remote machine can easily pull from this remote repo. Though it is true that I am not currently working collaboratively with anybody else, this is a good deployment/development practice.