Skip to content

Instantly share code, notes, and snippets.

@tranphuoctien
Created October 31, 2018 07:02
Show Gist options
  • Save tranphuoctien/ed49c5518582ac81349818186777cc96 to your computer and use it in GitHub Desktop.
Save tranphuoctien/ed49c5518582ac81349818186777cc96 to your computer and use it in GitHub Desktop.
Restaff setup dev docker compose
#!/bin/bash
shopt -s extglob
echo -n "Username: ";
read username;
#echo -n "Password: ";
#Disabling echo, so that password will not be visible on screen
#read -s password
#Enabling echo
echo "";
echo -n "Location deploy in: ";
read location;
mkdir -p "$location";
cd "$location";
#All link repositories
declare -A repos
## Change your link gitlab to git clone
repos=(
["brazn-php"]="gitlab.com/tranphuoctien/brazncore-clients.git"
["brazn-service"]="gitlab.com/tranphuoctien/brazncore-services.git"
)
echo "Getting latest for" ${#repos[@]} "repositories using git clone"
for repo in " ${!repos[@]}"
do
repo="${repo##*( )}"
echo ""
echo "****** Getting latest for" ${repos[$repo]} "******"
git clone "https://$username@${repos[$repo]}" "$repo"
cd "$repo"
if [ $repo = "brazn-php" ]
then
git checkout "loxley"
mv docker-build/.env.ini ../.env
else
git checkout "loxley-tranphuoctien"
cp config/conf.stag.js config/conf.js
fi
echo "******************************************"
cd "../"
done
echo "Downloading docker compose file"
curl -LO https://gist.githubusercontent.com/tranphuoctien/063b79d21518a0db74355b0448fceeec/raw/6bcd1a62552c018e184a69881a44ea7fbeba33b0/docker-compose.yml
curl -LO https://gist.githubusercontent.com/tranphuoctien/6898814e3b04772899a8372d06ab2c7a/raw/fb0575acc568b8ea28583b0c9c0d92b17dc0e70a/dev.docker-compose.yml
echo ""
echo "Download app,web,database,node service dockerfile"
# Download web dockerfile
curl -LO https://gist.githubusercontent.com/tranphuoctien/11eae5bff746c7ebacf461e608a3fb41/raw/383d54e042cd0096fe314051f20674a19f243f0c/prod.web.dockerfile
# Download app dockerfile
curl -LO https://gist.githubusercontent.com/tranphuoctien/de051bb2b2fc68043882d24a171882c6/raw/7a829e282fd4bf42ea344a36bd6ea63e2a6deb9c/prod.app.dockerfile
# Download database dockerfile
curl -LO https://gist.githubusercontent.com/tranphuoctien/a708787b991039f2e5c2b62708741a46/raw/901f6e4edb29b07366c4ab4cc1431eb0879ee155/prod.database.dockerfile
echo "Downloading docker compose run images"
curl -LO https://gist.githubusercontent.com/tranphuoctien/6ae0ccbdfa3affff532fcda150d1ccd5/raw/47f457b06cd3315ab5fad03fb00c5bc400037194/linux_deploy && chomd +x linux_deploy
echo "Load file conf"
mkdir -p conf/web
cd conf/web
curl -LO https://gist.githubusercontent.com/tranphuoctien/1d6c883d8e203237cc9457a0f787f7b2/raw/3c415030845f2050b38a0ea667ada62fc5e306db/vhost.conf
cp vhost.conf prod.vhost.conf
cd ../
curl -LO https://gist.githubusercontent.com/tranphuoctien/590c933b9cb958a2083934ae6862dd3b/raw/44b1c984b70db659ea890c7503026490eaf710ea/.env
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment