Launching RemoteApp in Docker container¶
Install the Docker and Docker-compose packages according to documentation for your distribution.
Create a custom directory like remoteapp:
mkdir remoteapp
In the new directory, create three files:
Dockerfile
with content:FROM debian:10 RUN apt-get update -y ; apt-get upgrade -y RUN apt-get install -y apache2 --no-install-recommends; apt-get install -y libapache2-mod-wsgi-py3 --no-install-recommends; apt-get install -y mariadb-client --no-install-recommends RUN a2enmod wsgi RUN cd /usr/local/bin ; ln -s /usr/bin/python3 python # Need to get up to date pip RUN apt-get install -y wget --no-install-recommends RUN adduser --system --group --disabled-login aos RUN apt-get update -y ; apt-get upgrade -y RUN apt-get install -y python3-pip --no-install-recommends RUN wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py' ; python get-pip.py --disable-pip-version-check --no-cache-dir # pip should be now pip3 RUN pip --version ; rm -f get-pip.py # Install remoteapp ENV PIP_INDEX_URL="http://pypi.accentos.ru/simple/" ENV PIP_TRUSTED_HOST="pypi.accentos.ru" ARG CLOUD_IP ARG CLOUD_DOMAIN ARG CLOUD_USER ARG CLOUD_PASSWORD ARG CLOUD_API RUN pip3 install remoteapp RUN mkdir -p /etc/remoteapp /var/log/remoteapp/ /var/lib/remoteapp/ RUN chown -R aos:aos /var/log/remoteapp/ /etc/remoteapp /var/lib/remoteapp/ /usr/local/lib/python3.7/dist-packages/remoteapp/ RUN remoteapp-configure RUN sed -i "s/cloud_url = localhost/cloud_url = $CLOUD_IP/g" /etc/remoteapp/remoteapp.conf RUN sed -i "s/127.0.0.1/$CLOUD_API/g" /etc/remoteapp/remoteapp.conf RUN sed -i "s/localhost:3306/ra_db:3306/g" /etc/remoteapp/remoteapp.conf # Config RUN ln -s /etc/apache2/conf-available/remoteapp-web.conf /etc/apache2/conf-enabled/remoteapp-web.conf RUN rm -rf /etc/apache2/sites-available/000-default.conf RUN rm -rf /etc/apache2/sites-enabled/000-default.conf EXPOSE 8080 RUN apt-get clean # Prep for init setup COPY entrypoint.sh /usr/bin RUN chmod +x usr/bin/entrypoint.sh
docker-compose.yaml
with content:version: '3' services: ra_db: image: mariadb:10.5 container_name: ra_db environment: MYSQL_ROOT_PASSWORD: 123456 MYSQL_DATABASE: remoteapp MYSQL_USER: aos MYSQL_PASSWORD: password restart: on-failure ports: - "3306:3306" networks: - "important_network" ra_api: build: context: . dockerfile: Dockerfile args: CLOUD_IP: IP CLOUD_DOMAIN: DOMAIN CLOUD_USER: USER CLOUD_PASSWORD: PASSWORD CLOUD_API: localhost depends_on: - "ra_db" command: /usr/bin/entrypoint.sh image: remoteapp/ra_api:latest container_name: ra_api ports: - "8001:8001" restart: on-failure networks: - "important_network" networks: important_network: driver: bridge
and
entrypoint.sh
with content:#!/bin/bash sleep 10 FLASK_APP=remoteapp.cloudapi.app flask db upgrade /usr/local/bin/gunicorn --bind=0.0.0.0:8001 --user aos --group aos --workers=3 --threads=10 remoteapp.cloudapi.wsgi & ra-client create type ipaddr=10.40.12.5 domain=default user=admin password=cobbler type=mstsc template=default ext=rdp os_type=appv ra-client create pub ipaddr=10.40.12.5 domain=default user=admin password=cobbler type=win configure=default ext=reg exec /usr/sbin/apachectl -DFOREGROUND
In the
docker-compose.yaml
file fill in the required arguments:- CLOUD_IP: is IP address of the cloud that RemoteApp will work with. For example, 10.40.50.60;
- CLOUD_DOMAIN: is domain name for authorization in the cloud. For example,
default
; - CLOUD_USER: is user name for authorization in the cloud. For example,
admin
; - CLOUD_PASSWORD: is password for the user specified in CLOUD_USER. For example,
password
; - CLOUD_API: is IP address where container is running with remoteapp api. For example, 10.60.50.40.
To create an image to run the container in the folder where the files were created in step 2 execute:
sudo docker-compose build
To start a container with RemoteApp, execute:
sudo docker-compose up -d
After a successful start, the RemotApp interface will be available at
http://HOST_IP:8080
where HOST_IP is the IP address of the host where the containers were launched.