This document describes how to perform manual deployments to the existing Shiny server on laguna.ku.lt and how to prepare the server and GitHub repository for automated deployments.
PyPath is a monorepo with two packages:
| Package | Path | PyPI Name | Import |
|---|---|---|---|
| Core algorithms | packages/pypath/ |
pypath-ewe |
import pypath |
| Shiny frontend | packages/pypath-shiny/ |
pypath-shiny |
import pypath_shiny |
Both are installed from source into a venv on the server using pip install -e. Dependencies are managed by pyproject.toml in each package (not requirements.txt).
-
Create a dedicated deploy SSH key on your local machine:
ssh-keygen -t ed25519 -f ~/.ssh/pypath_deploy -C "deploy@pypath"
-
Copy the public key to the remote server for the
razinkauser:ssh-copy-id -i ~/.ssh/pypath_deploy.pub razinka@laguna.ku.lt -
Verify you can log in (and optionally that sudo works if you plan to restart Shiny Server):
ssh -i ~/.ssh/pypath_deploy razinka@laguna.ku.lt # check sudo (if needed): sudo -n true || echo "No passwordless sudo"
-
Use the helper scripts in the
scripts/directory to deploy from your machine:-
Linux/macOS (rsync):
./scripts/deploy.sh --host laguna.ku.lt --user razinka --path /srv/shiny-server/pypath --key ~/.ssh/pypath_deploy # add --restart to attempt restarting Shiny Server (requires sudo on remote)
-
Windows (PowerShell):
.\scripts\deploy.ps1 -Host laguna.ku.lt -User razinka -Path /srv/shiny-server/pypath -Key C:\Users\you\.ssh\pypath_deploy # add -Restart to attempt restarting Shiny Server
After rsync/upload, SSH into the server and install packages:
ssh razinka@laguna.ku.lt TARGET=/srv/shiny-server/pypath # Create venv if first time python3 -m venv $TARGET/venv # Install both packages (order matters: core first) source $TARGET/venv/bin/activate pip install -e $TARGET/packages/pypath pip install -e $TARGET/packages/pypath-shiny deactivate # Fix ownership sudo chown -R shiny:shiny $TARGET sudo systemctl restart shiny-server
-
Notes:
- The scripts exclude
.git,.github,.claude,tests, caches, and build artifacts by default. - Dependencies are resolved from
pyproject.tomlduringpip install -e.
Add the following repository secrets (Repository Settings > Secrets > Actions):
SSH_PRIVATE_KEY— private key content for the deploy keyDEPLOY_HOST— e.g.,laguna.ku.ltDEPLOY_USER— e.g.,razinkaDEPLOY_PATH— remote path, e.g.,/srv/shiny-server/pypathRESTART_AFTER_DEPLOY— (optional) set totrueto auto-restart Shiny Server
The workflow (.github/workflows/deploy.yml) will:
- Rsync the repo (excluding tests, caches, build artifacts)
- Create a venv if missing
- Generate
app.pywithsys.pathentries (see note below) pip install -eboth packages on the remote server- Fix file ownership to
shiny:shiny - Optionally restart Shiny Server
- Target directory:
/srv/shiny-server/pypath/ - The
shinyuser must own the app directory - Shiny Server looks for
app.pyat the root - Important: Shiny Server uses
su --loginto switch to theshinyuser, which resets the environment and prevents.pthfiles (created bypip install -e) from being processed. The generatedapp.pyincludes explicitsys.path.insert()calls pointing topackages/pypath/src/andpackages/pypath-shiny/src/to work around this. - Typical Shiny Server restart commands (may require sudo):
sudo systemctl restart shiny-serversudo service shiny-server restart
/srv/shiny-server/pypath/
├── app.py # sys.path fix + from pypath_shiny.app import app
├── packages/
│ ├── pypath/ # pypath-ewe source
│ │ ├── src/pypath/
│ │ └── pyproject.toml
│ └── pypath-shiny/ # pypath-shiny source
│ ├── src/pypath_shiny/
│ └── pyproject.toml
├── venv/ # Both packages pip-installed here
│ └── bin/python
├── data/ # Optional runtime data
└── shiny-server-pypath.conf # Config snippet for admin
Instead of the scripts in scripts/, you can use the tarball-based workflow in deploy/:
# On Windows: create deployment tarball
.\deploy\prepare_package.ps1
# Upload and deploy on server
scp pypath_deploy.tar.gz razinka@laguna.ku.lt:/tmp/
ssh razinka@laguna.ku.lt
cd /tmp && tar -xzf pypath_deploy.tar.gz && cd pypath_deploy
sudo ./deploy.sh # fresh install
sudo ./deploy.sh --update # update existingSee deploy/README.md for full details.