forked from mathematicalthinking/vmt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
59 lines (56 loc) · 1.71 KB
/
deploy.sh
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
echo -e "\e[1;33m Making a $1 build"
echo -e "\e[1;30m"
if [ -d "./client/build" ]; then
rm -rf ./client/build
fi
if [ -d "./client/encompassBuild" ]; then
rm -rf ./client/encompassBuild
fi
cd ./server
npm run build-$1
npm run build-enc-$1
cd ..
if [ -d "./$1" ]; then
rm -rf ./$1
fi
mkdir ./$1
cd ./$1
mkdir vmt
cd vmt
mkdir ./server
cd ../..
echo "made $1 directory"
cd ./server
cp -r ./bin ./config ./constants ./controllers ./db_migration ./middleware ./models ./routes ./services ../$1/vmt/server
echo "\e[1;33m server copied to $1"
cp app.js package.json package-lock.json socketInit.js sockets.js ../$1/vmt/server
# Now that we've moved to Docker, we use this script only when deploying to vmt-test (the test server)
cp .env_testServer ../$1/vmt/.env
echo "\e[1;33mfiles copied"
cd ../$1/vmt
mkdir client
mkdir client/build
mkdir client/encompassBuild
cp -r ../../client/build client/
cp -r ../../client/encompassBuild client/
cd ..
if [[ "$1" == "production" ]]
then
mv vmt current
zip -er VMT-$1.zip .
else
zip -r VMT-$1.zip .
fi
mv VMT-$1.zip ..
#echo -e "\e[1;33m Copying zipped directory...\e[0m"
# scp ./VMT-$1.zip "$1"@mathematicalthinking.org:/tmp/
# echo -e "\e[1;31m You're not done yet!\e[0m"
# echo -e "\e[1;35m run the following commands to complete the demployment proces"
# echo -e "\e[1;34m $ \e[0m ssh $1@mathematicalthinking"
# echo -e "\e[1;34m $ \e[0m cd /web/mathematicalthinking/vmt"
# echo -e "\e[1;34m $ \e[0m rm -rf staging && mkdir staging && cd staging"
# echo -e "\e[1;34m $ \e[0m mv /tmp/VMT-$1.zip ."
# echo -e "\e[1;34m $ \e[0m unzip VMT-$1.zip"
# echo -e "\e[1;34m $ \e[0m cd ./server && npm install --only=production"
# echo -e "\e[1;34m $ \e[0m systemctl restart vmt-$1"