create the bootstrap script and update the README.md
This commit is contained in:
parent
91df8a0f26
commit
6ba5cc6815
10
Dockerfile
10
Dockerfile
|
@ -1,10 +0,0 @@
|
||||||
FROM --platform=$BUILDPLATFORM python:3.10-alpine AS builder
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY requirements.txt /app
|
|
||||||
RUN pip3 install -r requirements.txt
|
|
||||||
|
|
||||||
COPY . /app
|
|
||||||
|
|
||||||
CMD ["python", "main.py"]
|
|
22
README.md
22
README.md
|
@ -6,10 +6,28 @@ Bluetooth control app for Wahoo Headwind.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
To run the flask app:
|
To run the flask app for development and testing:
|
||||||
```bash
|
```bash
|
||||||
|
git clone https://teapot.octopusx.de/accidentallycompetent/bluewind.git
|
||||||
|
cd bluewind
|
||||||
|
python3 -m venv .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
python3 -m pip install --upgrade pip
|
||||||
|
pip3 install -r requirements.txt
|
||||||
export FLASK_ADDRESS='<headwind bluetooth address>'
|
export FLASK_ADDRESS='<headwind bluetooth address>'
|
||||||
flask --app api run --host=0.0.0.0
|
python3 main.py
|
||||||
|
```
|
||||||
|
|
||||||
|
To run the flask app in a permanent deployment:
|
||||||
|
```bash
|
||||||
|
git clone https://teapot.octopusx.de/accidentallycompetent/bluewind.git
|
||||||
|
cd bluewind
|
||||||
|
python3 -m venv .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
python3 -m pip install --upgrade pip
|
||||||
|
pip3 install -r requirements.txt
|
||||||
|
cp default.env .env # modify your .env file!
|
||||||
|
sudo /bin/bash scripts/install.sh # will install and start+enable the systemd service for you
|
||||||
```
|
```
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
python3 -m venv .venv
|
|
||||||
source .venv/bin/activate
|
|
||||||
python3 -m pip install --upgrade pip
|
|
||||||
pip3 install -r requirements.txt
|
|
|
@ -1 +1,2 @@
|
||||||
FLASK_ADDRESS='F2:B3:F7:6A:24:48'
|
FLASK_ADDRESS='F2:B3:F7:6A:24:48'
|
||||||
|
FLASK_URL='127.0.0.1:5000'
|
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Export the environment variables
|
||||||
|
if [ ! -f ".env" ]; then
|
||||||
|
echo "The .env file does not exist, please make a copy of default.env into .env and adjust its contents before proceeding."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
export $(cat .env)
|
||||||
|
|
||||||
|
# Create new systemd file
|
||||||
|
touch /etc/systemd/system/bluewind.service
|
||||||
|
|
||||||
|
# Fill in the systemd file
|
||||||
|
echo -e """[Unit]
|
||||||
|
Description=Flask Application
|
||||||
|
After=multi-user.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=$(pwd)/.venv/bin/python3 $(pwd)/main.py
|
||||||
|
Restart=always
|
||||||
|
Environment="FLASK_ADDRESS=$(echo $FLASK_ADDRESS)"
|
||||||
|
Environment="FLASK_URL=$(echo $FLASK_URL)"
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
""" > /etc/systemd/system/bluewind.service
|
||||||
|
|
||||||
|
# Reload systemd unit, start and enable the service
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl enable bluewind.service
|
||||||
|
systemctl start bluewind.service
|
Loading…
Reference in New Issue