26/06/2020 docker, AntOS, image, container, API

Running your own AntOS VDE system using docker image

[Update 27/03/2021]: The image is now available on docker hub at: https://hub.docker.com/r/xsangle/antosaio (image: xsangle/antosaio:latest). This post has been updated with latest instruction on how to host a local instance of Antos VDE using docker.

More information on AntOS https://doc.iohub.dev/antos

The docker image provide out-of-the-box working AntOS system which consist of:

  • The web-server
  • AntOS server side API
  • AntOS client side API

AntOS user can be created at creation of of the container, each user is attached to a separated container.

In a multi-users scenario, This mean that user working instance is completely isolated to other. Resource consumption such as CPU, storage and RAM of each instance is configurable.

How it works ?

The following instructions show how to correctly setup a working local Antos instance using the antosaio docker image.

First, we need to create the application moutpoint that will be mounted to the container. The server configuration will be stored in this location, and accessible by the container. The mountpoint is also where user data is permanently stored, separated from the container.

For this example, the mount point is just simply a directory with the following structure:

mkdir -p /tmp/app/{home,tmp,database}

Second, create the server configuration in this directory

# create the server configuration
cat << EOF > /tmp/app/antd-config.ini
[SERVER]
plugins=/opt/www/lib/
plugins_ext=.so
database=/app/data/database/
tmpdir=/app/data/tmp/
maxcon=200
backlog=5000
workers = 2
max_upload_size = 10000000
gzip_enable = 1
gzip_types = text\/.*,.*\/css,.*\/json,.*\/javascript

[PORT:80]
htdocs=/opt/www/htdocs
ssl.enable=0
^/(.*)$ = /os/router.lua?r=<1>&<query>

[AUTOSTART]
plugin = tunnel

[MIMES]
image/bmp=bmp
image/jpeg=jpg,jpeg
text/css=css
text/markdown=md
text/csv=csv
application/pdf=pdf
image/gif=gif
text/html=html,htm,chtml
application/json=json
application/javascript=js
image/png=png
image/x-portable-pixmap=ppm
application/x-rar-compressed=rar
image/tiff=tiff
application/x-tar=tar
text/plain=txt
application/x-font-ttf=ttf
application/xhtml+xml=xhtml
application/xml=xml
application/zip=zip
image/svg+xml=svg
application/vnd.ms-fontobject=eot
application/x-font-woff=woff,woff2
application/x-font-otf=otf
audio/mpeg=mp3,mpeg

[FILEHANDLER]
lua = lua
EOF

Lastly, use the following command to setup AntOS user, mount the application data mountpoint, create and run a dedicated container for the user demo

docker run \
    -p 8080:80 \
    --mount type=bind,source=/tmp/app,target=/app \
    -e ANTOS_USER=demo \
    -e ANTOS_PASSWORD=demo \
    -it xsangle/antosaio:latest

From the host browser, the VDE can be accessed with user and password: demo/demo via

http://<host-ip>:8080

From the AntOS VDE, applications more applications can be installed using the MarketPlace application.

Build the image

The build support support multi-arch build with docker buildx plugin. Instruction to install buildx can be found here: https://github.com/docker/buildx#installing .

The following architectures are supported: armv7, amd64 and arm64.

After installing the plug-in, execute the following commands before running the build script:

docker buildx create --use
# Register Arm executables to run on x64 machines
docker run --rm --privileged docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64

Clone the repository and run the build script:

git clone --depth 1 https://github.com/lxsang/antosaio
cd antosaio
chmod +x bake.sh
./bake.sh

Conclusion

The docker image provides user with a ready to go (out-of-the-box) VDE system. This is useful in many user-cases:

  • Demonstration
  • Quickly setup environment for AntOS applications development
  • Scalable multi-user cloud-base service with AntOS and Kubenetes. Alternative to Ownclod, Google Cloud, Dropbox etc, with a more intuitive and user-friendly GUI

Related posts

Comments

The comment editor supports Markdown syntax. Your email is necessary to notify you of further updates on the discussion. It will be hidden from the public.
Powered by antd server, (c) 2017 - 2021 Xuan Sang LE