summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2021-11-25 18:31:43 -0500
committerDaniel Micay <danielmicay@gmail.com>2021-11-25 18:31:57 -0500
commit71c26f59eb12b1cdac95f5fb9f95be6ce1b28e18 (patch)
tree815e35bbfed1824b7ac630a211c42e0f22f8d58a
parentbbd8299148c3ab34db45a21f5f34894b0d49a56a (diff)
use a temporary directory for nginx configuration
-rw-r--r--.gitignore2
-rwxr-xr-xdeploy-static4
-rwxr-xr-xprocess-static6
3 files changed, 7 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 23a3af09..4bc4dc5b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-nginx.conf.tmp
+nginx-tmp
nginx.conf.root.tmp
node_modules
static-tmp
diff --git a/deploy-static b/deploy-static
index 84720168..b2b81955 100755
--- a/deploy-static
+++ b/deploy-static
@@ -33,10 +33,10 @@ for server in ${servers[@]}; do
ssh $remote ln -snf $target /srv/grapheneos.org
ssh $remote sync /srv/grapheneos.org
- cp nginx.conf.tmp nginx.conf.root.tmp
+ cp nginx-tmp/nginx.conf nginx.conf.root.tmp
sed -i "s|/srv/grapheneos.org|$target|" nginx.conf.root.tmp
rsync -rptcv --chmod=D755,F644 --delete nginx.conf.root.tmp $remote:/etc/nginx/nginx.conf
- rsync -rptcv --chmod=D755,F644 --delete nginx/snippets/ $remote:/etc/nginx/snippets
+ rsync -rptcv --chmod=D755,F644 --delete nginx-tmp/snippets/ $remote:/etc/nginx/snippets
ssh $remote 'sync /etc/nginx/nginx.conf /etc/nginx/snippets/*'
ssh $remote nginx -s reload
diff --git a/process-static b/process-static
index 22532ebf..e5956bdb 100755
--- a/process-static
+++ b/process-static
@@ -5,6 +5,9 @@ shopt -s dotglob extglob globstar
export PATH="$PWD/node_modules/.bin:$PATH"
+rm -rf nginx-tmp
+cp -a nginx nginx-tmp
+
rm -rf static-tmp
cp -a static static-tmp
rm -rf static-tmp/js/fastboot/{!(dist),dist/!(fastboot.min.mjs|fastboot.min.mjs.map|vendor)}
@@ -38,8 +41,7 @@ for file in static-tmp/**/*.css static-tmp/js/*.js static-tmp/mask-icon.svg; do
replace+=";s@{{path|/${file#*/}}}@/${dest#*/}@g"
done
-cp nginx/nginx.conf nginx.conf.tmp
-sed -i "$replace" static-tmp/**/*.html nginx.conf.tmp
+sed -i "$replace" static-tmp/**/*.html nginx-tmp/nginx.conf
xmllint --noout static-tmp/**/*.html
validatornu --Werror --also-check-css --also-check-svg static-tmp/**/!(bimi).@(css|html|svg)