Self Hosting

Deploy S3 Portal with Docker and configure the required environment variables.

On this page

Prerequisites

  • Docker installed on your machine. Install Docker
  • A domain or server (optional, for production).

Step 1 - Download

Download compose file

curl -LO https://github.com/mayurG2299/s3-portal/raw/master/docker-compose.production.yml
curl -LO https://github.com/mayurG2299/s3-portal/raw/master/.env.example

Step 2 - Create .env

Create env file

cp .env.example .env

Step 3 - Generate keys

Generate and write secrets

NEXTAUTH_SECRET=$(openssl rand -base64 32)
ENCRYPTION_KEY=$(openssl rand -base64 32 | cut -c1-32)
sed -i.bak "s|^NEXTAUTH_SECRET=.*|NEXTAUTH_SECRET=\"$NEXTAUTH_SECRET\"|" .env
sed -i.bak "s|^ENCRYPTION_KEY=.*|ENCRYPTION_KEY=\"$ENCRYPTION_KEY\"|" .env
rm -f .env.bak

Step 4 - Configure values

Edit env file

nano .env
VariableRequiredDescription
DB_PASSWORDrequiredStrong PostgreSQL password
NEXTAUTH_SECRETrequiredopenssl rand -base64 32
ENCRYPTION_KEYrequiredopenssl rand -base64 32
NEXTAUTH_URLrequirede.g. http://localhost:3000
NEXT_PUBLIC_APP_URLrequiredSame as NEXTAUTH_URL
DOCKER_USERrequiredDocker Hub org/user, e.g. may99
PORToptionalDefault: 3000
LOG_LEVELoptionalDefault: INFO

Step 5 - Start

Start services

docker compose -f docker-compose.production.yml up -d

Step 6 - Run migrations (first time only)

Run migrations

docker compose -f docker-compose.production.yml run --rm app npx prisma db seed

Step 7 - Connect AWS

Useful commands

Operations

# View logs
docker compose -f docker-compose.production.yml logs -f

# Stop
docker compose -f docker-compose.production.yml down

# Update to latest
docker compose -f docker-compose.production.yml pull && docker compose -f docker-compose.production.yml up -d

Updating

Update

docker compose -f docker-compose.production.yml pull
docker compose -f docker-compose.production.yml up -d