military-count-down Tailwind Templates

Military Count Down

A military discharge date calculator and company wiki toy project.

military-count-down

Description

A military discharge date calculator and company wiki toy project for myself and coworkers for fun.

This project consists of the left days of military duty and some wiki about the company where I worked as a skilled industrial personnel agent.

Developed using

TypeScript Next.js Nest.js Docker Nginx
Cloudflare R2 PostgreSQL Prisma TailwindCSS

Pre-requisites

  • Git
  • Docker
  • Docker Compose
  • Cloudflare R2

Installiation

Summary

  1. Clone repository.
  2. Modify datasource (docker-compose.yml and .env both)
  3. Create new docker network named military-count-down
  4. Docker compose build and execute

Detail

  1. Clone this repository using the command below where you want.

    >> git clone https://github.com/dinb1242/military-count-down.git
    
  2. Move to the directory where you have cloned, find docker-compose.yml, and modify the postgreSQL db, username, and password what you want to use.

    You have to modify .env file too (datasource such as DB, username, password in this file must match up with db.environment in docker-compose.yml)

    >> cd ./military-count-down
    
      # docker-compose.yml
      # Modify the db.environment.
      db:
     container_name: military-count-down-postgres
     image: postgres:15
     environment:
       - POSTGRES_DB=local
       - POSTGRES_USER=postgres
       - POSTGRES_PASSWORD=password
     ports:
       - "5432:5432"
     networks:
       - military-count-down
    

  3. Move to the server directory, create .env file to specify the postgreSQL datasource and fill in the below code.

    Note that the datasource must match up with db.environment in docker-compose.yml

    # Create .env in server directory.
    >> cd ./server
    >> touch .env
    
    # .env
    DATABASE_URL="postgresql://username:password@db:5432/db_name?schema=schema_name"
    JWT_KEY=A_JWT_key_what_you_want_to_use
    

  4. Before execute the docker compose command, you have to create a new docker network named military-count-down by typing the command below.

    Otherwise, you can just remove docker compose network setting by modifying networks property in docker-compose.yml. (If you decide this way, you can skip this step.)

    To create a docker network, execute the command below.

    >> docker network create military-count-down
    

  5. Move to the root directory and type the command below to set up the whole projects.

    # Move to the root directory and build.
    >> cd ..
    >> docker compose up --build -d
    

  6. Once the docker compose command finished, you can check the status using the command below.

    >> docker compose ps
    
# Results
NAME                           COMMAND                  SERVICE             STATUS              PORTS
military-count-down-postgres   "docker-entrypoint.s…"   db                  running             0.0.0.0:5432->5432/tcp, :::5432->5432/tcp
military-count-down-server-1   "/bin/sh -c ./entryp…"   server              running             0.0.0.0:8080->8080/tcp, :::8080->8080/tcp
military-count-down-web-1      "npm run start"          web                 running             0.0.0.0:3000->3000/tcp, :::3000->3000/tcp

  1. If some containers are not running, then you can run those by using the command below.
    >> docker compose start # Whole containers will be started.
    >> docker compose start [service name] # [service name] container will be starte.
    

Features

Top categories

Loading Svelte Themes