sample apps docker with postgres-node.js-golang

Overview

Belajar Docker untuk Pemula - Membuat TODO App

TODO app ini adalah contoh app untuk mendemokan proses membuat aplikasi dengan Docker, terdiri dari:

Semua komponen dipackage dengan docker

Menjalankan Postgres dengan Docker

Dari Video ke-8

Step 1: Jalankan Postgres

docker run -p 5432:5432 --name todo-postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=rahasia -e POSTGRES_DB=belajar -v $(pwd)/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql -d postgres

Step 2: Export konfigurasi database sebagai environment variabel

export DB_HOST=localhost
export DB_PORT=5432
export DB_USER=postgres
export DB_PASSWORD=rahasia
export DB_DATABASE=belajar

Step 3: Jalankan Backend Golang app di lokal komputer

go run backend/main.go

Step 4: Jalankan Frontend JS app di lokal komputer

cd frontend
yarn install
yarn serve

Step 5: Buka browser untuk mulai mengakses app TODO

http://localhost:8081

Step 6: Cek input TODO tersimpan di database

docker exec -it todo-postgres psql -U postgres -W belajar
SELECT * FROM todo;

Menjalankan Semuanya sebagai Docker Container

Dari Video ke-9 dan ke-10

Step 1: Buat Docker Network

docker network create todo

Step 2: Jalankan Docker postgres di dalam network

docker run -d \
-p 5432:5432 \
--name todo-postgres \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=rahasia \
-e POSTGRES_DB=belajar \
-v $(pwd)/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql \
--network todo \
postgres

Step 3: Buat docker image untuk backend

cd backend
docker build -t todo-backend:v1 .

Step 4: Jalankan backend sebagai docker container di dalam network

docker run -d \
-p 8080:8080 \
--name todo-backend \
-e DB_USER=postgres \
-e DB_PASSWORD=rahasia \
-e DB_HOST=todo-postgres \
-e DB_PORT=5432 \
-e DB_DATABASE=belajar \
--network todo \
todo-backend:v1

Step 5: Buat docker image untuk frontend

cd frontend
docker build -t todo-frontend:v1 .

Step 6: Jalankan frontend sebagai docker container

docker run -d \
-p 8081:8080 \
--name todo-frontend \
--network todo \
todo-frontend:v1
You might also like...
Docker-hub-rate-limit - Show pulling rate status of Docker-hub

Docker-Hub Pull Rate Status This tool shows current status of docker hub pull ra

Dotnet-appsettings-env - Convert .NET appsettings.json file to Kubernetes, Docker and Docker-Compose environment variables

dotnet-appsettings-env Convert .NET appsettings.json file to Kubernetes, Docker

Dotnet-appsettings-env - Convert .NET appsettings.json file to Kubernetes, Docker and Docker-Compose environment variables

dotnet-appsettings-env Convert .NET appsettings.json file to Kubernetes, Docker

PolarDB Stack is a DBaaS implementation for PolarDB-for-Postgres, as an operator creates and manages PolarDB/PostgreSQL clusters running in Kubernetes. It provides re-construct, failover swtich-over, scale up/out, high-available capabilities for each clusters.
PolarDB Stack is a DBaaS implementation for PolarDB-for-Postgres, as an operator creates and manages PolarDB/PostgreSQL clusters running in Kubernetes. It provides re-construct, failover swtich-over, scale up/out, high-available capabilities for each clusters.

PolarDB Stack开源版生命周期 1 系统概述 PolarDB是阿里云自研的云原生关系型数据库,采用了基于Shared-Storage的存储计算分离架构。数据库由传统的Share-Nothing,转变成了Shared-Storage架构。由原来的N份计算+N份存储,转变成了N份计算+1份存储

A simple operator to interact with a Postgres database.

Built following this blog. Kubebuilder commands use to set up the project mkdir second-operator cd second-operator kubebuilder init --domain arshsharm

Combine ent and gRPC, using Postgres as DBMS

database-system Combine ent and gRPC, using Postgres as DBMS How to develop Install tools brew install protobuf go mod tidy go install google.golang

Pg algorand - A Postgres DB extension with Algorand's utility functions

AlgoRand Postgres extension by AlgoNode About pg_algorand A set of utility funct

Official Golang implementation of the Thinkium node

Go Thinkium Official Golang implementation of the Thinkium node. Building the source mkdir build docker run --rm -w /go/src/github.com/ThinkiumGroup/g

dashd-go is an alternative full node dash implementation written in Go (golang)

dashd-go is an alternative full node dash implementation written in Go (golang)

Owner
null
Go-http-server-docker - Simple sample server using docker and go

go-http-server-docker Simple sample webserver using docker and go.

null 0 Jan 8, 2022
Sensu-go-postgres-metrics - The sensu-go-postgres-metrics is a sensu check that collects PostgreSQL metrics

sensu-go-postgres-metrics Table of Contents Overview Known issues Usage examples

Scott Cupit 0 Jan 12, 2022
Golang-for-node-devs - Golang for Node.js developers

Golang for Node.js developers Who is this video for? Familiar with Node.js and i

TomDoesTech 5 Sep 27, 2022
network-node-manager is a kubernetes controller that controls the network configuration of a node to resolve network issues of kubernetes.

Network Node Manager network-node-manager is a kubernetes controller that controls the network configuration of a node to resolve network issues of ku

kakao 98 Sep 22, 2022
Sample multi docker compose environment setup

Instructions This is a demonstration of a Multi Docker Compose. The purpose of this repositoy is ongoing research on "Docker compose" architecture des

Damjan Dimitrioski 3 May 3, 2021
Explore Docker registries and manipulate Docker images!

L/S tags Utility and API to manipulate (analyze, synchronize and aggregate) images across different Docker registries. Example invocation $ lstags alp

Ivan Ilves 293 Sep 12, 2022
Docker-based remote code runner / 基于 Docker 的远程代码运行器

Docker-based remote code runner / 基于 Docker 的远程代码运行器

E99p1ant 36 Sep 13, 2022
ecsk is a CLI tool to interactively use frequently used functions of docker command in Amazon ECS. (docker run, exec, cp, logs, stop)

English / 日本語 ecsk ECS + Task = ecsk ?? ecsk is a CLI tool to interactively use frequently used functions of docker command in Amazon ECS. (docker run

null 107 Aug 31, 2022
Hassle-free minimal CI/CD for git repositories with docker or docker-compose projects.

GIT-PIPE Hassle-free minimal CI/CD for git repos for docker-based projects. Features: zero configuration for repos by default automatic encrypted back

Aleksandr Baryshnikov 50 Sep 23, 2022
Tool to convert docker-compose files to set of simple docker commands

docker-decompose Tool to convert docker-compose files to set of simple docker commands. Install Use go get to install the latest version of the librar

Liri S 2 Apr 12, 2022