Last active
September 14, 2017 15:31
-
-
Save fabricioflores/1a40d2a29341256bf2feec1932a4da68 to your computer and use it in GitHub Desktop.
Fabric Angular2 - Nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto | |
import urllib2 | |
from fabric.api import env, run, cd, sudo, local, parallel | |
from fabric.operations import prompt, put | |
from fabric.contrib.project import rsync_project | |
import os | |
import sys | |
env.user = "server_user" | |
env.hosts = ["remotehost.com"] | |
env.key_filename = ["~/.ssh/fabriciofloreskey.pem"] | |
@parallel | |
def reload_nginx(): | |
sudo('service nginx reload') | |
@parallel | |
def start_nginx(): | |
sudo('service nginx start') | |
@parallel | |
def stop_nginx(): | |
sudo('service nginx stop') | |
@parallel | |
def deploy_frontend(): | |
local('cd ui && ng build --prod') | |
rsync_project(local_dir='ui/dist', remote_dir='~/remote-dir') | |
reload_nginx() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment