5.5 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 |
STREET |
Voorstraat 123 |
Street address |
POSTAL_CODE |
9967 AA |
Postal code |
VILLAGE |
Eenrum |
Village/city name |
DOMAIN |
hogelandlinux.nl |
Your website domain (used for SEO and social media meta tags) |
TELEGRAM_BOT_TOKEN |
(empty) | Telegram bot token for contact form notifications |
TELEGRAM_CHAT_ID |
(empty) | Telegram chat ID where notifications will be sent |
Telegram Integration Setup (Optional)
The contact form can send notifications to a Telegram chat. To set this up:
1. Create a Telegram Bot
- Message @BotFather on Telegram
- Send
/newbot
command - Follow the instructions to create your bot
- Copy the bot token (looks like
123456789:ABCdefGHIjklMNOpqrsTUVwxyz
)
2. Get Your Chat ID
- Add your bot to the chat where you want notifications
- Send a message to the bot in that chat
- Visit
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
- Look for the
chat.id
field in the response - Copy the chat ID (can be positive or negative number)
3. Configure Environment Variables
Set the following environment variables in your deployment:
TELEGRAM_BOT_TOKEN=123456789:ABCdefGHIjklMNOpqrsTUVwxyz
TELEGRAM_CHAT_ID=123456789
Note: If these variables are not set, the contact form will still work but won't send Telegram notifications.
Coolify Deployment Steps
1. Create New Resource in Coolify
- Open your Coolify dashboard
- Click "New Resource"
- 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
STREET=Voorstraat 123
POSTAL_CODE=9967 AA
VILLAGE=Eenrum
DOMAIN=hogelandlinux.nl
TELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_CHAT_ID=your_chat_id_here
Note: The Telegram variables are optional. If not set, the contact form will work but won't send notifications.
5. Configure Domain
- Set your desired domain/subdomain
- Coolify will automatically handle SSL certificate generation
6. Enable Auto-Deploy
- Go to the "Settings" tab of your application
- Enable "Auto Deploy"
- Set the branch to
master
- Configure webhook URL in your Gitea repository
7. Gitea Webhook Configuration
To enable automatic deployments when you push to master:
- Go to your repository on gitea.boner.be
- Navigate to Settings → Webhooks
- Click "Add Webhook" → "Gitea"
- Set the Payload URL to your Coolify webhook URL (found in your app settings)
- Set Content Type to
application/json
- Select "Just the push event"
- Check "Active"
- 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
- Build Fails: Check that all files (templates/, static/) are committed to your repository
- Port Issues: Ensure PORT environment variable matches the exposed port
- 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