Skip to content

natserract/eniqlo-store

 
 

Repository files navigation

Eniqlo Store

https://openidea-projectsprint.notion.site/EniQilo-Store-93d69f62951c4c8aaf91e6c090127886?pvs=4

Environment:

cp .env.example .env

Database:

DB_HOST=localhost
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_NAME=eniqlo-store
DB_PORT=5432
DB_PARAMS="sslmode=disabled"
JWT_SECRET=a-very-secretive-secret-key
BCRYPT_SALT=8

Run migration:

  1. Install golang-migrate

  2. Run scripts

make migrateup

Setup:

go mod download

Run development server:

make dev

Docker:

Running on your local machine:

1. Create Network

# Create a network, which allows containers to communicate
# with each other, by using their container name as a hostname
docker network create app_network

2. Start a Postgres instance

docker-compose up --build postgres

3. Migrate database

docker-compose up --build migrate

4. Running API

export DB_HOST=host.docker.internal && docker-compose up --build api

Open http://localhost:8080

Publishing Docker images:

1. Prepare database (if not exists)

docker exec -it enigmanations_postgres_container psql -h host.docker.internal -p 5430 -U postgres -c 'create database "eniqlo-store"'

2. Run migration

docker-compose up --build migrate

3. Push to the registry

# The password needs to be requested from the author, @natserract.
export DOCKER_PASSWORD="" && bash ./docker-deploy.sh

Run from registry:

1. Pull from registry https://hub.docker.com/repository/docker/natserract/enigmanations-inventory

docker pull natserract/enigmanations-inventory:latest

2. Run

# Create a network, which allows containers to communicate
# with each other, by using their container name as a hostname
docker network create app_network

# Using env file
docker run -it --rm --network app_network -p 8080:8080 \
    --env-file .env natserract/enigmanations-inventory

# Using env variable exported
docker run -it --rm --network app_network -p 8080:8080 \
    -e DB_HOST=host.docker.internal \
    -e DB_USERNAME=postgres \
    -e DB_PASSWORD=postgres \
    -e DB_NAME=eniqlo-store natserract/enigmanations-inventory

API:

Releases

No releases published

Packages

No packages published

Languages

  • Go 97.0%
  • Makefile 1.5%
  • Other 1.5%