cd /home/chartmastersapi/public_html/api-spotify-graphql-pypy
pip3 install --user -r requirements.txt


Verification checklist (fast, deterministic)

Run these exact checks:

python3 -c "import aiohttp, aiocache, pyotp, ujson, yaml; print('deps OK')"


Then:

/home/chartmastersapi/.local/bin/gunicorn --version


Then:

/home/chartmastersapi/.local/bin/gunicorn index:create_app \
  --bind 0.0.0.0:8443 \
  --workers 3 \
  --worker-class aiohttp.GunicornWebWorker


If it boots and prints:

Booting worker

New acces token expires at ...

The environment is correct.


4) Final systemd service (reference version)

Once and for all, this is the correct unit file for your API.

/etc/systemd/system/chartmasters-api.service

[Unit]
Description=ChartMasters Spotify GraphQL API
After=network.target

[Service]
User=chartmastersapi
Group=chartmastersapi
WorkingDirectory=/home/chartmastersapi/public_html/api-spotify-graphql-pypy

ExecStart=/home/chartmastersapi/.local/bin/gunicorn \
  index:create_app \
  --bind 0.0.0.0:8443 \
  --workers 5 \
  --worker-class aiohttp.GunicornWebWorker

Restart=always
RestartSec=5
Environment=PYTHONUNBUFFERED=1

[Install]
WantedBy=multi-user.target


Then:

sudo systemctl daemon-reload
sudo systemctl enable chartmasters-api
sudo systemctl start chartmasters-api