62 lines
1.5 KiB
Plaintext
62 lines
1.5 KiB
Plaintext
Based on the codebase analysis, here's what needs to change for your Ubuntu deployment:
|
|
|
|
Required Changes
|
|
|
|
Create a systemd service file instead:
|
|
|
|
# /etc/systemd/system/carnews.service
|
|
[Unit]
|
|
Description=Car News API Server
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=<your-ubuntu-user>
|
|
WorkingDirectory=/path/to/news-app
|
|
ExecStart=/usr/bin/node server.js
|
|
Restart=on-failure
|
|
EnvironmentFile=/path/to/news-app/.env
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
|
|
2. Rebuild native modules
|
|
|
|
The better-sqlite3 package requires recompilation on Ubuntu:
|
|
npm rebuild better-sqlite3
|
|
|
|
3. Nginx configuration for Ubuntu
|
|
|
|
You'll need to create an Nginx config (not included in this repo). Example:
|
|
|
|
location /carnews/ {
|
|
alias /path/to/news-app/dist/;
|
|
try_files $uri $uri/ /carnews/index.html;
|
|
}
|
|
|
|
location /carnews/api/ {
|
|
proxy_pass http://localhost:5555/api/;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
}
|
|
|
|
4. Update paths if directory structure differs
|
|
|
|
On Ubuntu: /var/www/news-feed-car-mode/news-app
|
|
|
|
No Changes Needed
|
|
|
|
- vite.config.js - base: '/carnews/' stays the same
|
|
- server.js - Port 5555 works as-is
|
|
- .env file - copied over
|
|
- All source code - Uses relative paths
|
|
|
|
Deployment Steps
|
|
|
|
1. Copy the codebase to Ubuntu
|
|
2. Run npm install and npm rebuild better-sqlite3
|
|
3. Run npm run build to generate fresh /dist files
|
|
4. Create the systemd service file
|
|
5. Configure Nginx with the proxy rules
|
|
6. Enable and start the service: sudo systemctl enable --now carnews
|