Files
linuxservice/DEPLOYMENT.md

3.9 KiB

Coolify Deployment Guide

This guide explains how to deploy the Linux Service website to your self-hosted Coolify instance with automatic updates from your Gitea repository.

Prerequisites

  • Coolify installed and running
  • Access to your Gitea instance (gitea.boner.be)
  • Domain name configured for your service

Environment Variables

The application supports the following environment variables:

Variable Default Value Description
PORT 8080 Port the application listens on
COMPANY_NAME Hogeland Linux Company name displayed on the website
KVK 12345678 KVK number for contact information
EMAIL info@hogelandlinux.nl Contact email address
PHONE +31 6 12345678 Contact phone number

Coolify Deployment Steps

1. Create New Resource in Coolify

  1. Open your Coolify dashboard
  2. Click "New Resource"
  3. Select "Public Repository" or "Private Repository" (if your Gitea repo is private)

2. Configure Repository

Repository URL: https://gitea.boner.be/[your-username]/[repository-name]

Branch: master

Build Pack: Docker

3. Configure Build Settings

  • Dockerfile Location: ./Dockerfile
  • Build Context: .
  • Ports: 8080

4. Set Environment Variables

In the Coolify environment variables section, add:

PORT=8080
COMPANY_NAME=Hogeland Linux
KVK=12345678
EMAIL=info@hogelandlinux.nl
PHONE=+31 6 12345678

5. Configure Domain

  • Set your desired domain/subdomain
  • Coolify will automatically handle SSL certificate generation

6. Enable Auto-Deploy

  1. Go to the "Settings" tab of your application
  2. Enable "Auto Deploy"
  3. Set the branch to master
  4. Configure webhook URL in your Gitea repository

7. Gitea Webhook Configuration

To enable automatic deployments when you push to master:

  1. Go to your repository on gitea.boner.be
  2. Navigate to Settings → Webhooks
  3. Click "Add Webhook" → "Gitea"
  4. Set the Payload URL to your Coolify webhook URL (found in your app settings)
  5. Set Content Type to application/json
  6. Select "Just the push event"
  7. Check "Active"
  8. Click "Add Webhook"

Docker Commands for Local Testing

# Build the image
docker build -t linuxservice .

# Run locally
docker run -p 8080:8080 \
  -e COMPANY_NAME="Hogeland Linux" \
  -e EMAIL="info@hogelandlinux.nl" \
  linuxservice

# Or use docker-compose
docker-compose up --build

Troubleshooting

Common Issues

  1. Build Fails: Check that all files (templates/, static/) are committed to your repository
  2. Port Issues: Ensure PORT environment variable matches the exposed port
  3. Template Errors: Verify that templates directory is included in the Docker image

Logs

Check application logs in Coolify dashboard under the "Logs" tab.

Health Check

The application should respond to GET / with the homepage. You can check this endpoint to verify the deployment.

File Structure

linuxservice/
├── Dockerfile              # Container configuration
├── docker-compose.yml      # Local development
├── .dockerignore           # Docker build optimization
├── main.go                 # Go application
├── go.mod                  # Go module definition
├── static/                 # Static assets (CSS, images, etc.)
│   └── style.css
├── templates/              # HTML templates
│   ├── index.html
│   └── contact.html
└── DEPLOYMENT.md           # This file

Performance Considerations

  • The Docker image uses multi-stage builds for smaller size
  • Static files are served directly by the Go application
  • No external dependencies required
  • Minimal resource usage (suitable for small VPS instances)

Security Notes

  • The application runs as a non-root user in the container
  • Only port 8080 is exposed
  • No sensitive data is stored in the application
  • Environment variables should be used for configuration