Skip to content

Instantly share code, notes, and snippets.

@bygri
Last active November 1, 2016 23:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bygri/c74b097200907d582edb8685d0fa56c6 to your computer and use it in GitHub Desktop.
Save bygri/c74b097200907d582edb8685d0fa56c6 to your computer and use it in GitHub Desktop.
Vapor and Swift 3.0 on Ubuntu 16.04 LTS
from fabric.api import cd, env, execute, local, run, open_shell
env.hosts = []
env.development_path = '' # remote path to deploy to, and build from
env.packages = [] # list of packages to install, such as libmysqlclient-dev
def packages():
if len(env.packages):
run('sudo apt-get install '+' '.join(env.packages))
def deploy():
run('mkdir -p {0.development_path}'.format(env))
local('rsync -avz . -e ssh {0.host_string}:{0.development_path}'.format(env))
def build():
execute(deploy)
open_shell('cd {0.development_path} && vapor build; exit'.format(env))
def serve():
execute(deploy)
open_shell('cd {0.development_path} && vapor build && vapor run serve; exit'.format(env))
#!/usr/bin/env bash
# Install Swift and Vapor on a new Ubuntu 16.04 installation.
# http://dev.iachieved.it/iachievedit/swift-3-0-for-ubuntu-16-04-xenial-xerus/
wget -qO- http://dev.iachieved.it/iachievedit.gpg.key | sudo apt-key add -
echo "deb http://iachievedit-repos.s3.amazonaws.com/ xenial main" | sudo tee --append /etc/apt/sources.list
sudo apt-get update
sudo apt-get --yes install swift-3.0
echo "export PATH=/opt/swift/swift-3.0/usr/bin:\"\${PATH}\"" >> ~/.bashrc
source ~/.bashrc
# https://vapor.github.io/documentation/getting-started/install-toolbox.html
curl -sL toolbox.vapor.sh | bash
vapor --help
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment