Skip to content

Commit

Permalink
consolidate into docker-entrypoint.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusandra committed Dec 1, 2024
1 parent b20e378 commit bf914f0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
7 changes: 4 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Python >= 3.11
`nim >=2.0.0` (https://nim-lang.org/install.html)
(Note that Debian distros have only packaged `1.6.x` as of Jan 2024)

## FrameOS Controller
## FrameOS Backend


```bash
Expand Down Expand Up @@ -44,6 +44,7 @@ flask db migrate -m "something changed"
# apply the migrations
flask db upgrade
```

## Installing pre-commit

```bash
Expand All @@ -62,7 +63,7 @@ cd backend
bin/tests
```

## FrameOS on-device software
## FrameOS on-frame software

Running it natively on a Mac will fail with

Expand All @@ -75,7 +76,7 @@ So we use Docker:

```bash
cd frameos
docker build -t frameos . && docker run -t -i frameos python3 test.py
docker build -t frameos-frame . && docker run -t -i frameos python3 test.py
```

# TODO
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ RUN rm -rf /app/frontend && mv /tmp/frontend /app/
EXPOSE 8989

# Start huey in the background and then run the Flask application
CMD ["bash", "-c", "(redis-server --daemonize yes) && (cd backend && source .venv/bin/activate && flask db upgrade) && (cd backend && source .venv/bin/activate && huey_consumer.py app.huey.huey --worker-type=greenlet --workers=10 --flush-locks) & (cd backend && source .venv/bin/activate && python3 run.py)"]
CMD ["./docker-entrypoint.sh"]
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
ports:
- "8989:8989"
volumes:
- frameos-data:/app/data
- frameos-db:/app/db

volumes:
frameos-data:
frameos-db:
18 changes: 18 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -e # exit as soon as a command fails

echo "🥕 Starting Redis"
redis-server --daemonize yes

cd backend
source .venv/bin/activate

echo "🏃‍♂️ Running migrations"
flask db upgrade

echo "🍿 Launching Huey"
huey_consumer.py app.huey.huey --worker-type=greenlet --workers=10 --flush-locks &

echo "🔦 Launching Flask"
python3 run.py

0 comments on commit bf914f0

Please sign in to comment.