Skip to content

Commit

Permalink
Update setup instructions and config (#1404)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahkagan authored Jan 6, 2022
1 parent c671dee commit 5ed3e18
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
PATH := $(PATH):$(HOME)/.local/bin

deps:
sudo apt install python3.8 python3-virtualenv libpython3.8-dev libpq-dev graphicsmagick
sudo apt install python3.8 python3.8-venv libpython3.8-dev libpq-dev graphicsmagick
# Install node: https://github.com/nodesource/distributions/blob/master/README.md#deb
curl -fsSL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
# Install poetry: https://python-poetry.org/docs/master/#osx--linux--bashonwindows-install-instructions
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python3.8 -
curl -sSL https://install.python-poetry.org | python3.8 -
sudo npm install -g yarn
sudo apt install postgresql

Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,14 @@ Before submitting a pull request, please review our [Contribution Guidelines](./

#### Installing Arlo

We recommend running Arlo on Ubuntu 18.0.4.
We recommend running Arlo on Ubuntu 20.

- Clone the Arlo repository from https://github.com/votingworks/arlo.
- Install Node10. See https://joshtronic.com/2018/05/08/how-to-install-nodejs-10-on-ubuntu-1804-lts/
- `make dev-environment` or, if you prefer, look at individual make tasks like `deps`, `initdevdb`, `install-development`, and `resetdb`

Here are some troubleshooting steps for issues we've run into when installing Arlo before:

- Postgres is best installed by grabbing `postgresql-server-dev-10` and `postgresql-client-10`.
- Arlo expects the Postgresql server to use the UTC timezone. You may need to edit `/etc/postgresql/10/main/postgresql.conf` and set `timezone = UTC`.
- `psycopg2` has known issues depending on your install (see, e.g., [here](https://github.com/psycopg/psycopg2/issues/674)). If you run into issues, switch `psycopg2` to `psycopg2-binary` in pyproject.toml
- A password may have to be set in the `DATABASE_URL` env var depending on your install of postgres. To do this, change `postgresql://postgres@localhost:5432/arlo` to `postgresql://postgres:{PASSWORD}@localhost:5432/arlo`, replacing `{PASSWORD}` with the password.
- You may need to create `arlo` and `arlo-test` databases manually [via postgres](https://www.postgresql.org/docs/9.0/sql-createdatabase.html).
Expand Down
2 changes: 0 additions & 2 deletions run-dev.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env bash

export ARLO_AUDITADMIN_AUTH0_BASE_URL=${ARLO_AUDITADMIN_AUTHO_BASE_URL:-http://localhost:8080}
export ARLO_SUPPORT_AUTH0_BASE_URL=${ARLO_SUPPORT_AUTHO_BASE_URL:-http://localhost:8080}
export FLASK_ENV=${FLASK_ENV:-development}
trap 'kill 0' SIGINT SIGHUP
cd "$(dirname "${BASH_SOURCE[0]}")"
Expand Down
41 changes: 32 additions & 9 deletions server/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,22 @@ def parse_bool(value: str) -> bool:

# Support user login config
SUPPORT_AUTH0_BASE_URL = read_env_var(
"ARLO_SUPPORT_AUTH0_BASE_URL", env_defaults=dict(test="")
"ARLO_SUPPORT_AUTH0_BASE_URL",
env_defaults=dict(
test="http://localhost:8080", development="http://localhost:8080"
),
)
SUPPORT_AUTH0_CLIENT_ID = read_env_var(
"ARLO_SUPPORT_AUTH0_CLIENT_ID", env_defaults=dict(test="")
"ARLO_SUPPORT_AUTH0_CLIENT_ID",
env_defaults=dict(
test="test-support-client-id", development="dev-support-client-id"
),
)
SUPPORT_AUTH0_CLIENT_SECRET = read_env_var(
"ARLO_SUPPORT_AUTH0_CLIENT_SECRET", env_defaults=dict(test="")
"ARLO_SUPPORT_AUTH0_CLIENT_SECRET",
env_defaults=dict(
test="test-support-client-secret", development="dev-support-client-secret"
),
)
# Required email domain(s) for support users (comma-separated string)
SUPPORT_EMAIL_DOMAINS = read_env_var(
Expand All @@ -92,25 +101,39 @@ def parse_bool(value: str) -> bool:

# Audit admin OAuth login config
AUDITADMIN_AUTH0_BASE_URL = read_env_var(
"ARLO_AUDITADMIN_AUTH0_BASE_URL", env_defaults=dict(test="")
"ARLO_AUDITADMIN_AUTH0_BASE_URL",
env_defaults=dict(
test="http://localhost:8080", development="http://localhost:8080"
),
)
AUDITADMIN_AUTH0_CLIENT_ID = read_env_var(
"ARLO_AUDITADMIN_AUTH0_CLIENT_ID", env_defaults=dict(test="")
"ARLO_AUDITADMIN_AUTH0_CLIENT_ID",
env_defaults=dict(
test="test-auditadmin-client-id", development="dev-auditadmin-client-id"
),
)
AUDITADMIN_AUTH0_CLIENT_SECRET = read_env_var(
"ARLO_AUDITADMIN_AUTH0_CLIENT_SECRET", env_defaults=dict(test="")
"ARLO_AUDITADMIN_AUTH0_CLIENT_SECRET",
env_defaults=dict(
test="test-auditadmin-client-secret", development="dev-auditadmin-client-secret"
),
)

# Jurisdiction admin login code email config
SMTP_HOST = read_env_var("ARLO_SMTP_HOST", env_defaults=dict(test="test-smtp-host"))
SMTP_HOST = read_env_var(
"ARLO_SMTP_HOST",
env_defaults=dict(development="dev-smtp-host", test="test-smtp-host"),
)
SMTP_PORT = int(
read_env_var("ARLO_SMTP_PORT", env_defaults=dict(development="587", test="587"))
)
SMTP_USERNAME = read_env_var(
"ARLO_SMTP_USERNAME", env_defaults=dict(test="test-smtp-username")
"ARLO_SMTP_USERNAME",
env_defaults=dict(development="dev-smtp-username", test="test-smtp-username"),
)
SMTP_PASSWORD = read_env_var(
"ARLO_SMTP_PASSWORD", env_defaults=dict(test="test-smtp-password")
"ARLO_SMTP_PASSWORD",
env_defaults=dict(development="dev-smtp-password", test="test-smtp-password"),
)
LOGIN_CODE_LIFETIME = timedelta(minutes=15)

Expand Down

0 comments on commit 5ed3e18

Please sign in to comment.