def setup(): deb.update_index() deb.upgrade() require.deb.packages([ "build-essential", "i3", "unzip", "xclip", "curl", "git", "sudo", "xdm", "iw", "network-manager", "firmware-atheros", "xfce4-terminal" ]) run('sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"' ) # NOQA run("touch private.sh") git_seed(dot_dir) git_reset(dot_dir) with cd(dot_dir): with settings(warn_only=True): run("cp home/.* ~") run("cp -R fonts/ ~/.fonts") run("fc-cache -rf") run("locales") run("brew install gcc ruby curl python3 neovim bash bash-completion@2 git pipenv tmux" ) # NOQA run("pip3 install pwdman hostscli neovim tmuxp") sudo("hostscli block_all") run("curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" ) # NOQA run('nvim -c "PlugInstall | q | q"')
def deploy(commit=None): if not commit: commit = local('git rev-parse HEAD', capture=True) env.repo_path = env.next_path + '/repo' git_seed(env.repo_path, commit) git_reset(env.repo_path, commit) run('kill $(cat %(pidfile)s) || true' % env) env.pidfile = env.pidfile.replace("\\", "/") env.virtualenv_path = env.virtualenv_path.replace("\\", "/") env.repo_path = env.repo_path.replace("\\", "/") env.nginx_conf = env.nginx_conf.replace("\\", "/") run('virtualenv %(virtualenv_path)s' % env) run('source %(virtualenv_path)s/bin/activate && pip install -r %(repo_path)s/requirements.txt' % env) with fabtools.python.virtualenv(env.virtualenv_path), cd(env.repo_path): run('python manage.py migrate') run('python manage.py collectstatic --noinput') put(StringIO('proxy_pass http://127.0.0.1:%(bluegreen_port)s/;' % env), env.nginx_conf) sudo('cd %(repo_path)s && PYTHONPATH=. BLUEGREEN=%(color)s %(virtualenv_path)s/bin/gunicorn -D -b 0.0.0.0:%(bluegreen_port)s -p %(pidfile)s blooby.wsgi:application' % env)
def git_push(commit): """ Push the current tree to the remote server and reset the remote git repository to the given commit. The commit can be any git object, be it a hash, a tag or a branch. """ gitric.git_seed(get_project_root(), commit) gitric.git_reset(get_project_root(), 'master')
def deploy(commit=None): if commit is None: commit = local('git rev-parse HEAD', capture=True) env.repo_path = env.next_path + '/repo' insert_public_key() # Done so that git push can operate without asking for password git_seed(env.repo_path, commit) git_reset(env.repo_path, commit) launch() remove_public_key() # Security reasons
def deploy(commit=None): if commit is None: commit = local('git rev-parse HEAD', capture=True) env.repo_path = env.next_path + '/repo' insert_public_key( ) # Done so that git push can operate without asking for password git_seed(env.repo_path, commit) git_reset(env.repo_path, commit) launch() remove_public_key() # Security reasons
def deploy(commit=None): '''an example deploy action''' repo_path = '/home/snaplabs.com/deploy/notewave' run("mkdir -p %s" % repo_path) # force_push() git_seed(repo_path, commit) # stop your service here git_reset(repo_path, commit) sudo("cp %s/conf/nginx_notewave.conf /etc/nginx/vhosts/" % repo_path) sudo("cp %s/conf/supervisor_notewave.conf /etc/supervisor.d/" % repo_path) sudo("supervisorctl restart notewave:*")
def deploy_data(commit=None): """ deploys data, in this case blog entries on the 'next' server """ require('local_data_repo_path') with lcd(env.local_data_repo_path): env.data_repo_path = pjoin(env.next_path, 'data') if not commit: commit = local('git rev-parse HEAD', capture=True) git_seed(env.data_repo_path, commit) git_reset(env.data_repo_path, commit) puts(green('Deployed data on the next server'))
def deploy(commit=None): if not commit: commit = local('git rev-parse HEAD', capture=True) env.repo_path = os.path.join(env.next_path, 'repo') git_seed(env.repo_path, commit, submodules=True) git_reset(env.repo_path, commit, submodules=True) run('kill $(cat %(pidfile)s) || true' % env) run('virtualenv %(virtualenv_path)s' % env) run('source %(virtualenv_path)s/bin/activate && ' 'pip install -r %(repo_path)s/bluegreen-example/requirements.txt' % env) put(StringIO('proxy_pass http://127.0.0.1:%(bluegreen_port)s/;' % env), env.nginx_conf) run('cd %(repo_path)s/bluegreen-example && PYTHONPATH=. ' 'BLUEGREEN=%(color)s %(virtualenv_path)s/bin/gunicorn -D ' '-b 0.0.0.0:%(bluegreen_port)s -p %(pidfile)s app:app' % env)
def deploy(commit=None): if not commit: commit = local('git rev-parse HEAD', capture=True) env.repo_path = os.path.join(env.next_path, 'repo') git_seed(env.repo_path, commit) git_reset(env.repo_path, commit) run('kill $(cat %(pidfile)s) || true' % env) run('virtualenv %(virtualenv_path)s' % env) run('source %(virtualenv_path)s/bin/activate && ' 'pip install -r %(repo_path)s/requirements.txt' % env) put(StringIO('proxy_pass http://127.0.0.1:%(bluegreen_port)s/;' % env), env.nginx_conf) run('cd %(repo_path)s && PYTHONPATH=. BLUEGREEN=%(color)s ' '%(virtualenv_path)s/bin/gunicorn -D ' '-b 0.0.0.0:%(bluegreen_port)s -p %(pidfile)s app:app' % env)
def deploy(): """ deploy the app to the server """ require("repo_path", "venv_path") commit = git_head_rev() # Run the test suite first ! test() # Update the new code git_seed(env.repo_path, commit=commit) # Activate the new code git_reset(env.repo_path, commit=commit) with cd(env.repo_path), virtualenv(env.venv_path): run("pip install -r requirements-prod.txt") restart()
def deploy_app(commit=None): if not commit: commit = local('git rev-parse HEAD', capture=True) env.repo_path = os.path.join(env.next_path, 'repo') git_seed(env.repo_path, commit) git_reset(env.repo_path, commit) run('kill $(cat %(pidfile)s) || true' % env) run('virtualenv %(virtualenv_path)s' % env) run('source %(virtualenv_path)s/bin/activate && ' 'pip install -r %(repo_path)s/app/requirements.txt' % env) put(StringIO('proxy_pass http://127.0.0.1:%(bluegreen_port)s/;' % env), env.nginx_conf) put(env.app_configuration, env.repo_path) run('cd %(repo_path)s/app && PYTHONPATH=. ' 'BLUEGREEN=%(color)s FLASK_BLOG_CONFIGURATION="../configuration.py" ' '%(virtualenv_path)s/bin/gunicorn -D ' '-b 0.0.0.0:%(bluegreen_port)s -p %(pidfile)s flask_blog:app' % env)
def deploy(commit=None): '''an example deploy action''' repo_path = '/home/test-deployer/test-repo' git_seed(repo_path, commit) # stop your service here git_reset(repo_path, commit)
def compiled_push_to_remote(): with local_compiled_git_directory(): git_reset(env.remote_target_directory, env.compiled_commit_hash)
def deploy(commit=None): """an example deploy action""" repo_path = "/home/test-deployer/test-repo" git_seed(repo_path, commit) # stop your service here git_reset(repo_path, commit)
def deploy_git(commit=None): ''' Deployment using git ''' repo_path = '/home/vagrant/deploy_git' git_seed(repo_path, commit) # stop your service here git_reset(repo_path, commit)