Advertisement
Guest User

Untitled

a guest
Aug 9th, 2017
547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.23 KB | None | 0 0
  1. #!/bin/bash -e
  2.  
  3. # This file will perform initalization of raw dev working environment with latest images.
  4.  
  5. function check() {
  6. if [ -z "$(command -v 'docker')" ]; then
  7. echo "docker is not installed"
  8. exit 1
  9. fi
  10. }
  11.  
  12. function main() {
  13. check
  14.  
  15. me=$(whoami)
  16. echo ">> Setting endpoints to use your username \"$me\""
  17. sed -i "s~xxxxx~${me}~g" docker-compose.yml
  18. echo "<< Done"
  19.  
  20. echo ">> Create dev.env"
  21. cat > dev.env <<EOL
  22. DEVENV=docker_local
  23. DEV=docker_local
  24. EOL
  25. echo "<< Done"
  26.  
  27. echo ">> Cloning all necessary repositories"
  28. git clone -q ssh://git@bitbucket.transactpro.lv:7999/gw3/uriel-go.git &
  29. git clone -q ssh://git@bitbucket.transactpro.lv:7999/gw3/raziel-go.git &
  30. git clone -q -b dev ssh://git@bitbucket.transactpro.lv:7999/gw3/tpro-gw3-integration.git integration &
  31. git clone -q -b dev ssh://git@bitbucket.transactpro.lv:7999/gw3/hsm-emulation.git &
  32. git clone -q -b dev ssh://git@bitbucket.transactpro.lv:7999/gw3/peliel.git &
  33. git clone -q ssh://git@bitbucket.transactpro.lv:7999/gw3/kerubiel.git &
  34. git clone -q ssh://git@bitbucket.transactpro.lv:7999/gw3/third-party-templates.git static &
  35. git clone -q -b dev ssh://git@bitbucket.transactpro.lv:7999/gw3/workers.git &
  36. git clone -q -b dev ssh://git@bitbucket.transactpro.lv:7999/gw3/prototype-frontend.git frontend &
  37. git clone -q -b dev ssh://git@bitbucket.transactpro.lv:7999/aut/docker.git &
  38. wait
  39. echo "<< Done"
  40.  
  41. echo ">> Create storage directory and set permittions"
  42. mkdir -p storage/templates
  43. chmod -R 777 storage
  44. echo "<< Done"
  45.  
  46. echo ">> Installing composer dependencies in needed projects"
  47. ( cd integration; composer install -q --no-dev; ) &
  48. ( cd hsm-emulation; composer install -q --no-dev; ) &
  49. ( cd workers; composer install -q --no-dev; ) &
  50. ( cd frontend; composer install -q --no-dev; ) &
  51. wait
  52. echo "<< Done"
  53.  
  54. echo ">> Configure kerubiel config file"
  55. cdir=$(pwd)
  56. ndir=${PWD##*/} # https://stackoverflow.com/a/1371283
  57. (
  58. cd kerubiel
  59. cp containers.example.json containers.json
  60.  
  61. sed -i "s~registry.transactpro.it/gw3/phpfpm:latest~registry.transactpro.it/gw3-prod/php:7.0.14~g" containers.json
  62. sed -i "s~/opt/gw3~${cdir}~g" containers.json
  63. sed -i "s~gw3_default~${ndir}_default~g" containers.json
  64. )
  65. echo "<< Done"
  66.  
  67. echo ">> Download GeoLite2-City.mmdb file"
  68. wget http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz
  69. tar -xvf GeoLite2-City.tar.gz
  70. rm -f GeoLite2-City.tar.gz
  71.  
  72. mv GeoLite2-City_*/GeoLite2-City.mmdb .
  73. rm -rf GeoLite2-City_*
  74. echo "<< Done"
  75.  
  76. echo ">> Configure frontend"
  77. (
  78. cd frontend
  79.  
  80. cat > wl-conf.local.json <<EOL
  81. {
  82. "tpro": {
  83. "whitelabel_id": 1,
  84. "title": "Transact Pro",
  85. "domain": "frontend.${me}.fpngw3.env",
  86. "tagline": "Turnkey Direct Financial E-Commerce Solutions. Since 2004."
  87. }
  88. }
  89. EOL
  90.  
  91. npm install
  92. node ./node_modules/.bin/bower install
  93. ./build.styles local
  94.  
  95. docker run --rm \
  96. -v $(pwd):/app \
  97. -w /app \
  98. registry.transactpro.it/gw3-prod/php:7.0.14 chmod -R 777 cache
  99. )
  100.  
  101. echo "And it seems, that you are ready to rock!"
  102. echo "Run: docker-compose up -d"
  103. echo "And see the magic. Happy coding!"
  104. }
  105.  
  106. main "$@"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement