-
Notifications
You must be signed in to change notification settings - Fork 679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrap rpa python in docker - see this working example and some other ideas here #316
Comments
Hi @b-cil, at the moment init() does not support choosing Chromium as browser or running as root user (which is the reason requiring the no sandbox option for Chrome / Chromium to run. Some ideas you can explore - Allan from OpenRPA has created working Docker file - And Docker image that has this Python rpa package - See if above has usable information for you to modify your Dockerfile. I'm not familiar enough with Docker to comment. Alternatively, as part of your Python RPA script to be run, you can add below lines to do the adjustments. Change the folder path names according to where TagUI is installed on your server. If you are not planning to run as root user, then the no sandbox replacement is not required. The replacement code below can be run again and again without causing problems the 2nd and 3rd time it runs. import rpa as r
r.dump(r.load('/usr/src/app/tagui/src/tagui').replace('"google-chrome"', '"chromium-browser"').replace('$headless_switch', '--no-sandbox'), '/usr/src/app/tagui/src/tagui')
# then do your thing
r.init(...)
...
r.close() |
Hi @kensoh, still working on it... So far, I'm still unable to run it in docker. I've tried to use what you suggested with no luck. Thing is going step by step is really long and painfull (compiling all ubuntu environment) and I usually come to a point where I have no log nor error and still doesn't work. I'm trying my best to make it work and will publish it when I find a solution if I do find but I desperately need to find one |
Still unable to package it in dockerfile I have contacted Allan but the dockerfile was a pure Tagui packaging and no way to help on this... honestly I think this needs to be tackle because the way the solution is, it's only a proof of concept and nowhere to come to production. I mean I can run it in command python3 -u xxx base64encodedinput but : a tagui cloud or docker embedding Tagui is just required to go production and for now it is just not working. Going through this would be just a big step forward ! |
Hi @b-cil, thanks for sharing your thoughts! I've replied your other issue, let me know more. By design, TagUI does not support running multiple sessions, though there can be configurations to try to make that work, for example installing in different directories and running as different users, so that a session doesn't kill off or affect other sessions. |
Hi There,
I have developped some RPA coding that I'm wishing to deploy in cloud and serve as API. Honestly I switching from windows to linux and different environment which makes it pretty difficult to deploy especially to wrap in a docker container.
So far I'm not able to run it in docker and partially because in the build I'm creating a config for rpa python (setting up php, chromium, xvfb, amazon coretto tagui) and when it comes to the solution you provide in #190 it's hard to know exactly where tagui is located within the docker container.
Therefore would it be possible to move the workaround 👍 https://colab.research.google.com/drive/13bQO6G_hzE1teX35a3NZ4T5K-ICFFdB5?usp=sharing
import rpa as r; r.setup(); r.dump(r.load('/root/.tagui/src/tagui').replace('"google-chrome"', '"chromium-browser"').replace('$headless_switch', '--no-sandbox'), '/root/.tagui/src/tagui')
to a init config where you can setup the chronium and no sandbox as arguments of the init function ?
so far my Dockerfile :
FROM ubuntu:20.04
WORKDIR /usr/src/app
RUN apt update
RUN apt --yes install software-properties-common java-common unzip
RUN add-apt-repository -y ppa:saiarcot895/chromium-beta
RUN add-apt-repository -y ppa:ondrej/php
RUN apt update
RUN apt --yes install chromium-browser php7.4 wget python3 python3-pip xvfb
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt --yes install ./google-chrome-stable_current_amd64.deb
RUN wget https://corretto.aws/downloads/latest/amazon-corretto-8-x64-linux-jdk.deb
RUN dpkg -i amazon-corretto-8-x64-linux-jdk.deb
RUN wget https://github.com/kelaberetiv/TagUI/releases/download/v6.46.0/TagUI_Linux.zip
RUN unzip TagUI_Linux.zip
COPY requirements.txt /usr/src/app/requirements.txt
RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install -r requirements.txt
RUN python3 -m pip install pyvirtualdisplay
COPY . .
ARG PYTHONPATH=/usr/bin/python3
CMD python3 $SCRIPT $ARGS
commands
docker build -t rpa .
docker run -e "SCRIPT=filler.py" -e "ARGS=...." rpa
filler.py
import sys, json, base64
import rpa as r
from difflib import SequenceMatcher
import pyvirtualdisplay;
import xvfbwrapper;
display = pyvirtualdisplay.Display();
display.start()
r.setup();
#r.dump(r.load('/usr/local/bin/tagui/src/tagui').replace('"google-chrome"', '"chromium-browser"').replace('$headless_switch', '--no-sandbox'), '/usr/local/bin/tagui/src/tagui')
r.dump(r.load('/usr/src/app/tagui/src/tagui').replace('"google-chrome"', '"chromium-browser"').replace('$headless_switch', '--no-sandbox'), '/usr/src/app/tagui/src/tagui')
display = pyvirtualdisplay.Display();
display.start()
r.debug(True)
r.init(visual_automation = True, chrome_browser = True, turbo_mode = False, headless_mode = True)
...
requirements.txt
jsonschema==3.2.0
PyVirtualDisplay==2.2
rpa==1.45.0
selenium==4.0.0
tagui==1.45.0
xvfbwrapper==0.2.9
The text was updated successfully, but these errors were encountered: