Skip to content

Instantly share code, notes, and snippets.

@fabricioflores
Last active September 14, 2017 15:31
Show Gist options
  • Save fabricioflores/1a40d2a29341256bf2feec1932a4da68 to your computer and use it in GitHub Desktop.
Save fabricioflores/1a40d2a29341256bf2feec1932a4da68 to your computer and use it in GitHub Desktop.
Fabric Angular2 - Nginx
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