I have an m1.small Amazon EC2 instance that I use to test and share my web app development with friends. It's time to setup a gitrepo on this shared instance.
On my EC2 instance, first I install git and then setup a bare repo:
[elousf@ip-xx-xxx-xx-xxx ~]$ sudo yum install git
[elousf@ip-xx-xxx-xx-xxx ~]$ mkdir gitrepo
[elousf@ip-xx-xxx-xx-xxx ~]$ cd gitrepo
[elousf@ip-xx-xxx-xx-xxx gitrepo]$ mkdir myweb.git
[elousf@ip-xx-xxx-xx-xxx gitrepo]$ cd myweb.git/
[elousf@ip-xx-xxx-xx-xxx myweb.git]$ git init --bare
[elousf@ip-xx-xxx-xx-xxx myweb.git]$ ls -laF
total 40
drwxrwxr-x 7 elousf elousf 4096 Jul 4 03:38 ./
drwxrwxr-x 3 elousf elousf 4096 Jul 4 03:38 ../
drwxrwxr-x 2 elousf elousf 4096 Jul 4 03:38 branches/
-rw-rw-r-- 1 elousf elousf 66 Jul 4 03:38 config
-rw-rw-r-- 1 elousf elousf 73 Jul 4 03:38 description
-rw-rw-r-- 1 elousf elousf 23 Jul 4 03:38 HEAD
drwxrwxr-x 2 elousf elousf 4096 Jul 4 03:38 hooks/
drwxrwxr-x 2 elousf elousf 4096 Jul 4 03:38 info/
drwxrwxr-x 4 elousf elousf 4096 Jul 4 03:38 objects/
drwxrwxr-x 4 elousf elousf 4096 Jul 4 03:38 refs/
Setup my local git repo for Playframework development on my local (macbook pro) git
@mbp ~/dev/play/myweb$ git init
Initialized empty Git repository in /Users/elousf/dev/play/myweb/.git/
Play automatically creates .gitignore when I created the app.
@mbp ~/dev/play/myweb$ cat .gitignore
logs
project/project
project/target
target
tmp
.history
dist
/.idea
/*.iml
/out
/.idea_modules
/.classpath
/.project
/RUNNING_PID
/.settings
/.target
Initialized empty Git repository in /home/elousf/myplayapp/.git/
[mywebapp] run
On my EC2 instance, first I install git and then setup a bare repo:
[elousf@ip-xx-xxx-xx-xxx ~]$ sudo yum install git
[elousf@ip-xx-xxx-xx-xxx ~]$ mkdir gitrepo
[elousf@ip-xx-xxx-xx-xxx ~]$ cd gitrepo
[elousf@ip-xx-xxx-xx-xxx gitrepo]$ mkdir myweb.git
[elousf@ip-xx-xxx-xx-xxx gitrepo]$ cd myweb.git/
[elousf@ip-xx-xxx-xx-xxx myweb.git]$ git init --bare
[elousf@ip-xx-xxx-xx-xxx myweb.git]$ ls -laF
total 40
drwxrwxr-x 7 elousf elousf 4096 Jul 4 03:38 ./
drwxrwxr-x 3 elousf elousf 4096 Jul 4 03:38 ../
drwxrwxr-x 2 elousf elousf 4096 Jul 4 03:38 branches/
-rw-rw-r-- 1 elousf elousf 66 Jul 4 03:38 config
-rw-rw-r-- 1 elousf elousf 73 Jul 4 03:38 description
-rw-rw-r-- 1 elousf elousf 23 Jul 4 03:38 HEAD
drwxrwxr-x 2 elousf elousf 4096 Jul 4 03:38 hooks/
drwxrwxr-x 2 elousf elousf 4096 Jul 4 03:38 info/
drwxrwxr-x 4 elousf elousf 4096 Jul 4 03:38 objects/
drwxrwxr-x 4 elousf elousf 4096 Jul 4 03:38 refs/
Setup my local git repo for Playframework development on my local (macbook pro) git
@mbp ~/dev/play/myweb$ git init
Initialized empty Git repository in /Users/elousf/dev/play/myweb/.git/
Play automatically creates .gitignore when I created the app.
@mbp ~/dev/play/myweb$ cat .gitignore
logs
project/project
project/target
target
tmp
.history
dist
/.idea
/*.iml
/out
/.idea_modules
/.classpath
/.project
/RUNNING_PID
/.settings
/.target
Add to local git
@mbp ~/dev/play/myweb$ git add .
See what were added by using "git status"
Submit the files to local git.
@mbp ~/dev/play/myweb$ git commit -m "Initial commit"
Add remote repo:
@mbp ~/dev/play/myweb$ git remote add origin elousf@myec2:/home/elousf/gitrepo/myweb.git
Finally, push my local git to my gitrepo on EC2 (myec2)
@mbp ~/dev/play/myweb$ git push -u origin master
Counting objects: 189, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (182/182), done.
Writing objects: 100% (189/189), 4.76 MiB | 1.12 MiB/s, done.
Total 189 (delta 18), reused 0 (delta 0)
To elousf@myec2:/home/elousf/gitrepo/myweb.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
That's it to add shared gitrepo on EC2.
Test it out
Login back to my EC2 instance, create a directory to host my playframework code:
@mbp ~$ ssh elousf@myec2
As elousf user on my EC2:
[elousf@ip-xx-xxx-xx-xxx ~]$ mkdir myplayapp
[elousf@ip-xx-xxx-xx-xxx ~]$ git init
[elousf@ip-xx-xxx-xx-xxx ~]$ git remote add origin elousf@localhost:/home/elousf/gitrepo/myweb
[elousf@ip-xx-xxx-xx-xxx ~]$ git pull origin master
remote: Counting objects: 189, done.
remote: Compressing objects: 100% (164/164), done.
remote: Total 189 (delta 18), reused 189 (delta 18)
Receiving objects: 100% (189/189), 4.76 MiB | 1.81 MiB/s, done.
Resolving deltas: 100% (18/18), done.
[elousf@ip-xx-xxx-xx-xxx ~]$ ls -l
total 5120
drwxr-xr-x 12 elousf elousf 408 Jul 3 20:55 ./
drwxr-xr-x 10 elousf elousf 340 Jul 3 20:54 ../
drwxr-xr-x 13 elousf elousf 442 Jul 3 20:55 .git/
-rw-r--r-- 1 elousf elousf 150 Jul 3 20:55 .gitignore
-rw-r--r-- 1 elousf elousf 757 Jul 3 20:55 README
drwxr-xr-x 6 elousf elousf 204 Jul 3 20:55 app/
drwxr-xr-x 4 elousf elousf 136 Jul 3 20:55 conf/
drwxr-xr-x 4 elousf elousf 136 Jul 3 20:55 docs/
drwxr-xr-x 5 elousf elousf 170 Jul 3 20:55 project/
drwxr-xr-x 5 elousf elousf 170 Jul 3 20:55 public/
drwxr-xr-x 4 elousf elousf 136 Jul 3 20:55 test/
Assuming I already have Playframework and databases setup to run this app I can do:
[elousf@ip-xx-xxx-xx-xxx ~]$ play
[mywebapp] run
No comments:
Post a Comment