Self-Hosting
This guide provides step-by-step instructions for self-hosting Securelog, including the frontend dashboard, backend API, and PostgreSQL database. All services are containerized using Docker and orchestrated with Docker Compose.
Prerequisites
- Docker and Docker Compose installed on your system.
- A domain name (optional but recommended for HTTPS).
- Basic familiarity with Docker and command-line tools.
- We recommended having an account on Onboardbase to store your secrets.
- A service token from Securelog team to verify your service.
Set Up Environment Variables
Create a .env
file in the root directory of your project with the following variables:
- If you plan to use Onboardbase - Create an account on Onboardbase to store your secrets and get the service token from there.
- Set the
ONBOARDBASE_TOKEN
variable, and all the variables except the Database Configuration.
# ONLY IF YOU WANT TO USE onboardbase <optional>
# General Configuration
ONBOARDBASE_TOKEN=Service....****
BE_PROJECT_NAME=securelog-be-test
BE_PROJECT_ENV=development
BE_CADDY_DOMAIN=localhost:3000
BACKEND_PORT=3000
FE_PROJECT_NAME=securelog-fe-test
FE_PROJECT_ENV=development
FE_CADDY_DOMAIN=localhost:4000
FRONTEND_PORT=4000
# Database Configuration
POSTGRES_DB=securelog_db
POSTGRES_USER=securelog_user
POSTGRES_PASSWORD=securelog_password
POSTGRES_HOST=securelog-db
POSTGRES_PORT=5432
- If you plan to use plain secrets - Create
.env.be
file.
# Base Config
FRONTEND_URL=http://localhost:4000
JWT_SECRET=7134743777217A25432A462D4A614E645267556B58703273357638782F413F44
CORS='example.com, onboardbase.com' # optional if you want to use other domains
# Auth and Emails
RESEND_API_KEY=re_Vcv3rFbJ_2CG******
# Slack configration
SLACK_CLIENT_SECRET=606******
SLACK_CLIENT_ID=2366310139207.8******
SLACK_STATE_SECRET=dj2m9dj******
SLACK_APP_TOKEN=xapp******
SLACK_HOOK=https://hooks.slack.com/services/T******
SLACK_SIGNING_SECRET=37b61ff53******
SECURELOG_BOT_TOKEN=xoxb-******
Docker Compose Configuration
Create a docker-compose.yml
file with the following configuration:
version: '3.8'
services:
# PostgreSQL Database
securelog-db:
image: postgres:16-alpine
container_name: securelog-db
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
ports:
- "5432:5432"
volumes:
- securelog_db_data:/var/lib/postgresql/data
restart: unless-stopped
# Securelog Backend
securelog-backend:
image: onboardbase/securelog-backend:latest
container_name: securelog-backend
environment:
# these are required if you want to use OBB
# ONBOARDBASE_PROJECT: ${BE_PROJECT_NAME}
# ONBOARDBASE_ENV: ${BE_PROJECT_ENV}
# ONBOARDBASE_TOKEN: ${ONBOARDBASE_TOKEN}
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@securelog-db:5432/${POSTGRES_DB}
env_file:
- .env.be
ports:
- "${BACKEND_PORT}:3000"
depends_on:
- securelog-db
restart: unless-stopped
# Securelog Frontend
securelog-dashboard:
image: onboardbase/securelog-app:latest
container_name: securelog-dashboard
environment:
# # these are required if you want to use OBB
# # ONBOARDBASE_TOKEN: ${ONBOARDBASE_TOKEN}
# # ONBOARDBASE_PROJECT: ${FE_PROJECT_NAME}
# # ONBOARDBASE_ENV: ${FE_PROJECT_ENV}
# FE_CADDY_DOMAIN: ${FE_CADDY_DOMAIN}
NUXT_PUBLIC_API_BASE: http://securelog-backend:3000/ # the trailing slash is important
ports:
- "${FRONTEND_PORT}:4000"
depends_on:
- securelog-backend
restart: unless-stopped
volumes:
securelog_db_data:
Start the Services
Run the following command to start all services:
docker-compose up -d
This will:
- Start the PostgreSQL database.
- Start the Securelog backend API.
- Start the Securelog dashboard.
Access the Services
- Frontend Dashboard: Open
http://localhost:4000
. - Backend API: Open
http://localhost:3000
- Database: Accessible on
https://localhost:5432
with the credentials from the.env
file.
Verify the Setup
- Frontend: Navigate to the dashboard and ensure it loads correctly.
- Backend: Test the
/health
endpoint:
curl http://localhost:3001/health
Expected response:
{
"status": "ok",
"message": "API is running"
}
Database: Connect to the PostgreSQL database using a client like psql or pgAdmin:
psql -h localhost -U securelog_user -d securelog_db
Troubleshooting
Database Connection Issues:
- Verify the
DATABASE_URL
in the backend service. - Ensure the PostgreSQL container is running.
WebSocket Errors:
- Ensure the backend service is running and accessible.
- Check for CORS or firewall issues.