[go: up one dir, main page]

Skip to content
Chun Ho Chow edited this page Jul 8, 2024 · 12 revisions

Build instructions

  • First: install Nodejs from nodejs.org. We are currently using NodeJS 16 LTS
  • Also recommended: VS Code from code.visualstudio.com
  • Then run these commands:
# get the code from Github
git clone https://github.com/sfcta/simwrapper
# Install all js library dependencies:
npm ci --force --no-optional

Now you can run npm run serve to run a local dev build at http://localhost:3000. woot!

How to synchronize with latest upstream SimWrapper version

The only changes that should be committed to THIS repo are SFCTA-specific changes: such as home page text & logos, file system roots, etc. Everything else -- bugfixes, features, etc -- should be committed to the upstream repo and then pulled here from upstream.

The main SimWrapper repo is at github.com/simwrapper/simwrapper. This is considered upstream and you can sync with the master branch there to get the latest changes.

One time only, tell git where 'upstream' is:

  • git remote add upstream https://github.com/simwrapper/simwrapper

Then, whenever you want to synchronize with upstream:

cd simwrapper # your local sfcta-simwrapper folder
git checkout master
git pull
git fetch upstream
git merge upstream/master
# if there are any merge conflicts at this point, 
# fix them and then run "git commit". Finally:
git push

Now the SFCTA version has the latest and greatest. :-)

How to push to sfcta.github.io/simwrapper

  • Run npm run deploy-sfcta to build the site and push to https://sfcta.github.io/simwrapper (deploy-sfcta no longer exists. Modify from scripts/deploy-ghpages.sh or make our own deploy-sfcta command in packages.json.)
  • (I'm trying to streamline the GitHub Pages instance by using GitHub Actions to build the page, but it's still janky. See Issues and other gh-pages-... branches)

How to push to prospector

Build the site and zip the contents of the build:

npm run build
cd dist
zip -r simwrapper.zip *

Copy that zip to prospector, backup the current instance on prospector at /www/simwrapper, then unzip it into the same folder, and change permissions on those files so that the webserver process ("33.33") can read them:

# this folder is sudo protected, so the following probably won't work:
# scp simwrapper.zip administrator@prospector:/www/simwrapper/simwrapper.zip
# instead, do it in a few steps
scp simwrapper.zip administrator@prospector:~
ssh administrator@prospector  # now we're in ~
sudo mv /www/simwrapper /www/simwrapper-backup # backup
sudo mkdir /www/simwrapper
sudo mv simwrapper.zip /www/simwrapper/
cd /www/simwrapper
sudo unzip simwrapper.zip
sudo chown -R 33.33 *

Note: Prospector doesn't allow scp over VPN, but this works from machines inside the internal network. If you are using VPN, find another way to copy the file such as using Remote Desktop.

Ok! The new version should now be live on http://prospector/simwrapper.

Once it's verified that everything is working, you can delete /www/simwrapper-backup on prospector.

Mapping the model run directory.

SFCTA's simwrapper is configured to look for the model run directory at http://prospector/champ_runs. For this to work, the virtual machine needs to be configured with the model run directory mapped to the correct location. Check that the network drive is mounted by logging into the prospector vm, opening a file browser, and looking under "Network". You should see "tda on ". Then in a command window:

ssh administrator@prospector
sudo mount -o username=<username> //<network_drive_ip_address>/<filepath> /www/champ_runs

(Refer to Y:\warehouse\configs\simwrapper_map_drive.md for the exact command.)