This guide will walk you through the process of deploying the Foxhole Backend on a server (DigitalOcean droplet, EC2 instance, etc.).
- A server running Ubuntu 20.04 or later
- Docker installed on the server
- Git installed on the server
- Access to a Docker registry (e.g., Docker Hub)
-
SSH into your server
-
Clone the repository:
git clone https://github.com/your-username/foxhole-backend.git cd foxhole-backend
-
Create a
.env
file in the project root:cp .env.example .env
-
Edit the
.env
file and fill in the necessary values:nano .env
-
Log in to your Docker registry:
docker login
-
Build the Docker image:
docker build -t your-registry/foxhole-backend:latest .
-
Push the image to your registry:
docker push your-registry/foxhole-backend:latest
-
Install Kamal:
gem install kamal
-
Create a
config/deploy.yml
file if it doesn't exist:mkdir -p config touch config/deploy.yml
-
Edit the
config/deploy.yml
file with your deployment configuration:nano config/deploy.yml
(Refer to the existing
config/deploy.yml
file in the repository for the structure)
-
Create a
.env.production
file with your production environment variables:cp .env.example .env.production nano .env.production
-
Fill in the production values in
.env.production
-
Deploy the application:
kamal setup kamal deploy
-
Check if the application is running:
kamal app status
-
Access the application's health check endpoint:
curl http://your-server-ip:8000/health
-
If you encounter any issues, check the logs:
kamal app logs
-
To restart the application:
kamal app restart
To update the application with new changes:
- Pull the latest changes from the repository
- Rebuild and push the Docker image
- Run
kamal deploy
For any further assistance, please refer to the project's README or open an issue on the GitHub repository.