This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
oliverdavies.uk-old-sculpin/fabfile.py

33 lines
842 B
Python
Raw Normal View History

2017-01-03 23:33:21 +00:00
from fabric.api import *
from fabric.contrib.project import rsync_project
env.use_ssh_config = True
project_root = '/var/www/oliverdavies'
@task
2017-01-08 08:23:27 +00:00
def build_deploy():
2017-01-08 02:11:19 +00:00
build()
deploy()
file_permissions()
2017-01-03 23:33:21 +00:00
2017-01-08 02:11:19 +00:00
def build():
2017-01-08 01:46:22 +00:00
local('composer install --no-dev --optimize-autoloader')
local('composer run production')
2017-01-03 23:33:21 +00:00
local('echo %s > output_prod/version' % env.build_number)
2017-01-08 01:46:22 +00:00
local('npm run init')
local('npm run production')
2017-01-03 23:33:21 +00:00
2017-01-08 02:11:19 +00:00
def deploy():
2017-01-03 23:33:21 +00:00
rsync_project(
remote_dir='%s/web/' % project_root,
local_dir='output_prod/',
default_opts='-vzcrSLh',
delete=True
)
run('sudo service nginx configtest && sudo service nginx reload')
2017-01-08 02:11:19 +00:00
def file_permissions():
2017-01-08 01:46:22 +00:00
run('sudo chown -R %s:%s %s/web' % (env.user, env.group, project_root))
2017-01-03 23:33:21 +00:00
run('sudo chmod -R 750 %s/web' % project_root)