mirror of
https://github.com/flobz/psa_car_controller.git
synced 2026-08-22 09:26:16 +00:00
Merge pull request #105 from sOckhamSter/master
Docker - Initial Release
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
FROM python:3
|
||||
RUN git clone https://github.com/flobz/psa_car_controller.git /psa_car_controller/
|
||||
WORKDIR /config
|
||||
RUN pip3 install -r /psa_car_controller/requirements.txt
|
||||
EXPOSE 8180
|
||||
RUN chmod +x /psa_car_controller/docker_files/init.sh
|
||||
CMD /psa_car_controller/docker_files/init.sh
|
||||
@@ -22,6 +22,7 @@ The official api is documented [here](https://developer.groupe-psa.io/webapi/b2c
|
||||
|
||||
A video in French was made by vlycop to explain how to use this application : https://youtu.be/XO7-N7G3biU
|
||||
|
||||
For information on configuring the psa_car_controller Docker container [see this section](#docker).
|
||||
|
||||
## I. Get credentials
|
||||
We need to get credentials from the android app.
|
||||
@@ -150,3 +151,54 @@ If you want to thank me for my work :smile:
|
||||
|
||||
[](https://www.paypal.com/donate?hosted_button_id=SM652WPXFNCXS)
|
||||
|
||||
---
|
||||
# Docker
|
||||
|
||||
A containerised version of the psa_car_controller Python scripts by Flobz.
|
||||
- Docker Hub: https://hub.docker.com/r/sockhamster/psa_car_controller
|
||||
|
||||
### Overview
|
||||
Once the container is running, the configuration of the psa_car_controller app is near-identical to setup instructions detailed in the app's readme.
|
||||
|
||||
You'll still need to make sure you have an apk for the appropriate Android app that it's attempting to use. The examples in this readme use the MyVauxhall app v1.27.1 from APKPure:
|
||||
https://m.apkpure.com/myvauxhall-the-official-app-for-vauxhall-drivers/com.psa.mym.myvauxhall/download/2107-APK?from=versions%2Fversion
|
||||
|
||||
On your Docker host, create a config folder which will be mapped to the container and used to store all persistent data. Copy your APK into this folder.
|
||||
|
||||
### Installation
|
||||
Create the container, detached, exposing port 8180, and mapping the a new config folder on your host to /config inside the container:
|
||||
|
||||
```
|
||||
docker run -d -ti --name psa_car_controller1 \
|
||||
--publish 8180:8180 \
|
||||
-v /host_path/config:/config \
|
||||
--restart unless-stopped \
|
||||
psa_car_controller
|
||||
```
|
||||
|
||||
Connect to the bash shell of the newly created container:
|
||||
```
|
||||
docker exec -it psa_car_controller1 /bin/bash
|
||||
```
|
||||
|
||||
Inside the container, run the app_decoder.py script. You'll be prompted for the credentials you use to log into the app on your mobile device usually, plus your country code. If the script gives you a Success! message then move on:
|
||||
```
|
||||
python3 /psa_car_controller/app_decoder.py /config/com.psa.mym.myvauxhall_1.27.1.apk
|
||||
```
|
||||
Start server.py for a first run:
|
||||
```
|
||||
python3 /psa_car_controller/server.py -f /config/test.json -c /config/charge_config1.json -p 8180 -l 0.0.0.0 -r -b /config
|
||||
```
|
||||
You will be prompted to enter a code, sent you you by SMS to your registered mobile number, and the PIN for your account. Sometimes it asks twice (???), but once accepted the service should run. Allow it to run for about a minute before pressing ctrl+c to quit. You should end up back at the bash prompt within the container.
|
||||
|
||||
The final task is to update the container's configuration file to tell it to run the service automatically on next boot. This is done by editing /config/dockerconfig.conf and changing the SHELL_ONLY parameter to FALSE. Alternatively, paste the below command into your shell one by one. These will update the dockerconfig.conf file, exit the container's bash shell, stop the container, then restart the container.
|
||||
|
||||
```
|
||||
echo "export SHELL_ONLY=\"FALSE\"" > /config/dockerconfig.conf
|
||||
exit
|
||||
docker stop psa_car_controller1
|
||||
docker start psa_car_controller1
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export SHELL_ONLY="TRUE"
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
echo "Containerised psa_car_controller loading..."
|
||||
|
||||
echo "Checking for container configuration file /config/dockerconfig.conf"
|
||||
FILE=/config/dockerconfig.conf
|
||||
if [ -f "$FILE" ]; then
|
||||
echo "$FILE exists. Importing file..."
|
||||
source $FILE
|
||||
else
|
||||
echo "$FILE does not exist. Setting default value for SHELL_ONLY=TRUE"
|
||||
export SHELL_ONLY="TRUE"
|
||||
echo "Copying default dockerconfig.conf file to /config"
|
||||
cp /psa_car_controller/docker_files/dockerconfig.conf /config
|
||||
fi
|
||||
|
||||
|
||||
if [ "$SHELL_ONLY" == "TRUE" ]
|
||||
then
|
||||
echo "SHELL_ONLY = TRUE. Loading just a bash shell"
|
||||
/bin/bash
|
||||
else
|
||||
echo "SHELL_ONLY = FALSE. Running server.py"
|
||||
python3 /psa_car_controller/server.py -f /config/test.json -c /config/charge_config1.json -p 8180 -l 0.0.0.0
|
||||
fi
|
||||
Reference in New Issue
Block a user