-
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
Showing
5 changed files
with
67 additions
and
11 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
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,9 @@ | ||
FROM python:3.9 | ||
|
||
RUN mkdir /app | ||
COPY . /app | ||
WORKDIR /app | ||
ENV PYTHONPATH=${PYTHONPATH}:${PWD} | ||
RUN pip3 install poetry | ||
RUN poetry config virtualenvs.create false | ||
RUN poetry install |
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,15 @@ | ||
.PHONY: all install update uninstall | ||
|
||
all: | ||
@docker compose run --rm --entrypoint '' api flask db upgrade | ||
|
||
install: | ||
@docker compose up --detach --remove-orphans | ||
|
||
update: | ||
@docker compose pull | ||
@docker compose up --force-recreate --build --detach | ||
|
||
uninstall: | ||
@docker compose stop | ||
@docker compose rm --volumes --force |
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 |
---|---|---|
@@ -1,11 +1,17 @@ | ||
# Development setup | ||
|
||
- [Install poetry](https://python-poetry.org/docs/#installation) | ||
- Install python 3.9 | ||
- Create a virtual `python -m venv venv` | ||
- Activate `source venv/bin/activate` | ||
- Install dependencies `poetry install` | ||
- Copy environment file: `cp .env.template .env` | ||
- Replace environment variables with yours | ||
- Run migrations `flask db upgrade` | ||
- Launch the app `flask run` | ||
# LightsOff API | ||
|
||
## Built With | ||
|
||
- [Python3](https://www.python.org/) | ||
- [Poetry](https://python-poetry.org/) | ||
- [Flask](https://flask.palletsprojects.com/) | ||
- [Docker](https://www.docker.com/) & [Docker Composer](https://docs.docker.com/compose/) | ||
|
||
## Get Started | ||
|
||
Copy environment file: `cp .env.template .env` | ||
|
||
```console | ||
make | ||
make install | ||
``` |
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,23 @@ | ||
services: | ||
api: | ||
build: . | ||
working_dir: /app | ||
volumes: | ||
- ./:/app | ||
ports: | ||
- 5000:5000 | ||
depends_on: | ||
- database | ||
entrypoint: flask run --debug | ||
environment: | ||
- DATABASE_URI=postgresql://lightsoff:lightsoff@database:5432/lightsoff | ||
- SERVER_NAME=0.0.0.0:5000 | ||
|
||
database: | ||
image: postgres:15-alpine | ||
environment: | ||
- POSTGRES_USER=lightsoff | ||
- POSTGRES_PASSWORD=lightsoff | ||
- POSTGRES_DB=lightsoff | ||
ports: | ||
- 5054:5432 |