Skip to content

Commit

Permalink
Add is_prod logic to justfile (#71)
Browse files Browse the repository at this point in the history
* Add is_prod logic to justfile

* Update documentation
  • Loading branch information
AetherUnbound authored Sep 10, 2021
1 parent 55fa309 commit 6aad01e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,27 @@ To deploy, copy `.env.example` to `.env` and populate with the appropriate value

## Setup

We use `just` as our command runner for this repo.
The same `just` commands described below can be used to deploy production.
The `docker-compose-prod.yml` file defines the minimum services for running in production.
In order to use this file, set the `IS_PROD` environment variable to `true`.
This will run all commands using the prod docker file.

A phone must be registered prior to running the container.
This can be done with the following command:
```bash
docker-compose run --rm cli ./register-number.sh
just register
```

After following the registration prompts with your device, the container can be run with:
```bash
docker-compose up -d
just up
```

If a safety number in a group changes, the signal-cli will have issues sending messages.
The following verification utility will re-verify these numbers.
```bash
docker-compose run --rm cli signal-scanner-bot-verify
just verify
```

## Technicalities
Expand Down
14 changes: 6 additions & 8 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
set dotenv-load := false
DC := "docker-compose"
IS_PROD := env_var_or_default("IS_PROD", "")
COMPOSE_FILE := if IS_PROD == "true" {"-f docker-compose-prod.yml "} else {""}
DC := "docker-compose " + COMPOSE_FILE
RUN := "run --rm cli"

# Build the containers
Expand All @@ -14,17 +16,13 @@ up service="":
down:
{{ DC }} down

# Production deployment
deploy:
{{ DC }} -f docker-compose-prod.yml up -d

# Verify all numbers
verify:
{{ DC }} -f docker-compose-prod.yml {{ RUN }} signal-scanner-bot-verify
{{ DC }} {{ RUN }} signal-scanner-bot-verify

# Register a new number
register file="docker-compose.yml":
{{ DC }} -f {{ file }} {{ RUN }} ./register-number.sh
register:
{{ DC }} {{ RUN }} ./register-number.sh

# Static checks
static:
Expand Down

0 comments on commit 6aad01e

Please sign in to comment.