From fbb08b61f03803e54ba2a613347876dc6eb0817c Mon Sep 17 00:00:00 2001 From: sp Date: Sat, 14 Aug 2021 23:05:15 +1000 Subject: [PATCH] enable production config and debug config. allow debug to use any webroot. --- config.json | 2 +- deploy/config_production.json | 31 +++++++++++++++++++++++++++++++ deploy/deploy.sh | 6 +++++- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 deploy/config_production.json diff --git a/config.json b/config.json index b612a4c..abfdb80 100644 --- a/config.json +++ b/config.json @@ -7,7 +7,7 @@ "Debug": true, "Static": [ { - "Dir": "./html/", + "Dir": "/mnt/hgfs/workspace/2021-07-31-BiukopWeb", "StaticUrl": "/", "StripPrefix" : "/" }, diff --git a/deploy/config_production.json b/deploy/config_production.json new file mode 100644 index 0000000..b612a4c --- /dev/null +++ b/deploy/config_production.json @@ -0,0 +1,31 @@ +{ + "Host":"0.0.0.0", + "Port":"8080", + "DSN": "sp:sp@tcp(192.168.1.70:3306)/syd_credit?parseTime=true&loc=Australia%2FSydney&collation=utf8mb4_0900_ai_ci", + "TlsCert": "cert/fullchain.pem", + "TlsKey": "cert/privkey.pem", + "Debug": true, + "Static": [ + { + "Dir": "./html/", + "StaticUrl": "/", + "StripPrefix" : "/" + }, + { + "Dir": "./html/test/", + "StaticUrl": "/spa1/", + "StripPrefix" : "/spa1/" + }, + { + "Dir": "./html/test/", + "StaticUrl": "/spa2/", + "StripPrefix" : "/spa2/" + } + ], + "Session" : { + "Guest": true, + "Year": 10, + "Month": 1, + "Day": 1 + } +} \ No newline at end of file diff --git a/deploy/deploy.sh b/deploy/deploy.sh index cbce8ff..c0ed0a0 100755 --- a/deploy/deploy.sh +++ b/deploy/deploy.sh @@ -7,10 +7,14 @@ echo "create /tmp/goweb" mkdir -p /tmp/goweb echo "prepare golang project" rsync -a $PROJ_DIR /tmp/goweb/ -rm -rf /tmp/goweb/html/* +cp -f $PROJ_DIR/deploy/config_production.json /tmp/goweb/config.json +rm -rf /tmp/goweb/html/css +rm -rf /tmp/goweb/html/test +rm -rf /tmp/goweb/html/*.html echo "sync Web html" rsync -a /mnt/hgfs/workspace/2021-07-31-BiukopWeb/ /tmp/goweb/html/ + cd /tmp/goweb gcloud app deploy