Skip to content

Instantly share code, notes, and snippets.

@MarceloHoffmeister
Created April 3, 2020 17:51
Show Gist options
  • Save MarceloHoffmeister/cbb4d9e4e38dfac9695ea8de546b8d0b to your computer and use it in GitHub Desktop.
Save MarceloHoffmeister/cbb4d9e4e38dfac9695ea8de546b8d0b to your computer and use it in GitHub Desktop.
Script para clone de repositório do GitHub e configuração do servidor
#!/bin/bash
#################################
# #
# Configs #
# #
#################################
DEV_NAME=
GITHUB_USERNAME=
GITHUB_PASSWORD=
ROOT_PATH=/var/www/html
#################################
#################################
#################################
#################################
# Clear all HTML contents
sudo rm -rf $ROOT_PATH/{,.[!.],..?}*
# Seta as configurações do git
git config --global credential.helper cache
cd $ROOT_PATH && \
git clone https://$GITHUB_USERNAME:[email protected]/USUARIO-GIT/repo-git.git && \
git clone https://$GITHUB_USERNAME:[email protected]/USUARIO-GIT/repo-git.git alias-name
# Cria os arquivos .env
echo "APP_ENV=dev
DB_HOST=
DB_USERNAME=
DB_PASSWORD=
CIELO_MERCHANT_ID=
CIELO_MERCHANT_KEY=
BB_URL_OAUTH=
BB_URL_WSDL=
BB_CLIENT_ID=
BB_SECRET_KEY=
URL_SISTEMA=https://$DEV_NAME.homologbitis.com.br/
" > $ROOT_PATH/.env
echo "APP_ENV=dev
APP_DEBUG=true
APP_KEY=
APP_TIMEZONE=America/Sao_Paulo
URL_SISTEMA=https://$DEV_NAME.homologbitis.com.br/
CACHE_DRIVER=file
QUEUE_DRIVER=sync
DB_HOST=
DB_USERNAME=
DB_PASSWORD=
" > $ROOT_PATH/services/fiscal/.env
echo "APP_ENV=dev
APP_DEBUG=true
APP_KEY=
APP_TIMEZONE=America/Sao_Paulo
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=sa-east-1
AWS_BUCKET=homolog.objetos.clientes-bitis
AWS_ACCESS_KEY_ID_LOG=
AWS_SECRET_ACCESS_KEY_LOG=
AWS_DEFAULT_REGION_LOG=
AWS_BUCKET_LOG=
CACHE_DRIVER=file
QUEUE_DRIVER=sync
" > $ROOT_PATH/services/upload/.env
echo "APP_ENV=dev
APP_DEBUG=true
APP_KEY=
APP_TIMEZONE=America/Sao_Paulo
URL_SISTEMA=https://$DEV_NAME.homologbitis.com.br/
CACHE_DRIVER=file
QUEUE_DRIVER=sync
" > $ROOT_PATH/services/mdfe/.env
echo "APP_ENV=dev
APP_DEBUG=false
APP_KEY=
APP_TIMEZONE=America/Sao_Paulo
CACHE_DRIVER=file
QUEUE_DRIVER=sync
MAIL_DRIVER=smtp
MAIL_HOST=email-smtp.us-east-1.amazonaws.com
[email protected]
MAIL_FROM_NAME=\"Inteligencia Bitis\"
MAIL_USERNAME=
MAIL_PASSWORD=
" > $ROOT_PATH/services/mail/.env
# Define as permissões de pastas
chmod -R 777 $ROOT_PATH && chown -R ubuntu:ubuntu $ROOT_PATH
find $ROOT_PATH -type f -iname "*.sh" -exec chmod +x {} \;
# Instala dependências
find $ROOT_PATH -iname '*after-deploy.sh' -printf 'cd %h; ./%f\0' | xargs -L1 -0 -P0 bash -c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment