Skip to content

Commit

Permalink
Setup fixups (#1535)
Browse files Browse the repository at this point in the history
* Update README.md to include env setup step and remove reference to (non-existent) create_locales() helper
* Update docker-compose.yml to build images with Apple Silicon support, which should fall abck to Intel
  • Loading branch information
stevejalim committed Dec 6, 2021
1 parent 61303f4 commit d5d31db
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ The root of all messaging.
One time setup of your environment and database:

0. Make sure you have [docker](https://docker.io) and [docker-compose](https://github.com/docker/compose)
1. `$ docker-compose run --service-ports web bash`
2. `[docker]$ ./manage.py update_product_details`
- If you get an error connecting to the database, you probably need to wait
for a few seconds for PostgreSQL to initialize and then re-try the command.
3. `[docker]$ ./manage.py migrate`
4. `[docker]$ ./manage.py createsuperuser` (enter any user/email/pass you wish. Email is not required.)
5. `[docker]$ ./manage.py shell -c 'from snippets.base.util import *; create_countries(); create_locales();'`
- Create a list of Countries and Locales from Product Details info.
1. Setup an .env file with in the project root dir with at least:
- `SECRET_KEY` set
- `DATABASE_URL=postgres://snippets:snippets@db:5432/snippets`
- `PROD_DETAILS_DIR` set to a writeable path, eg `PROD_DETAILS_DIR=/home/webdev/`
2. `$ docker-compose run --service-ports web bash`
3. `[docker]$ ./manage.py update_product_details`
- If you get an error connecting to the database, you probably need to wait
for a few seconds for PostgreSQL to initialize and then re-try the command.
4. `[docker]$ ./manage.py migrate`
5. `[docker]$ ./manage.py createsuperuser` (enter any user/email/pass you wish. Email is not required.)
6. `[docker]$ ./manage.py shell -c 'from snippets.base.util import *; create_countries();'`
- Create a list of Countries from Product Details info. Note that create_locales() no longer exists.

Start the development server:

Expand All @@ -32,7 +36,6 @@ to use `--service-ports` flag to make docker compose map the required ports.

The project is configured for `docker-compose up` if that's your preference.


## TLS Certificates

Firefox communicates with the snippets service only over secure HTTPS
Expand All @@ -45,8 +48,7 @@ Snippets from your development environment.

## Run the tests

`$ ./manage.py test --parallel`

`$ ./manage.py test --parallel`

## Rebuild your Docker Compose Envinronment

Expand All @@ -60,12 +62,11 @@ $ docker-compose build

```


## Install Therapist

[Therapist](https://github.com/rehandalal/therapist) is a smart pre-commit hook
for git to ensure that committed code has been properly linted.

Install the hooks by running:

`$ therapist install`
`$ therapist install`
5 changes: 5 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ services:
args:
GIT_SHA: "${CI_COMMIT_SHA:-HEAD}"
image: "mozmeao/snippets:builder-${CI_COMMIT_SHORT_SHA:-latest}"
platform: linux/amd64

web:
build:
Expand All @@ -26,6 +27,7 @@ services:
args:
GIT_SHA: "${CI_COMMIT_SHA:-HEAD}"
image: "mozmeao/snippets:${CI_COMMIT_SHORT_SHA:-latest}"
platform: linux/amd64
ports:
- "8443:8443"
- "8000:8000"
Expand All @@ -44,11 +46,13 @@ services:
args:
GIT_SHA: "${CI_COMMIT_SHA:-HEAD}"
image: "mozmeao/snippets:redirector-${CI_COMMIT_SHORT_SHA:-latest}"
platform: linux/amd64
volumes:
- ./redirector:/app

test-web:
image: "mozmeao/snippets:${CI_COMMIT_SHORT_SHA:-latest}"
platform: linux/amd64
depends_on:
- db
env_file:
Expand All @@ -58,5 +62,6 @@ services:

test-redirector:
image: "mozmeao/snippets:redirector-${CI_COMMIT_SHORT_SHA:-latest}"
platform: linux/amd64
command:
pytest test.py

0 comments on commit d5d31db

Please sign in to comment.