my perpetually-unfinished side project; read-it-later but for streaming music.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.4 KiB

# -*- coding: utf-8 -*-
import datetime
from fabric import task
from invoke import Context
import pytz
def test(c):"ls -al /srv/watershed/deploys", echo=True)
def deploy(c, migrate=False):
deploy to production.
GIT_SHA = git_hash()
TIMESTAMP = ("America/New_York"))
.replace(microsecond=0, tzinfo=None)
.replace(":", ".")
DEPLOY_DIR = "/srv/watershed/deploys/{}_{}".format(TIMESTAMP, GIT_SHA)
# ensure origin/master stays up to date
c.local("git push origin master", echo=True)
# sentry release
VERSION = c.local("sentry-cli releases propose-version", echo=True).stdout
c.local("sentry-cli releases new {}".format(VERSION), echo=True)
c.local("sentry-cli releases set-commits --auto {}".format(VERSION), echo=True)
c.local("git push deploy master", echo=True)
"/usr/bin/git clone file:///srv/watershed/watershed.git {}".format(DEPLOY_DIR),
)"virtualenv {}/.venv".format(DEPLOY_DIR), echo=True)
with c.prefix("source .venv/bin/activate"):"pip install -r requirements.txt", echo=True)"yarn install", echo=True)"node_modules/.bin/webpack --mode=production --site", echo=True)"./ collectstatic --noinput", echo=True)
if migrate:"./ migrate")"./ compile_pyc")"chgrp -R www-data . && chmod -R 775 .")"ln -nsf {} /srv/watershed/live".format(DEPLOY_DIR))
"ln -nsf /srv/watershed/live/watershed.uwsgi.ini /etc/uwsgi/apps-enabled/",
)"sudo service uwsgi reload")
"ln -nsf /srv/watershed/live/watershed.nginx.conf /etc/nginx/sites-enabled/",
)"sudo service nginx reload")
def package_ext(c):
zip the extension. just making sure idk
GIT_SHA = git_hash()
c.local("webpack --mode=production --browser")
c.local("zip -r ../releases/extension_{} *".format(GIT_SHA))
def git_hash():
get an identifier for HEAD
local = Context()
return"git rev-parse --short HEAD").stdout.rstrip("\n")