What was done:
Some checks failed
Deploy Frontend / deploy (push) Failing after 13s

Removed .env.local from the development directory
Created shared group frontend-devs with both sonder and deploy as members
Updated permissions on /etc/frontend/*.env files to 660 with group frontend-devs
Created symlinks in your development directory:
.env.dev → /etc/frontend/dev.env
.env.prod → /etc/frontend/prod.env
Updated .gitignore to exclude the symlinks
Created ENV_FILES.md documentation
This commit is contained in:
Bailey Taylor
2025-10-10 09:17:10 +08:00
parent cc044aca17
commit 23d06cd3fd
2 changed files with 53 additions and 0 deletions

2
.gitignore vendored
View File

@@ -40,3 +40,5 @@ yarn-error.log*
*.tsbuildinfo *.tsbuildinfo
next-env.d.ts next-env.d.ts
certificate (5).zip certificate (5).zip
.env.dev
.env.prod

51
ENV_FILES.md Normal file
View File

@@ -0,0 +1,51 @@
# Environment Files Setup
## Overview
Environment variables are stored securely in `/etc/frontend/` and accessed via symlinks in this directory.
## File Structure
```
/etc/frontend/
├── dev.env (systemd environment for dev)
└── prod.env (systemd environment for prod)
/home/sonder/ld-sysinfo-react-frontend/
├── .env.dev -> /etc/frontend/dev.env (symlink)
└── .env.prod -> /etc/frontend/prod.env (symlink)
```
## Editing Environment Variables
You can edit these files directly from VSCode:
- `.env.dev` - Development environment (port 3002)
- `.env.prod` - Production environment (port 3001)
**Note:** You need to be in the `frontend-devs` group to edit these files. Both `sonder` and `deploy` users are members.
## After Editing
After making changes to environment files, restart the relevant service:
```bash
# For development
sudo systemctl restart frontend@dev
# For production
sudo systemctl restart frontend@prod
```
## Environment Variables
Both files contain:
- `PORT` - Server port (3002 for dev, 3001 for prod)
- `API_BASE_URL` - Server-side API endpoint
- `NEXT_PUBLIC_API_BASE_URL` - Client-side API endpoint
- `DB_HOST`, `DB_USER`, `DB_PASSWORD`, `DB_NAME` - Database credentials
- `NVD_API_KEY` - API key for CVE data
## Security Notes
- Files are stored in `/etc/frontend/` with `660` permissions (owner: root, group: frontend-devs)
- Only root and members of `frontend-devs` group can read/write
- Files are **not** committed to git (listed in `.gitignore`)
- Symlinks are safe to commit as they don't contain sensitive data