-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Serhii Polishchuk
committed
Oct 18, 2021
1 parent
8a5a40f
commit 1f854ce
Showing
3 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
set -e | ||
set -o errexit | ||
|
||
rm -rf dist | ||
|
||
DOMAIN_PROD="theatre-shevchenko.ck.ua" | ||
DOMAIN_STAGING="staging.theatre.pp.ua" | ||
BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||
SSH_HOST="geekhub-www" | ||
|
||
#npm run lint | ||
#npm run lint-css | ||
#ng test --watch=false --browsers=ChromeHeadlessNoSandbox --code-coverage=true | ||
#ng e2e | ||
|
||
if [ "$BRANCH" = "master" ]; then DOMAIN=$DOMAIN_PROD; else DOMAIN="$DOMAIN_STAGING"; fi | ||
if [ "$BRANCH" = "master" ]; then ENV="production"; else ENV="staging"; fi | ||
|
||
./build-ssr.sh "$ENV" | ||
|
||
cp ./deploy/branch.conf ./dist/ | ||
cp ./deploy/index.html ./dist/ | ||
cd dist/ && tar -zcvf ../dist.tar.gz * && cd - | ||
|
||
scp dist.tar.gz $SSH_HOST:~/$DOMAIN.tar.gz | ||
ssh $SSH_HOST "rm -rf ~/$DOMAIN && mkdir ~/$DOMAIN" | ||
ssh $SSH_HOST "tar -xf ~/$DOMAIN.tar.gz -C ~/$DOMAIN" | ||
ssh $SSH_HOST "mkdir ~/$DOMAIN/dist && mv ~/$DOMAIN/theatre-front ~/$DOMAIN/dist" | ||
ssh $SSH_HOST "rm ~/$DOMAIN.tar.gz" | ||
|
||
echo "Deployed to $DOMAIN" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
export $(xargs < .env) | ||
|
||
if [ "$BRANCH" = "master" ]; then DOMAIN=$DOMAIN_PROD; else DOMAIN="$DOMAIN_STAGING/$BRANCH"; fi | ||
if [ "$BRANCH" = "master" ]; then ENV="production"; else ENV="staging"; fi | ||
if [ "$BRANCH" = "master" ]; then BASE_HREF="/"; else BASE_HREF="/$BRANCH/"; fi | ||
|
||
export $BRANCH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
server { | ||
listen 80; | ||
server_name {{domain}}; | ||
|
||
root /var/www/{{domain}}; | ||
|
||
error_log /var/log/nginx/{{domain}}_error.log; | ||
access_log /var/log/nginx/{{domain}}_access.log; | ||
|
||
location ~* \.(?:ico|css|js|gif|jpe?g|png|svg|woff|ttf|eot)$ { | ||
expires 365d; | ||
add_header Pragma public; | ||
add_header Cache-Control "public"; | ||
} | ||
|
||
location /uk/ { | ||
proxy_pass http://127.0.0.1:{{uk_port}}; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header Host $http_host; | ||
proxy_http_version 1.1; | ||
proxy_set_header X-NginX-Proxy true; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
proxy_cache_bypass $http_upgrade; | ||
proxy_redirect off; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
} | ||
|
||
location /en/ { | ||
proxy_pass http://127.0.0.1:{{en_port}}; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header Host $http_host; | ||
proxy_http_version 1.1; | ||
proxy_set_header X-NginX-Proxy true; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
proxy_cache_bypass $http_upgrade; | ||
proxy_redirect off; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
} | ||
} |