This repository contains a Go implementation of the MiniTwit application, designed for the ITU DevOps course. The project features a containerized development environment and automated cloud deployment on DigitalOcean.
The application is deployed and reachable at the following endpoints:
| Service | URL |
|---|---|
| MiniTwit Web UI | http://164.92.186.201:5001 |
| Simulator API | http://164.92.186.201:5001/api |
To get the project running locally for the first time, follow these steps to set up your environment:
We use template files to prevent local configuration or binary data from cluttering the version control.
# 1. Create your local working database from the template
cp tmp/minitwit.db.example tmp/minitwit.db
# 2. Create the DB IP configuration file at root
# (Set to 127.0.0.1 for local SQLite or your remote DB server IP)
echo "127.0.0.1" > db_ip.txtFollowing modern DevOps practices, we recommend using a single Dockerfile with multi-stage builds to handle both development and production.
- Build image:
./develop.sh build - Enter Container:
./develop.sh run - Inside the container: The project root is synced to the container's workspace. You can run
go run main.godirectly.
You can use the following commands for quick task execution:
make run: Starts the Go application locally.make build: Compiles the Go binary.make test-sim: Runs the Python simulator against your local instance.
Infrastructure provisioning and application deployment are automated using Vagrant with the DigitalOcean provider.
Ensure the following environment variables are configured on your host machine:
| Variable | Description |
|---|---|
DIGITAL_OCEAN_TOKEN |
Your DigitalOcean Personal Access Token. |
SSH_KEY_NAME |
The name of the SSH key registered in your DigitalOcean account. |
export DIGITAL_OCEAN_TOKEN="your_actual_token_here"
export SSH_KEY_NAME="your_key_name"To provision the Database and Web servers and deploy the latest code:
vagrant up --provider=digital_oceanTest your API compatibility using the provided Python simulator:
# Ensure you are at the project root
python3 test/minitwit_simulator.py "http://localhost:5001/api"
python3 test/minitwit_simulator.py "http://164.92.186.201:5001/api"To view real-time application logs, SSH into the webserver:
vagrant ssh webserver
tail -f /var/log/minitwit.log.
├── db/ # Database schema and initialization scripts (schema.sql is here)
├── docker/ # Dockerfiles (Multi-stage build strategy)
├── static/ # Static assets (CSS, Images, JS)
├── templates/ # HTML templates for the Gin framework
├── test/ # Python simulator and test scenario CSVs
├── tmp/ # Local DB templates (Real DB and legacy folder are ignored)
├── simulator_api.go # Application entry point
├── minitwit.go # Application entry point
├── Makefile # Shortcuts for common tasks
└── Vagrantfile # Infrastructure as Code (IaC) configuration
└── develop.sh # for local developemnt