diff --git a/.gitignore b/.gitignore index 6b3af3fee63af0fc31478b6cc2a77fa61b1112b3..9ef16fc9283d727077870bf64eb396f014b6b5d4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ /vendor /node_modules /public/storage -Homestead.yaml Homestead.json .env diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 58a023de7d3a3f0780d741c17994694924508f5f..e8c9df2ce0bf590bc07cee31c80e046638716dbc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,7 @@ update: + only: + - tags + - triggers before_script: # Abhängigkeiten überprüfen - which virtualbox @@ -6,20 +9,10 @@ update: - which composer - which git - which php + script: # Pfad zum neu geklonten Repo - path=`pwd` - # Klone das Repo neu, falls es noch nicht existiert - - if [ ! -d ~/MetaGer ] ; then git clone "$path" ; fi - # Falls notwendig Laravel-Framework initialisieren: - - cd ~/MetaGer - - composer update - - tmp=$(chmod -R 777 storage/ bootstrap/cache) - - if [ ! -f .env ] ; then cp .env.example .env ; fi - - if [ $(grep "SomeRandomString" .env) ] ; then php artisan key:generate ; fi - # Falls notwendig Homestead Server intialisieren: - cd ~/ - script: + - $path/deploy/checkServerStatus.sh "$path" - cd ~/MetaGer - - git pull "$path" - only: - - master@gitlab.metager3.de:1234/ \ No newline at end of file + - git pull "$path" \ No newline at end of file diff --git a/deploy/Homestead.yaml b/deploy/Homestead.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c941040ae9dfdfeafa9c437f5553ce703c8a3b48 --- /dev/null +++ b/deploy/Homestead.yaml @@ -0,0 +1,34 @@ +--- +ip: "192.168.10.10" +memory: 2048 +cpus: 1 +provider: virtualbox + +authorize: ~/.ssh/id_rsa.pub + +keys: + - ~/.ssh/id_rsa + +folders: + - map: ~/MetaGer + to: /home/vagrant/MetaGer + +sites: + - map: 192.168.10.10 + to: /home/vagrant/MetaGer/public + +databases: + - homestead + +# blackfire: +# - id: foo +# token: bar +# client-id: foo +# client-token: bar + +# ports: +# - send: 50000 +# to: 5000 +# - send: 7777 +# to: 777 +# protocol: udp diff --git a/deploy/checkServerStatus.sh b/deploy/checkServerStatus.sh new file mode 100755 index 0000000000000000000000000000000000000000..04fc03e9005c6d01fe3d69cbd54404c729a501c6 --- /dev/null +++ b/deploy/checkServerStatus.sh @@ -0,0 +1,48 @@ +path="$1" +# Klone das Repo neu, falls es noch nicht existiert +if [ ! -d ~/MetaGer ] +then + cd ~/ + git clone "$path" + cd ~/MetaGer + composer update + chmod -R 777 storage/ bootstrap/cache +fi +# Falls notwendig Laravel-Framework initialisieren: + +if [ ! -f ~/MetaGer/.env ] +then + cd ~/MetaGer + cp .env.example .env +fi +if [ $(grep "SomeRandomString" ~/MetaGer/.env) ] +then + cd ~/MetaGer + php artisan key:generate +fi +# Falls notwendig Homestead Server intialisieren: +if [ ! -d ~/Homestead ] +then + cd ~/ + # Wir brauchen unseren öffentlichen ssh Schlüssel: + if [ ! -d .ssh ] + then + mkdir .ssh + chmod 700 .ssh + fi + if [ ! -f .ssh/id_rsa.pub ] + then + cd .ssh + ssh-keygen -t rsa -N "" -f id_rsa + cd ~/ + fi + vagrant box add --provider virtualbox laravel/homestead + git clone https://github.com/laravel/homestead.git Homestead + cd Homestead/ + bash init.sh + cd ~/ + cp -f "$path/deploy/Homestead.yaml" .homestead/ + cd Homestead/ + vagrant up + echo "Your server is now running under http://localhost:8000" +fi