-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy_dev
executable file
·27 lines (22 loc) · 1.13 KB
/
deploy_dev
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
# Copy script.py to both servers
echo "Deploying script.py"
cp -r scripts/ armagetron/syn_us_settings/pub/scripts/
cp -r scripts/ armagetron/syn_uk_settings/pub/scripts/
# util function to take a region and generate the env path
function get_env_path() {
echo "armagetron/syn_${1}_settings/pub/scripts/lib/load_env.py"
}
# Add env specific settings
echo "Deploying env specific settings"
# Use sed to find the REGION_ENV variable in with the util function and replace it with the correct value
sed -i "" "s|REGION_ENV = 'us'|REGION_ENV = 'us'|g" $(get_env_path us)
sed -i "" "s|REGION_ENV = 'uk'|REGION_ENV = 'uk'|g" $(get_env_path uk)
# Rename the script to script-out.py
mv armagetron/syn_us_settings/pub/scripts/script.py armagetron/syn_us_settings/pub/scripts/script-out.py
mv armagetron/syn_uk_settings/pub/scripts/script.py armagetron/syn_uk_settings/pub/scripts/script-out.py
# Make sure the script is executable
chmod +x armagetron/syn_us_settings/pub/scripts/script-out.py
chmod +x armagetron/syn_uk_settings/pub/scripts/script-out.py
# Restart docker
echo "Restarting servers"
docker-compose down && docker-compose --env-file .env up -d --build