User Tools

Site Tools


quick:gitlab_setup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
quick:gitlab_setup [2021/02/18 16:23]
bbarsch
— (current)
Line 1: Line 1:
-====== Procedure to update user db code ====== 
- 
- 
-===== Clone the userdb code from the Gitlab Repo===== 
-1. Go to the directory you want to clone the repo to 
- 
- 
-2. Go to the repo in Gitlab and copy the ssh link: 
-<code> 
-git@git:protea/protea_database.git 
-</code> 
- 
-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'': 
- 
-<code> 
-BBarsch@BBARSCH-NB1 MINGW64 /d/CSIR_Dev/git_userdb 
-$ git clone git@git2:protea/protea_database.git 
-Cloning into 'protea_database'... 
-Enter passphrase for key '/c/Users/BBarsch/.ssh/id_dsa': 
-remote: Enumerating objects: 425, done. 
- 
-</code> 
- 
-Passphrase was Csir20... 
- 
- 
-4. Open your IDE, using sublime, and make changes to the code. 
- 
-<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) 
-$ 
- 
-</code> 
- 
-5. Save the code and check the ''git status'' to make sure you are up-to-date: 
- 
-<code> 
-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) 
-$ 
- 
-</code> 
- 
- 
- 
-6. Next step is to push the code 
- 
- 
- 
-===== Push the code back to Gitlab ===== 
- 
-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'': 
-   
-<code> 
-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) 
-$ 
- 
- 
-</code> 
- 
-2. this should show something is modified, and recommends you do ''git add .'' or ''git add <filename>'': 
- 
-<code> 
-BBarsch@BBARSCH-NB1 MINGW64 /d/CSIR_Dev/git_userdb/protea_database (master) 
-$ git add README.md 
- 
-</code> 
- 
-4. Then do a commit ''git commit -m "commit comment"'': 
- 
-<code> 
-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(+) 
- 
- 
-</code> 
- 
- 
-5. And check with git status again that it has been added 
- 
-<code> 
-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 
-</code> 
- 
- 
-5. Then lastly push the code to gitlab use ''git push'': 
- 
-<code> 
-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 
- 
- 
- 
-</code> 
-   
- 
-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 
- 
-===== Update the userdb server ===== 
- 
-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 
- 
  
/app/dokuwiki/data/attic/quick/gitlab_setup.1613658225.txt.gz · Last modified: 2021/12/09 16:42 (external edit)