animated-waddle
Animated Waddle is a template REST API backend built with Go and PostgreSQL. It includes support for custom PostgreSQL images that you can create and preload with data. The project also comes with Kubernetes configuration files for easy deployment.
Technologies and Libraries
- Go
- PostgreSQL
- Gofiber
- GORM
- Docker
Building and Running the Application
You can deploy the application using either Docker or Kubernetes. Below are instructions for both methods.
A. Create Custom PostgreSQL Docker Image
- Modify the
database/init.sql file to define your databases, tables, relations, and any initial data you want to preload.
- During the build process, the Docker image will be created by executing the script inside the container.
Command to build the PostgreSQL Docker image:
docker build -f db.Dockerfile -t dhrypt/animated-waddle:latest .
Push the PostgreSQL Docker image to Docker Hub:
docker push dhrypt/animated-waddledb
To run the Docker image locally, use the following command:
docker run -d --rm -p 5432:5432 -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres --name animated-waddledb dhrypt/animated-waddledb:latest
B. Docker Compose
You can run the application using Docker Compose with the following command:
docker-compose up --build
C. Kubernetes
To deploy the application on a Kubernetes cluster, YAML files are provided for both the Go backend and PostgreSQL database.
Run the following commands to start the Kubernetes deployment and services:
kubectl apply -f deployment.yaml
kubectl apply -f postgres-deployment.yaml
Future Tasks
- Add tests
- Add support for gRPC
- Add support for GraphQL database
- Add support for Auto build and push to dockerhub through Github actions