coinlog

package module
v0.0.0-...-984c388 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

README

🪙 Coinlog

Continuous Integration Go Report Card codebeat badge codecov Go Version

Coinlog is an assistant to keep track of your personal finance records.

How-To

Setup local environment

Coinlog is ready to deploy its infrastructure using Kubernetes (K8s) or docker compose. In this tutorial, K8s is preferred.

First, create namespace and select it:

kubectl apply -f deployments/global.yml
kubectl config set-context --current --namespace=coinlog
Apache Kafka deployment

Build the Apache Kafka docker image contained in kafka deployments folder.

docker build -t coinlog/kafka-kraft ./deployments/kafka

This image is ready to use Kafka 3.4.0 with KRaft consensus protocol (Apache Zookeeper-less).

Then, deploy the image:

kubectl apply -f deployments/kafka/kafka.yml

This will deploy 3 Kafka nodes available at coinlog-kafka.coinlog.svc.cluster.internal port 9092.

Postgres deployment

The Postgres deployment requires to manually create the database coinlog after its deployment. DO NOT deploy application if database was not created otherwise they will get stuck in CrashLoop state.

If kubegres operator not installed, please run the following command:

kubectl apply -f https://raw.githubusercontent.com/reactive-tech/kubegres/v1.16/kubegres.yaml

Reference here.

Then, perform the actual Postgres node deployments:

kubectl apply -f deployments/postgres/postgres.yml

This will deploy 1 master node and 2 replicas.

Get access to shell in Postgres master node (pod/coinlog-postgres-1-0):

kubectl exec -it pod/coinlog-postgres-1-0 -- /bin/sh

Then run (use root as postgres user password) to create database:

psql user=postgres
postgres=# CREATE DATABASE coinlog;
Backend Application deployment

First, build the docker image:

docker build -t coinlog/http-api:0.0.1 -f ./deployments/coinlog-http-api/Dockerfile .

NOTE: Use image tags to perform rolling updates for deployments. Every change will require to update the K8s YAML.

If nginx ingress controller not installed, please run the following command:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.5.1/deploy/static/provider/cloud/deploy.yaml

Reference here.

Then, perform the actual deployment:

kubectl apply -f deployments/coinlog-http-api/coinlog.yml

This will deploy 3 node stateless replicas.

If api.coinlog.info hostname was not set, run the command:

echo "127.0.0.1 api.coinlog.info" >> /etc/hosts

This will enable external traffic to nginx edge proxy.

Finally, export application nodes to cluster-external traffic:

kubectl port-forward services/coinlog-http-api-svc 8080:8080

Or just use nginx ingress (localhost:80 or api.coinlog.info).

More information about k8s nginx ingress controller here.

Frontend Web Application deployment

First, build the docker image:

docker build -t coinlog/web-client:0.0.1 -f ./deployments/coinlog-web-client/Dockerfile ./client/coinlog-web

NOTE: Use image tags to perform rolling updates for deployments. Every change will require to update the K8s YAML.

Then, perform the actual deployment:

kubectl apply -f deployments/coinlog-web-client/coinlog-web.yml

This will deploy 3 node stateless replicas.

If app.coinlog.info hostname was not set, run the command:

echo "127.0.0.1 api.coinlog.info" >> /etc/hosts

This will enable external traffic to nginx edge proxy.

Finally, export application nodes to cluster-external traffic:

kubectl port-forward services/coinlog-http-api-svc 8080:8080

Or just use nginx ingress (localhost:80 or api.coinlog.info).

More information about k8s nginx ingress controller here.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MajorVersion uint16
}

func NewConfig

func NewConfig() Config

Directories

Path Synopsis
cmd
ent
Package exception system-related errors.
Package exception system-related errors.
sql

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL