Skip to content

Instantly share code, notes, and snippets.

@nabla-c0d3
Created August 12, 2020 02:09
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 nabla-c0d3/1606993b9ea4a0b97a3b02eaf05f41ba to your computer and use it in GitHub Desktop.
Save nabla-c0d3/1606993b9ea4a0b97a3b02eaf05f41ba to your computer and use it in GitHub Desktop.
import time
from invoke import task, Context
CMD_COMPOSE = "docker-compose -f docker-compose.dev.yml"
CMD_RUN_APP = f"{CMD_COMPOSE} run --rm app"
@task
def build(ctx):
# type: (Context) -> None
ctx.run(f"{CMD_COMPOSE} build")
@task
def upgrade(ctx):
# type: (Context) -> None
build(ctx)
ctx.run(f"{CMD_COMPOSE} up -d postgres elasticsearch")
time.sleep(10)
ctx.run(f"{CMD_RUN_APP} aleph upgrade")
@task
def services(ctx):
# type: (Context) -> None
ctx.run(f"{CMD_COMPOSE} up -d --remove-orphans postgres elasticsearch ingest-file convert-document")
@task
def web(ctx):
# type: (Context) -> None
services(ctx)
ctx.run(f"{CMD_COMPOSE} up api ui")
@task
def all(ctx):
# type: (Context) -> None
build(ctx)
upgrade(ctx)
web(ctx)
@task
def test(ctx):
# type: (Context) -> None
ctx.run(f"{CMD_RUN_APP} contrib/test.sh")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment