3aeec4d23ee47a306932c78f16751ee7a84abf9f
All checks were successful
Publish Docker Image / Publish Docker Image (push) Successful in 57s
Portfolio Website
Setup
Domain Records
Create two A records, one for the web side of the website and one for the api side of the website. Ideally, the records should look something like myportfolio.example.com
for the web side and api.myportfolio.example.com
, but it is not important.
Reverse Proxy
- It doesn't matter what reverse proxy you use (Nginx, Apache, Traefik, Caddy, etc)
- Point the web domain to the web port (default: 8910)
- Point the api domain to the api port (default: 8911)
SMTP
You will need credentials to authorize sending Email, instructions vary depending on provider (Gmail, Hotmail, etc).
Docker Compose
version: '3.8'
services:
portfolio:
container_name: portfolio
image: git.altaiar.dev/ahmed/portfolio:latest
restart: unless-stopped
environment:
- NODE_ENV=production
- API_PROXY_TARGET=http://localhost:8911
- MAX_HTTP_CONNECTIONS_PER_MINUTE=60
- SESSION_SECRET=super_secret_session_key_change_me_in_production_please
- DATABASE_URL=postgresql://redwood:changeme@db/portfolio
- FIRST_NAME=first name # Your first name
- LAST_NAME=lastname # Your last name
- COUNTRY=US # ISO-3166-1 alpha-2 country code, https://en.wikipedia.org/wiki/ISO_3166-1#Codes
- STATE=New York # Optional, state or province
- CITY=Manhattan # Optional
- DEFAULT_THEME=light # 'light' or 'dark'
- SMTP_HOST=smtp.example.com
- SMTP_PORT=465
- SMTP_SECURE=true
- SMTP_USER=noreply@example.com
- EMAIL_FROM=noreply@example.com
- EMAIL_TO=email@example.com
- SMTP_PASSWORD=password
- DOMAIN=portfolio.example.com
- API_DOMAIN=api.portfolio.example.com
# Careful, addresses below must not end with a '/'
- ADDRESS_PROD=https://portfolio.example.com # https://DOMAIN
- API_ADDRESS_PROD=https://api.portfolio.example.com # https://API_DOMAIN
ports:
- 8910:8910 # Web
- 8911:8911 # API
depends_on:
db:
condition: service_healthy
volumes:
- files:/home/node/app/api/files_prod
command: >
/bin/sh -c "
yarn rw build &&
yarn rw prisma migrate deploy &&
yarn rw prisma db seed &&
yarn rw serve"
db:
container_name: portfolio-db
image: postgres:16-bookworm
environment:
- POSTGRES_USER=redwood
- POSTGRES_PASSWORD=changeme # Change to a more secure password
- POSTGRES_DB=portfolio
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -d DATABASE_URL"] # Replace DATABASE_URL with the database URL from the portfolio container
interval: 10s
timeout: 5s
retries: 5
volumes:
- postgres:/var/lib/postgresql/data
volumes:
postgres:
files: # For persistent file storage across upgrades
Fix Files Ownership
The files
volume in Docker is owned by root
, since the portfolio container runs under the node
user, file uploads will fail. Run this command to give ownership to the node
user:
sudo docker exec -u root portfolio chown -R node:node /home/node/app/api/files_prod
Logging In
- Once the container is up and running, head to
/login
(https://portfolio.example.com/login
), default credentials are below - If you would like to change the password, head to
/forgot-password
(https://portfolio.example.com/forgot-password
), the username isadmin
- If you correctly configured SMTP, you should receive an Email from
EMAIL_FROM
toEMAIL_TO
- The Email contains the link needed to change your password
- If you correctly configured SMTP, you should receive an Email from
Default Credentials
Username: admin
Password: SMTP_PASSWORD
Description
The PDF war is over
Latest
Languages
TypeScript
95.2%
JavaScript
2.6%
Dockerfile
1.7%
HTML
0.3%
CSS
0.2%