Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Organize local artifacts into dir #82

Merged
merged 6 commits into from
Jun 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json
{
"name": "Benefits",
"dockerComposeFile": ["./docker-compose.yml"],
"dockerComposeFile": ["./localhost/docker-compose.yml"],
"service": "dev",
"runServices": ["dev", "docs", "server"],
"workspaceFolder": "/home/calitp/app",
Expand Down
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
.git/
.github/
.vscode/
keys/
server/
localhost/
**/__pycache__/
.devcontainer.json
.flake8
Expand Down
2 changes: 1 addition & 1 deletion .pyup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ branch: dev
schedule: ""
update: all
requirements:
- server/requirements.txt:
- localhost/server/requirements.txt:
update: False
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}/server",
"localRoot": "${workspaceFolder}/localhost/server",
"remoteRoot": "/usr/src/server"
}
]
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Clone the repository:

```console
git clone https://github.com/cal-itp/benefits
cd benefits
cd benefits/localhost
```

Create an environment file from the sample:
Expand All @@ -36,7 +36,8 @@ After initialization, the client is running at `http://localhost:${DJANGO_LOCAL_
If `DJANGO_ADMIN=true`, the backend administrative interface can be accessed with the superuser you setup at
<http://localhost:8000/admin>.

By default, sample data from [`data/client.json`](./data/client.json) is used to initialize Django. Alternatively you may:
By default, sample data from [`localhost/data/client.json`](./localhost/data/client.json) is used to initialize Django.
Alternatively you may:

* Modify the sample data file; or
* Point `DJANGO_INIT_PATH` at a different data file; or
Expand All @@ -59,7 +60,7 @@ docker-compose up [-d] --build server

The API endpoint is running at `http://localhost:5000/verify`.

Sample users and eligibility can be found in [`data/server.json`](./data/server.json).
Sample users and eligibility can be found in [`localhost/data/server.json`](./localhost/data/server.json).

## Development

Expand Down
5 changes: 4 additions & 1 deletion .env.sample → localhost/.env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Docker Compose config
COMPOSE_PROJECT_NAME=benefits

# Amplitude config
ANALYTICS_KEY=amplitude-api-key

Expand All @@ -13,7 +16,7 @@ DJANGO_ADMIN=false
DJANGO_ALLOWED_HOSTS="localhost 127.0.0.1 [::1]"
DJANGO_DB=django
DJANGO_DEBUG=true
DJANGO_INIT_PATH=data/client.json
DJANGO_INIT_PATH=localhost/data/client.json
DJANGO_LOCAL_PORT=8000
DJANGO_LOG_LEVEL=DEBUG
DJANGO_SECRET_KEY=secret
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.dev → localhost/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM benefits_client:latest
USER root

RUN apt-get install -qq --no-install-recommends curl git jq ssh && \
python -m pip install --upgrade pip && \
pip install --no-cache-dir flake8 debugpy pre-commit

COPY docs/requirements.txt docs/requirements.txt
Expand Down
22 changes: 22 additions & 0 deletions localhost/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Benefits: `localhost`

Code and artifacts for testing and running the Benefits application in a local, non-production environment.

## [`data/`](./data)

* `client.json`: sample configuration for the Benefits client
* `server.json`: sample configuration for a local Eligibility Verification server

## [`keys/`](./keys)

* `client.key` and `client.pub`: encryption keypair for the Benefits client
* `server.key` and `server.pub`: encryption keypair for the local Eligibility Verification server

## [`server/`](./server)

* Simple Flask app implementing Eligiblity Verification server

## [`Dockerfile.dev`](./Dockerfile.dev)

* Docker image built on the [Benefits Docker image](../Dockerfile) used with
[VS Code devcontainers](https://code.visualstudio.com/docs/remote/containers).
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions docker-compose.yml → localhost/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.8"

services:
client:
build: .
build: ..
image: benefits_client:latest
environment:
- ANALYTICS_KEY
Expand All @@ -21,8 +21,8 @@ services:

dev:
build:
context: .
dockerfile: Dockerfile.dev
context: ..
dockerfile: localhost/Dockerfile.dev
image: benefits_client:dev
environment:
- ANALYTICS_KEY
Expand All @@ -41,7 +41,7 @@ services:
- "${DJANGO_LOCAL_PORT}:8000"
- "5678:5678"
volumes:
- .:/home/calitp/app:cached
- ../:/home/calitp/app:cached

docs:
image: benefits_client:dev
Expand All @@ -50,7 +50,7 @@ services:
ports:
- "${DOCS_LOCAL_PORT}:8001"
volumes:
- .:/home/calitp/app:cached
- ../:/home/calitp/app:cached

server:
build: ./server
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion server/app.py → localhost/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,4 @@ def get(self):


if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)
app.run(host="0.0.0.0", debug=True) # nosec
File renamed without changes.
File renamed without changes.