In iTerm2, in the menu bar go to Scripts > Manage > New Python Script
Select Basic. Select Long-Running Daemon
Give the script a decent name (I chose auto_dark_mode.py
)
Save and open the script in your editor of choice.
# 1- (server) create a git repository on server side | |
git init --bare ~/<projec-name> | |
# 2- (server) into the directory: '~/<project-name>/hooks/' create a file: 'post-receive' and add this: | |
!/bin/bash | |
while read oldrev newrev ref | |
do | |
if [[ $ref =~ .*/master$ ]]; | |
then | |
echo "== GIT HOOKS : Master ref received. Deploying master branch to production... ==" | |
git --work-tree=~/<dir-name>/<dir-name>/ checkout -f master |
echo "== CREATE DOCKER MICROSERVICES INFRAESTRUCTURE ==" | |
echo "==== creating hub network ===="; | |
sudo docker network create autocom-services-hub-network --subnet=172.1.1.0/24 | |
sleep 5; | |
wait | |
echo "==== creating reverse proxy ===="; | |
sudo docker run --name ms-nginx-reverse-proxy-server -d --ip 172.1.1.2 --net autocom-services-hub-network -p 80:80 -v /home/lalo/Docker/AutocomServices/ms-nginx-reverse-proxy-server:/shared --hostname ms-nginx-reverse-proxy-server -i centos:7 | |
sleep 5; | |
wait | |
echo "==== creating api gateway ===="; |
# Python | |
$sudo yum install centos-release-scl | |
$sudo yum install rh-python36 | |
$scl enable rh-python36 bash | |
$python --version | |
$pip | |
# NodeJS - NVM | |
$curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash | |
$nvm --version # list all versions |
# ~/.bash_profile | |
[[ -s ~/.bashrc ]] && source ~/.bashrc | |
export CLICOLOR=1 | |
export LSCOLORS=GxFxCxDxBxegedabagaced | |
function prompt { | |
local BLACK="\[\033[0;30m\]" | |
local BLACKBOLD="\[\033[1;30m\]" |
#### start nginx config | |
worker_processes 1; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; |