Skip to content

Installation

Prerequisites

Before you begin, ensure you have the following installed on your system:

  • Docker: Version 24.0.0 or later
  • Docker Compose: Version 2.20.0 or later

You can verify your installations by running the following commands:

bash
docker --version
docker-compose --version

Getting Started

This documentation will guide you through deploying our application using a Docker Compose configuration with our official Docker image.

1. Create a Project Directory

Create a directory for your project files:

bash
mkdir hurdle-finance 
cd hurdle-finance

2. Create Environment File

Create a .env file in your project directory with the following configuration:

bash
GRPC_SERVER_PORT=8081
HTTP_SERVER_PORT=8080
LOG_LEVEL=info

## change these as needed
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=hurdle
POSTGRES_DRIVER=postgres
POSTGRES_SSL_MODE=disable

TOKEN_SYMMETRIC_KEY=BI6EAQXQMY5A3L6ZAJFQ019J9XILDIDB ## change this to a random string
ACCESS_TOKEN_DURATION=720
REFRESH_TOKEN_DURATION=4320

REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_USER=default

Adjust the values according to your specific requirements.

3. Create Docker Compose File

Create a docker-compose.yml file in your project directory with the following content:

yaml
services:
  hurdle-postgres:
    image: postgres:17.3-alpine3.21
    networks:
      - hurdle
    restart: unless-stopped
    ports:
      - "5432:5432"
    healthcheck:
      test: ["CMD", "pg_isready", "-d", "hurdle", "-U", "postgres"]
      interval: 10s
      timeout: 5s
      retries: 5
    environment:
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_DB=hurdle

  hurdle-redis:
    image: redis:7.4.2-alpine3.21
    networks:
      - hurdle
    restart: unless-stopped
    environment:
      - REDIS_PASSWORD=password
      - REDIS_USER=default
    ports:
      - "6379:6379"
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5
    command: redis-server --save 20 1 --loglevel warning

  hurdle-backend:
    image: cksidharthan/hurdle-backend:latest
    platform: linux/amd64
    pull_policy: always
    ports:
      - "8081:8081"
      - "8080:8080"
    networks:
      - hurdle
    restart: unless-stopped
    environment:
      - PORT=8889
      - POSTGRES_HOST=hurdle-postgres
      - POSTGRES_PORT=5432
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=hurdle
      - POSTGRES_DRIVER=postgres
      - POSTGRES_SSL_MODE=disable
      - GRPC_SERVER_PORT=8081
      - HTTP_SERVER_PORT=8080
      - REDIS_HOST=hurdle-redis
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/healthz"]
      interval: 10s
      timeout: 5s
      retries: 5
    depends_on:
      hurdle-postgres:
        condition: service_healthy
      hurdle-redis:
        condition: service_healthy

  hurdle-frontend: 
    image: cksidharthan/hurdle-frontend:latest
    platform: linux/amd64
    pull_policy: always
    ports:
      - "8888:3000"
    networks:
      - hurdle
    restart: unless-stopped
    environment:
      - NUXT_PUBLIC_BACKEND_API_URL=http://api.hurdlefinance.dev/api 
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8888/health"]
      interval: 10s
      timeout: 5s
      retries: 5
    depends_on:
      hurdle-postgres:
        condition: service_healthy
      hurdle-redis:
        condition: service_healthy
      hurdle-backend:
        condition: service_healthy

  hurdle-docs:
    image: cksidharthan/hurdle-docs:latest
    platform: linux/amd64
    pull_policy: always
    ports:
      - "5173:80"
    networks:
      - hurdle
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:5173"]
      interval: 10s
      timeout: 5s
      retries: 5

networks:
  hurdle:
    driver: bridge

4. Start the Application

Launch the application using Docker Compose:

bash
docker-compose up -d

This will start all the services defined in your Docker Compose file in detached mode.

5. Verify Deployment

Check if all containers are running properly:

bash
docker-compose ps

You should see three containers running: hurdle-backend, hurdle-frontend, asyncmon postgres, and redis.

You can access the application by navigating to http://localhost:3000 in your web browser (or whichever port you specified in the .env file).

6. View Application Logs

To see the application logs:

bash
docker-compose logs -f app

Press Ctrl+C to stop viewing the logs.

Released under the GNU General Public License v3.0 License.