Websites: https://experiments.jcsda.org/ and https://skylab.jcsda.org/
Table of Contents |
|---|
Our web applications, experiments.jcsda.org and skylab.jcsda.org run on AWS EC2 instances in us-east-1. They are a Voila application with python notebooks and each run from their own instance. The logs on these instances are located at /var/log/nginx/error.log. The r2d2, solo, and diag-plots repositories are needed and are located inside the home directory.
Restart the following services and run:
sudo systemctl restart nginx.service sudo systemclt daemon-reload sudo systemclt restart voila.service |
Verify the website is back up and running.
The certificate should be automatically updated and managed via CertBot and Let's Encrypt. If you need to manually update the certificate you can follow this procedure.
Run:
sudo certbot --nginx |
Instructions from https://docs.google.com/document/d/1vqK-qAxBGt_I9j6VG1SSLtPhQp89PzV4Y32yuWLWbUg/edit
Voila documentation: https://voila.readthedocs.io/en/stable/deploy.html#running-voila-on-a-private-server
WARNING: these instructions are old and some steps might be outdated.
Start a new EC2 instance using the console:
Create nginx Service:
Install nginx (enter in SSH’d terminal):
sudo apt install nginx sudo systemctl status nginx |
Create the file /etc/nginx/sites-enabled/{website_name}.jcsda.org with the following content:
server {
listen 80;
server_name {website_name}.jcsda.org;
proxy_buffering off;
location / {
proxy_pass http://localhost:8866;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
}
client_max_body_size 100M;
error_log /var/log/nginx/error.log;
} |
Enable and start the nginx service.
sudo systemctl enable nginx.service sudo systemctl start nginx.service |
Install pip
sudo apt update && sudo apt install python3-pip |
Clone Git Repo and Install Dependencies:
ssh-keygen -t ed25519 -C "{email}@ucar.edu" |
cat /home/ubuntu/.ssh/id_ed25519.pub |
From instance terminal, clone feature/voila branch. Note: the branch will change to “develop” in the future - unsure if this is the case right now.
git clone -b feature/voila git@github.com:JCSDA-internal/jtd.git |
Install dependencies
sudo python3 -m pip install --no-cache-dir -r jtd/voila/requirements.txt |
Create Voila Service:
Create /usr/lib/systemd/system/voila.service with the contents:
[Unit] Description=Voila [Service] Type=simple PIDFile=/run/voila.pid ExecStart=voila --no-browser --show_traceback=False jtd/voila/app.ipynb User=ubuntu WorkingDirectory=/home/ubuntu/ Restart=always RestartSec=10 [Install] WantedBy=multi-user.target |
Enable and start the voila.service:
sudo systemctl enable voila.service sudo systemctl start voila.service |
Restart nginx
sudo systemctl restart nginx.service |
Enable access to https:
sudo snap install core; sudo snap refresh core sudo snap install --classic certbot sudo ln -s /snap/bin/certbot /usr/bin/certbot sudo certbot --nginx |
Issue: the web pages will fail to load/ timeout
Explanation: Each time the website is hit a new python kernel is opened and will stay open forever. Therefore, when the instance memory is full of these python kernels the page will go down.
Solution: Reboot the EC2 Instance (see procedure above)