-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
update
32 lines (28 loc) · 1.2 KB
/
update
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# We build our code statically using nuxt generate. This means that we need to update it regularly, so that our explore pages
# stay fairly up to date. They don't need to be 100% up to the minute - the Browse page will be for logged in users.
npx patch-package
while true
do
if [ -f /tmp/iznik.build.abort ]
then
echo "Build disabled, sleeping"
sleep 30;
else
export NODE_OPTIONS=--max_old_space_size=8192;
export API=http://fdapilive.ilovefreegle.org/api
npm install --unsafe-perm
# Very occasionally the build seems to hang, so use timeout.
timeout -k 20 3600 npm run generate --fail-on-error
if [ $? -eq 0 ]; then
# Exclude index until we have copied over everything that it might invoke.
rsync --rsync-path="ionice -c 3 nice rsync" -au --exclude dist/index.html dist/ app4-internal:/var/www/iznik.fdnuxt.static.live/
rsync --rsync-path="ionice -c 3 nice rsync" -au --exclude dist/index.html dist/ app1-internal:/var/www/iznik.fdnuxt.static.live/
rsync -au dist/ app1-internal:/var/www/iznik.fdnuxt.static.live/
rsync -au dist/ app4-internal:/var/www/iznik.fdnuxt.static.live/
else
echo "Generate failed!"
fi
exit
fi
done