You are here:
Vanderbilt Biostatistics Wiki
>
Sandbox Web
>
PsNotes
(revision 1) (raw view)
Edit
Attach
---++ PS notes ---+++ Run test instance on my workstation To rebuild the angular stuff after working on that part <verbatim> cd ~/ps/inst/angular npm run build </verbatim> Run the application after rebuilding <verbatim> cd ~/ps ./x.sh </verbatim> ---+++ Update the git repository after changes have been made Navigate to the ps directory on my workstation <verbatim> cd ~/ps </verbatim> See what we have <verbatim> git status </verbatim> =git add= the changes I've made in the source code (this is some of the stuff in "Changes not staged for commit"). Here is an example of what might need to be done. Don't just copy and paste. <verbatim> git add dichotModel.R git status </verbatim> Commit my changes <verbatim> git commit -m "explanation of what was done" git status </verbatim> Recompile the compiled js <verbatim> cd ~/ps/inst/angular/ npm run build </verbatim> Clean up some. Remove stuff we don't want. Add other new stuff that was created by *npm run build*. These lines are examples of what might need to be done. Don't just copy and paste. <verbatim> cd ~/ps git status git add inst/angular/dist/ps/index.html git add inst/angular/dist/ps/main-es2015.f1b10667f2ebb1e98c3e.js git add inst/angular/dist/ps/main-es5.f1b10667f2ebb1e98c3e.js git add inst/angular/src/app/dichot/start/start.component.html git add inst/angular/src/app/dichot/start/start.component.ts git add inst/angular/src/app/version.ts ??git reset HEAD inst/angular/dist/ps/main-es2015.e8ec74816433e1f75eb8.js ??git reset HEAD inst/angular/dist/ps/main-es2015.e8ec74816433e1f75eb8.js ??git reset HEAD inst/angular/dist/ps/main-es5.e8ec74816433e1f75eb8.js </verbatim> Commit again and push to github <verbatim> git commit -m "after npm run build" git push </verbatim> ---+++ Deploy to server Install ansible if not already installed. <verbatim> sudo apt install ansible </verbatim> Clone or update the PS ansible repo <verbatim> cd ~ git clone https://gitlab.app.vumc.org/stephej1/ps-ansible.git/ </verbatim> Run the ansible playbook to deploy to PS server virtual machine <verbatim> cd ~/ps-ansible ansible-playbook playbook.yml </verbatim> ---+++ Ansible configuration for PS... ... is at https://gitlab.app.vumc.org/stephej1/ps-ansible. Must make a VPN connection to access. Coding for the application is done on the local workstation. Git is used for version control and the remote repository is on https://github.com. ---+++ PS virtual machine * hosted on biostat1553.dhcp.mc.vanderbilt.edu (10.151.20.93) * The virtual machine host name is biostat1553-ps (10.151.20.240) * There is a cron job that restarts the PS job every 30 minutes. We are doing this because something is causing the process to hang and become unresponsive. * =0,30 * * * * systemctl restart ps= * Maybe have a look at /var/log/ps.log to see if there is any indication about what may be causing the hanging problem. ---+++ Setting up the local repository for the first time <br> (or starting from fresh because you've wrecked your local version) Clone the repository <verbatim> cd ~ git clone https://github.com/vubiostat/ps.git </verbatim> Change to the ps directory <verbatim> cd ps git branch </verbatim> The ~/ps/inst/angular/src/environments/environment.demo.ts file should look like this. The IP address is for the local computer where the work is being done. <verbatim> export const environment: any = { production: false, apiUrl: "http://10.151.20.86:7788" }; </verbatim> Make the environment file using the lines above. <verbatim> touch ~/ps/inst/angular/src/environments/environment.demo.ts vim ~/ps/inst/angular/src/environments/environment.demo.ts </verbatim> The ~/ps/inst/angular/package.json file should look like this: <verbatim> "name": "ps", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "node build.js", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "^7.2.14", "@angular/common": "^7.2.14", "@angular/compiler": "^7.2.14", "@angular/core": "^7.2.14", "@angular/forms": "^7.2.14", "@angular/http": "^7.2.14", "@angular/platform-browser": "^7.2.14", "@angular/platform-browser-dynamic": "^7.2.14", "@angular/router": "^7.2.14", "@ng-bootstrap/ng-bootstrap": "^4.2.2", "core-js": "^2.6.5", "d3": "^4.9.1", "rxjs": "^6.5.1", "stable": "^0.1.6", "tslib": "^1.9.3", "zone.js": "^0.8.29" }, "devDependencies": { "@angular-devkit/build-angular": "^0.13.8", "@angular/cli": "7.3.8", "@angular/compiler-cli": "^7.2.14", "@angular/language-service": "^7.2.14", "@types/jasmine": "^2.8.16", "@types/jasminewd2": "^2.0.6", "@types/node": "~8.9.4", "codelyzer": "~4.2.1", "jasmine-core": "~2.99.1", "jasmine-spec-reporter": "~4.2.1", "karma": "~1.7.1", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "^1.4.3", "karma-jasmine": "~1.1.1", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "^5.3.2", "ts-node": "~5.0.1", "tslint": "~5.9.1", "typescript": "~3.2.4" } } </verbatim> Create the~/ps/inst/angular/package.json file. <verbatim> touch ~/ps/inst/angular/package.json vim ~/ps/inst/angular/package.json </verbatim> Install all the angular bits <br> By default, npm install will install all modules listed as dependencies in ~/ps/inst/angular/package.json. <verbatim> cd ~/ps/inst/angular/ npm install </verbatim> Build angular <verbatim> npm run build </verbatim> Make a file of R script that will be needed to run the R backend. <verbatim> touch ~/ps/run-backend-demo.R </verbatim> Contents of ~/ps/run-backend-demo.R <verbatim> library(devtools) load_all(".") runPS("backend", "10.151.20.86") </verbatim> Make a bash file to launch the app on this workstation. <verbatim> cd ~/ps touch x.sh </verbatim> Contents of ~/ps/x.sh <verbatim> #!/bin/bash SESSION=ps env="$1" dir=`pwd` tmux -2 new-session -d -s $SESSION -c "$dir/inst/angular" -n 'ed' tmux new-window -t $SESSION:1 -n 'sh' -c "$dir/inst/angular" tmux new-window -t $SESSION:2 -n 'ng' -c "$dir/inst/angular" tmux send-keys "npm start -- -c demo" C-m tmux new-window -t $SESSION:3 -n 'ng' -c "$dir/inst/angular" tmux send-keys "CHROME_BIN=/usr/bin/chromium ng test --watch --source-map=false" tmux new-window -t $SESSION:4 -c "$dir" -n 'R' tmux send-keys "R --no-save < run-backend-demo.R" C-m tmux -2 attach-session -t $SESSION </verbatim> Launch the app on the local machine. It will be accessible at http://10.151.20.86:4200/ps or http://localhost:4200/ps. <verbatim> cd ~/ps chmod -x x.sh ./x.sh </verbatim> ---+++ Working on the code in the local repository Set path to local repo <verbatim> cd ~/ps </verbatim> Launch the app on the local machine. It will be accessible at http://10.151.20.86:4200/ps or http://localhost:4200/ps <verbatim> cd ~/ps ./x.sh </verbatim> Git commands... <verbatim> git status #Check current repository status git branch #See what branches are here git stash git checkout master #Make master branch current git pull #Sync local copy with repository git push # Push local changes to repository git log </verbatim> ---+++ Updating github repository after making changes on the local computer Merge development branch into main if applicable Rebuild angular <verbatim> npm run build cd ~/ps/inst/app </verbatim> Stage the files that have been changed <verbatim> cd ~/ps git status git add -u </verbatim> Also stage an untracked file <verbatim> inst/angular/dist/ps/main.???.js </verbatim> Commit staged content <verbatim> cd ~/ps git status git commit -m "explain the changes" </verbatim> Transmit the local commits to the github repository <verbatim> git push </verbatim> ---+++ Updating the server Statcomp2 is the server for the PS application. If changes are made in the PS code, we need to sync with the remote repository and, if any of the R has been changed, restart the R backend. First, log on to the ps account on statcomp2. Use ssh from my Linux workstation that has the ssh key in place. <verbatim> ssh ps@statcomp2.emp.vumc.io </verbatim> Go to the PS directory <verbatim> cd ~/ps </verbatim> Sync the code with the repository <verbatim> git pull origin master </verbatim> Find the currently running backend process (only if R code has been changed) <verbatim> ps ux </verbatim> Kill the currently running backend process (only if R code has been changed) <verbatim> kill ???? </verbatim> Start a new backend process (only if R code has been changed) <verbatim> ./run.sh & # </verbatim> Check https://statcomp2.app.vumc.org/ps/ to be sure the changes are in the current app. Look at the build version and date. Might have to refresh. ---+++ Pegasus tickets for PS VM |*Pegasus form*|*Ticket submitted*|*Ticket completed*|*Pegasus id*|*Notes*| |VUMC IP address request|20200608|20200609|R00641450|still need to update /etc/network/interfaces on VM| |Create a new CI|20200608|20200608||CI biostatPS created within Pegasus but no ticket number generated| |VUMC IT Linux-F5 LTM new VIP request|20200609|20200618|R00641452|External name: vbiostat.app.vumc.org (160.129.29.83) <br> Internal name: biostat1553-ps.emp.vumc.io (10.151.20.240)| The ticket (R00641450) requested a static IP. <verbatim> SMITH, ROB about 2 hours ago Fulfilled with Notes: 'Please configure the IP settings of the device to use the following: IP address = 10.151.20.240 subnet mask = 255.255.255.0 gateway = 10.151.20.1 DC1 DNS server = 10.108.51.18 DC2 DNS server = 10.150.51.18 DC3 DNS server = 10.101.62.234' </verbatim> ------------------------
Edit
|
Attach
|
P
rint version
|
H
istory
:
r5
|
r4
<
r3
<
r2
<
r1
|
B
acklinks
|
V
iew topic
|
Edit WikiText
|
More topic actions...
Topic revision: r1 - 10 Feb 2021,
DalePlummer
Sandbox
Log In
Toolbox
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
Webs
Archive
Main
Sandbox
System
Register
|
Log In
Copyright © 2013-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Vanderbilt Biostatistics Wiki?
Send feedback