2.2 KiB
2.2 KiB
Filamenteka Deployment Guide
Architecture
Filamenteka now uses:
- Frontend: Next.js deployed on AWS Amplify
- Database: PostgreSQL on AWS RDS (publicly accessible)
- API: Node.js server that can be run locally or deployed anywhere
AWS RDS Setup
-
Navigate to the terraform directory:
cd terraform -
Initialize Terraform:
terraform init -
Apply the infrastructure:
terraform apply -
After deployment, get the database connection details:
terraform output -json -
Get the database password from AWS Secrets Manager:
aws secretsmanager get-secret-value --secret-id filamenteka-db-credentials --query SecretString --output text | jq -r .password
Running the API
Option 1: Local Development
-
Create
.envfile in theapidirectory:DATABASE_URL=postgresql://filamenteka_admin:[PASSWORD]@[RDS_ENDPOINT]/filamenteka JWT_SECRET=your-secret-key-here ADMIN_PASSWORD=your-password-here PORT=4000 -
Install dependencies and run migrations:
cd api npm install npm run migrate npm run dev
Option 2: Deploy on a VPS/Cloud Service
You can deploy the Node.js API on:
- Heroku
- Railway
- Render
- AWS EC2
- DigitalOcean
- Any VPS with Node.js
Just ensure the DATABASE_URL points to your RDS instance.
Frontend Configuration
Update .env.local to point to your API:
NEXT_PUBLIC_API_URL=http://localhost:4000/api # For local
# or
NEXT_PUBLIC_API_URL=https://your-api-domain.com/api # For production
Security Notes
-
RDS Security: The current configuration allows access from anywhere (0.0.0.0/0). In production:
- Update the security group to only allow your IP addresses
- Or use a VPN/bastion host
- Or deploy the API in the same VPC and restrict access
-
API Security:
- Change the default admin password
- Use strong JWT secrets
- Enable HTTPS in production
Database Management
Connect to the PostgreSQL database using any client:
psql postgresql://filamenteka_admin:[PASSWORD]@[RDS_ENDPOINT]/filamenteka
Or use a GUI tool like:
- pgAdmin
- TablePlus
- DBeaver
- DataGrip