- Introduced `accountService` for managing user profiles, including fetching and updating profile and address information. - Created `auth.store` to handle client-side authentication state, including login, signup, and session management. - Added centralized exports for authentication services in `auth/api/index.ts`. - Implemented API services for billing and checkout functionalities, enhancing the overall service architecture. - Established a new structure for service APIs, promoting better organization and maintainability across the portal features.
2.5 KiB
2.5 KiB
Customer Portal - Portainer Deployment
Quick Setup
1. Load Docker Images
Upload your images to the server and load them:
docker load < portal-frontend-latest.tar
docker load < portal-backend-latest.tar
Verify they're loaded:
docker images | grep portal
2. Create Stack in Portainer
- Go to Portainer → Stacks → Add Stack
- Name:
customer-portal - Paste contents of
docker-compose.yml - Scroll down to Environment Variables
- Copy variables from
env.exampleand fill in your production values
3. Generate Secrets
Generate secure random values for:
# JWT Secret
openssl rand -base64 32
# CSRF Secret
openssl rand -base64 32
# PostgreSQL Password
openssl rand -base64 24 | tr -d '/+=' | cut -c1-32
Encode your Salesforce private key:
base64 -w 0 < sf-private.key
4. Deploy
Click Deploy the stack in Portainer.
How It Works
This setup uses network_mode: bridge with Docker links to avoid the iptables/IPv6 issues that can occur on some servers.
Key Points
- No custom networks - Uses Docker's default bridge network
- Service discovery via links - Services reference each other by container name
- Localhost binding - Ports are bound to
127.0.0.1for security (use Nginx/Plesk to proxy) - All config via Portainer - No external env files needed
Service URLs (internal)
| Service | Internal URL |
|---|---|
| Backend | http://backend:4000 |
| Database | postgresql://database:5432 |
| Redis | redis://cache:6379 |
Nginx/Plesk Proxy
Configure your domain to proxy to:
- Frontend:
http://127.0.0.1:3000 - Backend API:
http://127.0.0.1:4000
Updating the Stack
-
Load new images:
docker load < portal-frontend-latest.tar docker load < portal-backend-latest.tar -
In Portainer: Stacks → customer-portal → Update the stack
-
Check Re-pull image and click Update
Troubleshooting
View Logs
docker logs portal-frontend
docker logs portal-backend
docker logs portal-database
docker logs portal-cache
Check Container Health
docker ps
Access Database
docker exec -it portal-database psql -U portal -d portal_prod
Test Service Connectivity
# From backend container
docker exec -it portal-backend sh -c "nc -zv database 5432"
docker exec -it portal-backend sh -c "nc -zv cache 6379"