This is an old revision of the document!
1. Go to the directory you want to clone the repo to
2. Go to the repo in Gitlab and copy the ssh link:
git@git:protea/protea_database.git
3. Note that git should be pointing to scp and not lengau, therefore in my .ssh/config file git2 points to scp so I use:
git clone git@git2:protea/protea_database.git
4. Open your IDE, using sublime, and make changes to the code.
BBarsch@BBARSCH-NB1 MINGW64 /d/CSIR_Dev/git_userdb $ cd protea_database/ BBarsch@BBARSCH-NB1 MINGW64 /d/CSIR_Dev/git_userdb/protea_database (master) $
5. Save the code and check the git status to make sure you are up-to-date:
BBarsch@BBARSCH-NB1 MINGW64 /d/CSIR_Dev/git_userdb/protea_database (master) $ git status On branch master Your branch is up to date with 'origin/master'. nothing to commit, working tree clean BBarsch@BBARSCH-NB1 MINGW64 /d/CSIR_Dev/git_userdb/protea_database (master) $
6. Next step is to push the code
1. Update, add, delete code and files. For demonstration we will just modify the README.md text for example.
Then go to that directory you did the clone from and hence the update and say git status:
BBarsch@BBARSCH-NB1 MINGW64 /d/CSIR_Dev/git_userdb/protea_database (master)
$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: README.md
no changes added to commit (use "git add" and/or "git commit -a")
BBarsch@BBARSCH-NB1 MINGW64 /d/CSIR_Dev/git_userdb/protea_database (master)
$
2. this should show something is modified, and recommends you do git add . or git add <filename>:
BBarsch@BBARSCH-NB1 MINGW64 /d/CSIR_Dev/git_userdb/protea_database (master) $ git add README.md
4. Then do a commit git commit -m “commit comment”:
BBarsch@BBARSCH-NB1 MINGW64 /d/CSIR_Dev/git_userdb/protea_database (master) $ git commit -m "18-Feb-2021 Test Commit" [master b7ea92ab] 18-Feb-2021 Test Commit 1 file changed, 3 insertions(+)
5. And check with git status again that it has been added
BBarsch@BBARSCH-NB1 MINGW64 /d/CSIR_Dev/git_userdb/protea_database (master) $ git status On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits) nothing to commit, working tree clean
5. Then lastly push the code to gitlab use git push:
BBarsch@BBARSCH-NB1 MINGW64 /d/CSIR_Dev/git_userdb/protea_database (master) $ git push Enter passphrase for key '/c/Users/BBarsch/.ssh/id_dsa': Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 12 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 323 bytes | 161.00 KiB/s, done. Total 3 (delta 2), reused 0 (delta 0), pack-reused 0 To git2:protea/protea_database.git b205ea3d..b7ea92ab master -> master
maybe asked for a passphrase, use Csir20… as its done through users.chpc or bio.chpc. Not sure if you can do this without a password as ssh-copy-id did not make a difference.
Next we need to update the user database
1. Login in to the cluster (login2) by using the following command. (replace bbarsch with your username)
ssh bbarsch@lengau.chpc.ac.za
2. Then ssh to users (Password is P@…):
ssh users2.chpc.ac.za
3. Login as root user (superuser…note you need admin permission):
sudo su -
4. Connect to chpc:
su - chpc
5. Go to the user database directory:
cd protea_database/
6. Check the git status if any changes exist:
git status
7. Downloads commits, files, and refs from a remote repository into your local repo by using git fetch:
git fetch
8. Check if any local changes exist:
git stash
9. Pull any changes from the repo:
git pull
10. Pull any changes from submodules (helpdesk) linked to this repo:
git submodule update
11. Get back in to root user by logging out from chpc using:
ctrl+d
12. Restart the gunicorn service:
systemctl restart gunicorn.service
13. Start ngninx:
systemctl start nginx
14. Flush redis:
redis-cli flushall
15. Close the terminal and go to the users2 site on a browser to see changes:
users2.chpc.ac.za
- Note to do the same for usersdev you must tunnel in as its internal, use the command:
ssh -N -L 8888:usersdev.chpc.ac.za:80 scp.chpc.ac.za
- then go to localhost:8888