1
0
Fork 0

iotbox starts properly now

This commit is contained in:
Tobias Brunner 2019-06-27 22:23:53 +02:00
parent 41cb41be5f
commit 7b8731c345
7 changed files with 44 additions and 60 deletions

View File

@ -17,12 +17,18 @@ services:
ipv4_address: 10.5.0.2
iotbox:
build: ./iotbox
depends_on:
- db
command: -- --load=web,hw_proxy,hw_posbox_homepage,hw_posbox_upgrade,hw_scale,hw_scanner,hw_escpos,hw_blackbox_be,hw_screen,hw_drivers,hw_printer_network
ports:
- 8070:8069
- 8072:8072
volumes:
- /dev/bus/usb:/dev/bus/usb
environment:
- HOST=db
- USER=odoo
- PASSWORD=odoo
networks:
localnet:
ipv4_address: 10.5.0.3

View File

@ -57,22 +57,28 @@ RUN set -x; apt-get update \
&& mkdir /usr/lib/python3/dist-packages/odoo/addons/hw_drivers/drivers
RUN pip3 install \
pyusb==1.0.0b1 \
evdev \
gatt \
v4l2 \
phonenumbers \
polib \
pycups
# See https://bugs.launchpad.net/python-v4l2/+bug/1664158
COPY python-v4l2-1664158-fix.patch /tmp
RUN patch -p0 /usr/local/lib/python3.5/dist-packages/v4l2.py < /tmp/python-v4l2-1664158-fix.patch
#USER odoo
pycups \
pyusb==1.0.0b1 \
v4l2
## Get pos-addons for pos_printer_network
RUN git clone --depth=1 -b 12.0 https://github.com/it-projects-llc/pos-addons.git \
/opt/posbox/addons
## Apply some patches
COPY patches/*.patch /tmp/
# See https://bugs.launchpad.net/python-v4l2/+bug/1664158
RUN patch -p0 /usr/local/lib/python3.5/dist-packages/v4l2.py < /tmp/python-v4l2-1664158-fix.patch \
# Disable Bluetooth in driver, doesn't work in Docker and isn't needed for the PoS use-case
&& patch -p0 /usr/lib/python3/dist-packages/odoo/addons/hw_drivers/controllers/driver.py < /tmp/disable-bluetooth-driver.patch \
# Start CUPS - IoTBox connects to it and complains if it isn't running
&& patch -p0 /entrypoint.sh < /tmp/start-cups.patch
#USER odoo
COPY odoo.conf /etc/odoo/odoo.conf
COPY entrypoint.sh /

File diff suppressed because one or more lines are too long

View File

@ -1,44 +0,0 @@
#!/bin/bash
set -e
# set the postgres database host, port, user and password according to the environment
# and pass them as arguments to the odoo process if not present in the config file
: ${HOST:=${DB_PORT_5432_TCP_ADDR:='db'}}
: ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}}
: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}}
DB_ARGS=()
function check_config() {
param="$1"
value="$2"
if ! grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then
DB_ARGS+=("--${param}")
DB_ARGS+=("${value}")
fi;
}
check_config "db_host" "$HOST"
check_config "db_port" "$PORT"
check_config "db_user" "$USER"
check_config "db_password" "$PASSWORD"
case "$1" in
-- | odoo)
shift
/etc/init.d/cups start
/etc/init.d/dbus start
if [[ "$1" == "scaffold" ]] ; then
exec odoo "$@"
else
exec odoo "$@" "${DB_ARGS[@]}"
fi
;;
-*)
exec odoo "$@" "${DB_ARGS[@]}"
;;
*)
exec "$@"
esac
exit 1

View File

@ -0,0 +1,12 @@
--- driver.py.orig 2019-06-27 22:11:55.411759929 +0200
+++ driver.py 2019-06-27 22:12:02.794867070 +0200
@@ -396,6 +396,6 @@
m.daemon = True
m.start()
-bm = BtManager()
-bm.daemon = True
-bm.start()
+#bm = BtManager()
+#bm.daemon = True
+#bm.start()

View File

@ -0,0 +1,10 @@
--- entrypoint.sh.orig 2019-06-27 22:17:01.881714065 +0200
+++ entrypoint.sh 2019-06-27 22:16:08.094244835 +0200
@@ -26,6 +26,7 @@
case "$1" in
-- | odoo)
shift
+ /etc/init.d/cups start
if [[ "$1" == "scaffold" ]] ; then
exec odoo "$@"
else