- Docker and Docker Compose
- OpenSSL (for generating dev certificates)
This application runs three containers:
- Traefik as proxy and SSL (using lets encrypt)
- MySQL to store data
- Gokapp, the application that the users are using
The app is written in java, using Spring Boot, and Thymeleaf for sever side html-rendering. Some plain javascript is also used. During the build process the "gokapp" is packed as an image that can be used in a container environment.
Using the start-script first checks that some fundamental settings are done or else fixes these issues and then start the application with the profile added (ie. dev or prod)
Clone the repository:
git clone https://github.com/erydberg/gokapp.git
cd gokappSet up fundamental configuration, domain name, passwords etc.
cp .env.example .env.prod
vi .env.prod # Configure domain, passwords, email in this file./start.sh prodcp .env.prod .env
docker compose -f compose.yaml -f compose.prod.yaml up -dAccess at https://your-domain.com
./setup-dev-certs.sh
sudo sh -c 'echo "127.0.0.1 gokapp.local" >> /etc/hosts'./start.sh devcp .env.dev .env
docker compose -f compose.yaml -f compose.dev.yaml up -dAccess at https://gokapp.local
- Clone the repository:
git clone https://github.com/erydberg/gokapp.git
cd gokapp- Generate development SSL certificates:
chmod +x setup-dev-certs.sh
./setup-dev-certs.sh- Add local domain to your
/etc/hosts:
# On Linux/Mac
sudo sh -c 'echo "127.0.0.1 gokapp.local" >> /etc/hosts'
# On Windows (as Administrator in notepad)
# Add to C:\Windows\System32\drivers\etc\hosts:
# 127.0.0.1 gokapp.local- Set up environment:
cp .env.dev .env- Start the application:
docker compose -f compose.yaml -f compose.dev.yaml up -d- Access the application:
- App: https://gokapp.local (accept self-signed certificate warning)
- Traefik Dashboard: http://localhost:8081
- View logs:
docker compose logs -f gokapp- Stop the application:
docker compose -f compose.yaml -f compose.dev.yaml downWhen you first visit https://gokapp.local, your browser will show a security warning because the certificate is self-signed:
- Chrome/Edge: Click "Advanced" → "Proceed to gokapp.local (unsafe)"
- Firefox: Click "Advanced" → "Accept the Risk and Continue"
- Safari: Click "Show Details" → "visit this website"
This is normal for local development!
- Server with Docker and Docker Compose
- Domain name pointing to your server's IP
- Ports 80 and 443 open in firewall
- Clone the repository on your server:
git clone https://github.com/erydberg/gokapp.git
cd gokapp- Create production environment file:
cp .env.example .env.prod
nano .env.prod-
Update
.env.prodwith:- Strong database passwords
- Your domain name
- Your email for Let's Encrypt
- Traefik dashboard password (optional)
-
Copy to active environment:
cp .env.prod .env- Create letsencrypt directory with correct permissions:
mkdir -p letsencrypt
chmod 600 letsencrypt- Start the application:
docker compose -f compose.yaml -f compose.prod.yaml up -d- Watch the logs to see certificate generation:
docker compose logs -f traefikLet's Encrypt will automatically:
- Generate SSL certificates
- Renew them before expiry
- Handle HTTPS for your domain
- Access your application:
- App: https://your-domain.com
- Traefik Dashboard: https://traefik.your-domain.com (if configured)
To generate a secure password for the Traefik dashboard:
# Install apache2-utils (if not installed)
sudo apt-get install apache2-utils
# Generate password (replace 'yourpassword' with your desired password)
echo $(htpasswd -nb admin yourpassword) | sed -e s/\\$/\\$\\$/g
# Copy the output to TRAEFIK_DASHBOARD_AUTH in .env.prodCertificate errors?
# Regenerate certificates
./setup-dev-certs.sh
docker compose -f compose.yaml -f compose.dev.yaml restart traefikCan't access gokapp.local?
- Check
/etc/hostsfile has the entry - Try
ping gokapp.localto verify DNS
Port conflicts?
- Make sure ports 80, 443, 8081 are not in use
- Check with:
sudo lsof -i :80 -i :443 -i :8081
Let's Encrypt rate limits?
- Use staging server first (uncomment in compose.prod.yaml)
- Production limit: 50 certificates per domain per week
Certificate not generating?
- Ensure domain DNS points to your server
- Check ports 80 and 443 are open
- View logs:
docker compose logs traefik
Database connection issues?
- Check environment variables are set
- Verify MySQL is healthy:
docker compose ps
To Development:
docker compose -f compose.yaml -f compose.prod.yaml down
cp .env.dev .env
docker compose -f compose.yaml -f compose.dev.yaml up -dTo Production:
docker compose -f compose.yaml -f compose.dev.yaml down
cp .env.prod .env
docker compose -f compose.yaml -f compose.prod.yaml up -d- Never commit
.env.prodto version control - Use strong, unique passwords
- Regularly update Docker images
- Monitor logs for suspicious activity
- Keep backups of your database
docker compose up -d
- Create your environment configuration:
cp .env.example .env- IMPORTANT: Edit
.envand change the default passwords:
nano .env # or use your preferred editor- Start the application:
docker compose up -d- Access at http://localhost:8080
The .env.example file contains placeholder passwords. You must:
- Copy it to
.env - Change all passwords to strong, unique values
- Never commit
.envto version control
# Stop containers
docker compose down
# Stop and remove all data
docker compose down -vmvn spring-boot:runAccess H2 console at http://localhost:8080/h2-console
./start.sh dev
cp .env.dev .env
docker compose -f compose.yaml -f compose.dev.yaml up -d./start.sh prodcp .env.prod .env
docker compose -f compose.yaml -f compose.prod.yaml up -dmvn spring-boot:build-image