diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..0a2ab674 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.idea +vendor +.env +dbdata diff --git a/README.md b/README.md index 6490de86..aaf128bb 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ -# PHP2021 \ No newline at end of file +# PHP2021 + +https://otus.ru/lessons/razrabotchik-php/?utm_source=github&utm_medium=free&utm_campaign=otus diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 00000000..dd2a5555 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +if [["$(docker service ls -q -f name=${2})"]] +then + echo 'update' + sudo composer update + docker service update \ + --env-add APP_ENV=prod -d --with-registry-auth \ + "${2}"; +else + echo 'create' + sudo mv ../settings/nginx.host.conf "/etc/nginx/sites/available/$1.conf" -f + sudo ln -s -f "/etc/nginx/sites/available/$1.conf" /etc/nginx/sites-enabled/otus.loc + sudo mv ../settinngs/.env .env + sudo composer install + docker service create \ + --env APP_ENV=prod -d --with-registry-auth \ + -p 5001:80 --replicas 3 \ + "${2}"; +fi \ No newline at end of file