Deployment - archcoder-jd/Fadeout GitHub Wiki
Deployment
Fadeout is hosted on cPanel and deployed from GitHub using cPanel's Git Version Control. The website and the Node.js proxy are deployed together.
Layout on the server
| What | Where | Served at |
|---|---|---|
| Website files | The subdomain's folder | fadeout.venture31.com |
| Node.js proxy | ~/fadeout-api (outside the web folder) |
fadeout.venture31.com/api |
The proxy lives outside the website's folder so its code can't be opened in a browser.
One-time setup
- Create the subdomain in cPanel under Domains. Fadeout needs its own subdomain so its
index.htmldoesn't replace another site's homepage. - Create the Node.js app in cPanel's Node.js app manager:
- Node.js version: 18 or newer (the proxy uses the built-in
fetch) - Application mode: Production
- Application root:
fadeout-api - Application URL: the subdomain, with
apias the path - Application startup file:
app.js - Environment variable:
TMDB_TOKENset to the TMDB Read Access Token - Click Create
- Node.js version: 18 or newer (the proxy uses the built-in
- Connect the repo in Git Version Control: click Create and paste
https://github.com/archcoder-jd/Fadeout.gitas the clone address.
What .cpanel.yml does
cPanel runs this file on every deploy. It:
- Copies the HTML pages and the
css,jsandassetsfolders into the subdomain's folder - Copies
server/app.jsandserver/package.jsoninto the Node.js app folder - Touches
tmp/restart.txt, which restarts the Node.js app so it picks up the new code
Only the files it lists are deployed. Anything else in the repo, such as documentation, stays off the live site. If you add a new page or folder, add it to the copy line.
Deploying an update
- Commit and push to GitHub.
- In cPanel, go to Git Version Control → Manage → Pull or Deploy.
- Click Update from Remote, then Deploy HEAD Commit.
- Run through Testing.
If the proxy doesn't pick up a change, click Restart on the app in the Node.js screen.