From 721b4ca96b324059b4727be1d4e2a2a6583e6748 Mon Sep 17 00:00:00 2001 From: Hunter Long Date: Thu, 27 Sep 2018 21:02:07 -0700 Subject: [PATCH] fix for missing ENV --- Makefile | 2 +- cmd/main.go | 2 +- core/configs.go | 2 +- dev/aws/ec2-compose.yml | 86 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 dev/aws/ec2-compose.yml diff --git a/Makefile b/Makefile index fb323894..a0fbaa91 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION=0.68 +VERSION=0.69 BINARY_NAME=statup GOPATH:=$(GOPATH) GOCMD=go diff --git a/cmd/main.go b/cmd/main.go index 85f019ee..959258d2 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -59,7 +59,6 @@ func main() { source.Assets() utils.InitLogs() args := flag.Args() - defer core.CloseDB() if len(args) >= 1 { err := CatchCLI(args) @@ -79,6 +78,7 @@ func main() { fmt.Println(handlers.RunHTTPServer(ipAddress, port)) os.Exit(1) } + defer core.CloseDB() mainProcess() } diff --git a/core/configs.go b/core/configs.go index e7eb87cc..78359135 100644 --- a/core/configs.go +++ b/core/configs.go @@ -70,7 +70,7 @@ func LoadUsingEnv() (*DbConfig, error) { Configs.DbHost = os.Getenv("DB_HOST") Configs.DbPort = int(utils.StringInt(os.Getenv("DB_PORT"))) Configs.DbUser = os.Getenv("DB_USER") - Configs.Password = os.Getenv("DB_PASS") + Configs.DbPass = os.Getenv("DB_PASS") Configs.DbData = os.Getenv("DB_DATABASE") CoreApp.DbConnection = os.Getenv("DB_CONN") CoreApp.Name = os.Getenv("NAME") diff --git a/dev/aws/ec2-compose.yml b/dev/aws/ec2-compose.yml new file mode 100644 index 00000000..115c25a0 --- /dev/null +++ b/dev/aws/ec2-compose.yml @@ -0,0 +1,86 @@ +version: '2.3' + +services: + + statup: + container_name: statup + image: hunterlong/statup:latest + restart: always + networks: + - internet + - database + depends_on: + - postgres + volumes: + - ./statup:/app + environment: + VIRTUAL_HOST: localhost + VIRTUAL_PORT: 8080 + LETSENCRYPT_HOST: ${LETSENCRYPT_HOST} + LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL} + DB_CONN: postgres + DB_HOST: postgres + DB_USER: statup + DB_PASS: password123 + DB_DATABASE: statup + NAME: EC2 Example + DESCRIPTION: This is a Statup Docker Compose instance + + nginx: + container_name: nginx + image: jwilder/nginx-proxy + ports: + - 0.0.0.0:80:80 + - 0.0.0.0:443:443 + networks: + - internet + restart: always + labels: + - "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy" + volumes: + - /var/run/docker.sock:/tmp/docker.sock:ro + - ./nginx/certs:/etc/nginx/certs:ro + - ./nginx/vhost:/etc/nginx/vhost.d + - ./nginx/html:/usr/share/nginx/html:ro + - ./nginx/dhparam:/etc/nginx/dhparam + environment: + DEFAULT_HOST: localhost + + postgres: + container_name: postgres + image: postgres + restart: always + networks: + - database + volumes: + - ./postgres:/var/lib/postgresql/data + environment: + POSTGRES_PASSWORD: password123 + POSTGRES_USER: statup + POSTGRES_DB: statup + + letsencrypt: + container_name: letsencrypt + image: jrcs/letsencrypt-nginx-proxy-companion + networks: + - internet + restart: always + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + - ./nginx/certs:/etc/nginx/certs + - ./nginx/vhost:/etc/nginx/vhost.d + - ./nginx/html:/usr/share/nginx/html + - ./nginx/dhparam:/etc/nginx/dhparam + + watchtower: + image: v2tec/watchtower + restart: always + volumes: + - /var/run/docker.sock:/var/run/docker.sock + command: --interval 120 --cleanup + +networks: + internet: + driver: bridge + database: + driver: bridge