-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b832dbc
commit c9c660c
Showing
8 changed files
with
143 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Ignore everything | ||
* | ||
|
||
# Don't ignore... | ||
!battery/ | ||
!bin/ | ||
!log/ | ||
!manage.py | ||
!README.md | ||
!LICENSE | ||
!requirements.txt | ||
|
||
# Testing | ||
!tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,5 +85,9 @@ target/ | |
__pycache__/ | ||
local_settings.py | ||
|
||
# Dev | ||
.env | ||
db.sqlite3 | ||
|
||
# Dev DB | ||
db.sqlite3 | ||
.local/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.PHONY: help | ||
|
||
help: ## Prints this help message | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
build: ## Build container locally | ||
# Generate tag | ||
echo TAG=$(shell git rev-parse --abbrev-ref HEAD | sed 's/[^a-zA-Z0-9]/-/g') >> .env | ||
|
||
# Build | ||
docker-compose build --build-arg GIT_COMMIT=$(shell git describe --abbrev=8 --always --tags --dirty) --build-arg DEBUG=True | ||
|
||
docker-rm: stop ## Delete container | ||
docker-compose rm -f | ||
|
||
shell: ## Get container shell | ||
docker-compose run --entrypoint "/bin/bash" battery_server | ||
|
||
run: build ## Run command in container | ||
docker-compose run battery_server | ||
|
||
stop: ## Stop container | ||
docker-compose down | ||
docker-compose stop | ||
|
||
dev: ## Make everything you need to dev in the background | ||
docker-compose -f docker-compose.yml up db pgadmin --remove-orphans | ||
|
||
quick: build ## Make just what you need to quick-test | ||
docker-compose -f docker-compose.yml up battery_server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
=== battery.frc1721.org === | ||
|
||
https://battery.frc1721.org/ | ||
|
||
Django server to keep track of the state of batteries. | ||
Made by dublu. | ||
|
||
----- TODO | ||
|
||
Sort and filter | ||
Make it look better | ||
|
||
## Development (using pipenv) | ||
|
||
Use `pipenv` to manage python deps and versions | ||
|
||
```shell | ||
pipenv install | ||
pipenv shell | ||
``` | ||
|
||
Spawn a development django server | ||
|
||
```shell | ||
python manage.py migrate | ||
python manage.py runserver | ||
``` | ||
|
||
## Development (using docker) | ||
|
||
In one terminal, start the `dev` requirements. | ||
|
||
```shell | ||
make dev | ||
``` | ||
|
||
In another terminal, build and run a local copy of the server | ||
|
||
```shell | ||
make run | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Do not use for production! | ||
|
||
services: | ||
db: | ||
image: postgres:10.5 | ||
restart: "no" | ||
environment: | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=postgres | ||
- POSTGRES_DB=battery_db | ||
healthcheck: | ||
test: ["CMD", "pg_isready", "-q", "-d", "battery_db", "-U", "postgres"] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
logging: | ||
options: | ||
max-size: 10m | ||
max-file: "3" | ||
ports: | ||
- "5438:5432" | ||
volumes: | ||
- .local/data:/var/lib/postgresql/data | ||
|
||
pgadmin: | ||
image: dpage/pgadmin4 | ||
container_name: pgadmin4_container | ||
restart: no | ||
ports: | ||
- "8888:80" | ||
environment: | ||
PGADMIN_DEFAULT_EMAIL: [email protected] | ||
PGADMIN_DEFAULT_PASSWORD: iamnotacrook | ||
volumes: | ||
- .local/pgadmin:/var/lib/pgadmin | ||
|
||
battery_server: | ||
depends_on: | ||
db: | ||
condition: service_healthy | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
environment: | ||
LOG_LEVEL: "DEBUG" | ||
restart: "no" | ||
command: "true" |