Compare commits
7 Commits
docs/mypla
...
01c5241d8f
| Author | SHA1 | Date | |
|---|---|---|---|
| 01c5241d8f | |||
| bdd97be8dd | |||
| f2b383ee19 | |||
| 93c3dcbb6d | |||
| ada5c6b876 | |||
| 18222d510a | |||
| a5558aa494 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -21,3 +21,4 @@
|
||||
# Go workspace file
|
||||
go.work
|
||||
|
||||
config/private
|
||||
0
config/private
Normal file
0
config/private
Normal file
14
config/public
Normal file
14
config/public
Normal file
@@ -0,0 +1,14 @@
|
||||
# Database Config
|
||||
## Database Port
|
||||
DB_PORT="3306"
|
||||
## Database User
|
||||
DB_USER="dbuser"
|
||||
## Database Port
|
||||
DB_PORT="testdb"
|
||||
## Database name
|
||||
DB_NAME="testdb"
|
||||
|
||||
# Port Mapping
|
||||
FRONTEND_PORT="30381"
|
||||
BACKEND_PORT="30382"
|
||||
HAPROXY_PORT="80"
|
||||
5
haproxy/HAPROXY.md
Normal file
5
haproxy/HAPROXY.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# HAPROXY
|
||||
The Haproxy is used to route the requests to the diffrent backends & location
|
||||
--> Only for local deployment
|
||||
--> On kubernetes you can use an ingress for this
|
||||
|
||||
26
haproxy/config/haproxy.cfg
Normal file
26
haproxy/config/haproxy.cfg
Normal file
@@ -0,0 +1,26 @@
|
||||
global
|
||||
stats socket /var/run/api.sock user haproxy group haproxy mode 660 level admin expose-fd listeners
|
||||
log stdout format raw local0 info
|
||||
|
||||
defaults
|
||||
mode http
|
||||
timeout client 10s
|
||||
timeout connect 5s
|
||||
timeout server 10s
|
||||
timeout http-request 10s
|
||||
log global
|
||||
|
||||
frontend stats
|
||||
bind *:8404
|
||||
stats enable
|
||||
stats uri /
|
||||
stats refresh 10s
|
||||
|
||||
frontend myfrontend
|
||||
bind :80
|
||||
default_backend webservers
|
||||
|
||||
backend webservers
|
||||
server s1 web1:8080 check
|
||||
server s2 web2:8080 check
|
||||
server s3 web3:8080 check
|
||||
8
haproxy/haproxy-compose.yaml
Normal file
8
haproxy/haproxy-compose.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
version: 3
|
||||
services:
|
||||
haproxy:
|
||||
image: haproxy:alpine
|
||||
ports:
|
||||
- "80:80"
|
||||
voluems:
|
||||
- ./config/haproxy.cfg:/usr/local/etc/haproxy:ro
|
||||
14
haproxy/reconfigure-haproxy.sh
Executable file
14
haproxy/reconfigure-haproxy.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Variables
|
||||
|
||||
# Funcitons
|
||||
function loadconfig {
|
||||
source config/public
|
||||
source config/private
|
||||
}
|
||||
|
||||
# Main Script
|
||||
loadconfig
|
||||
|
||||
echo $BACKEND_PORT
|
||||
62
makefile
Normal file
62
makefile
Normal file
@@ -0,0 +1,62 @@
|
||||
all: database backend frontend
|
||||
|
||||
# Database
|
||||
database: database-stop database-clean databgase-start database-init
|
||||
|
||||
database-stop:
|
||||
|
||||
database-start:
|
||||
|
||||
database-restart: database-stop database-start
|
||||
|
||||
database-clean:
|
||||
|
||||
database-init:
|
||||
|
||||
# Backend
|
||||
backend:
|
||||
|
||||
backend-restart:
|
||||
|
||||
backend-rebuild:
|
||||
|
||||
backend-image-push:
|
||||
|
||||
# Frontend
|
||||
|
||||
frontend:
|
||||
|
||||
frontend-stop:
|
||||
|
||||
frontend-start:
|
||||
|
||||
frontend-restart: frontend-stop frontend-start
|
||||
|
||||
frontend-clean:
|
||||
|
||||
frontend-rebuild:
|
||||
|
||||
frontend-image-push:
|
||||
|
||||
# Haproxy - Only used for local
|
||||
|
||||
haproxy:
|
||||
|
||||
haproxy-stop:
|
||||
|
||||
haproxy-start:
|
||||
|
||||
haproxy-restart: haproxy-stop haproxy-start
|
||||
|
||||
# Config Templating - Only used for local
|
||||
|
||||
reconfigure: reconfigure-database reconfigure-backend reconfigure-frontend
|
||||
|
||||
reconfigure-database:
|
||||
|
||||
reconfigure-backend:
|
||||
|
||||
reconfigure-frontend:
|
||||
|
||||
reconfigue-haproxy:
|
||||
./haproxy/reconfigure-haproxy.sh
|
||||
Reference in New Issue
Block a user