Skip to content

NOAA-OWP/pfds-web

This is the PFDS/HDSC website repo.

To setup, there are a few directories with large files that need to be pulled from NOAA Google Drive and unzipped:

Drive Link Destination unZip Path Notes
Technical_papers.zip html/hdsc/Technical_papers/ Must be unzipped
On-line_reports.zip html/hdsc/On-line_reports/ Must be unzipped
documents.zip html/hdsc/ Must be unzipped
Includes:
- html/hdsc/PF_documents/
- html/hdsc/PMP_documents/
- html/hdsc/PMP_related_studies/
- html/hdsc/Technical_memoranda/
- html/hdsc/Technical_reports/
hi_review_response_draft2.doc html/pfds/hi/
hi_station_maps_for_documentation.zip html/pfds/hi Do not decompress
orbreview_pdf_maps.tar.gz html/pfds/images/orb_review/ Do not decompress
na2_westus_100yr24hr.asc html/support_grids/

How to Install Docker on WSL2

All commands in this README.md must be run from a linux terminal.

Install Documentation

sudo apt-get update -y
sudo apt-get install curl wget gnupg2 -y
curl -fsSL https://get.docker.com/ | sh
sudo usermod -aG docker $(whoami)
# Make sure to logout and log back in for the user permissions to take effect.

To confirm installation:

docker --version

Build the HDSC Image and Container

  • load the base image
docker load -i=ironbank-ubi8-latest-fips.tar

Production Setup

  • Add the custom SSL certificate files and update the ******.crt file in the ./ssl directory.

    • ./ssl/******.crt
    • ./ssl/******.key
    • ./ssl/******.crt
  • Run the following command to rebuild the image and container. The default configuration settings are for production.

docker compose up -d --build

Development Setup

  • The .env files will be used for development only.
  • Copy the ENV file to an .env file.
cp ENV .env

  • Using a standard text editor modify the ports and file-path locations as needed.
  • Run the following command to build the image and container:
docker-compose up -d

  • If there are any issues you can use the following commands to debug:
docker-compose logs

docker ps -a

Restart Docker Services

docker-compose restart

Stop Docker Services

docker-compose stop

CLI Access To The Container

  • To access the container use the following:
  • Access the shell
docker exec -it hdsc bash

Restart The Apache WebServer

  • Feed a command to the container (example of restarting the webserver)

docker exec -it hdsc /usr/sbin/httpd -k restart

Restart PHP

  • To test this is working go to PFDS GIS view and click on the button Click here to begin download. You should have a zip file available for download if PHP-FPM is enabled.

docker exec -it hdsc /usr/sbin/php-fpm

Deployment on HDSC server

  • Make sure to do a backup first!
  • The following commands have been used
cd /hdsc_volumes/hdsc-website/ ;
git fetch --all -p ;
git rebase -v origin/master ;
docker compose up -d --force-recreate --build ;

Nightwatch Frontend Testing

  • The NightwatchJS library has been implemented to test frontend elements and functionality within the html pages. The tests have been setup to cover the local container default as well as the test server test and production server production.

  • To install the libary use the following command:

npm install

  • To run the frontend tests with the local up and running container use the following command:
./runtests.sh default

Last Commit Signature and DateTime For Development and Testing

  • The previous to the last commit signature and datetime have been added to a hidden input element for visual verification. With the last_commit hidden element on the URI view /pfds/index.html will show the previous commit in the repository. To access this element open a browser web developer panel and in the console enter the following command;
document.querySelector('#last_commit')

  • Also note that on the view /pfds/index.html at the bottom of the page the text Page last modified: will show the last update time for the repository.

Issues Found In Local Container Build

  • A possible error seen with loading pfds_map_cont.html after building on a UNIX machine;
[Fri Jul 12 00:45:53.224536 2024] [cgid:error] [pid 829:tid 140073295140608] [client ******:64050] AH01241: error spawning CGI child: exec of '/var/www/cgi-bin/new/cgi_readH5.py' failed (No such file or directory): /var/www/cgi-bin/new/cgi_readH5.py, referer: https://localhost:4433/pfds/pfds_map_cont.html?bkmrk=ks
[Fri Jul 12 00:45:53.225253 2024] [cgid:error] [pid 829:tid 140073295140608] [client ******:64050] End of script output before headers: cgi_readH5.py, referer: https://localhost:4433/pfds/pfds_map_cont.html?bkmrk=ks
  • To fix this it might require running dos2unix on all Python files using the following command to fix the error. Note this should also be done with the four Python-posing-as-CSV files;
find . -name '*.py' -type f -exec dos2unix {} \;
find . -name '*.csv' -type f -exec dos2unix {} \;

About

Precipitation Data Frequency Server website

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors