Verj IO and Docker

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Dave, Jon, Steve, Ian

Segi
Ebase User
Posts: 604
Joined: Mon Dec 09, 2013 6:37 pm

Verj IO and Docker

#1

Postby Segi » Wed Jan 22, 2020 9:45 pm

I've been using Docker lately and have been thinking about making a Verj IO Docker container.

Before I start this project, I wanted to ask if anyone has already worked on something like this.

I created a Dockerfile in the past that can be used to build a Docker container running Apache and installs an Angular web app that I wrote and was thinking of building a Verj IO Dockerfile that sets up a new instance of Verj in a similar way.

With the changes in 5.6 where the app and data are separated, this should be a lot easier since they are each stored in separate paths.
0 x

Jon
Moderator
Moderator
Posts: 1304
Joined: Wed Sep 12, 2007 12:49 pm

Re: Verj IO and Docker

#2

Postby Jon » Thu Jan 23, 2020 2:26 pm

The Verj.io cloud platform is based on docker containers so we have extensive experience. We use one container for Tomcat/Verj.io and another container for the database, and a bunch of other containers for management/control purposes. This is fronted by an Haproxy system outside of docker that acts as the front-end.

As you say, the separation of the userdata into a distinct file system makes this easier to implement.
0 x

Segi
Ebase User
Posts: 604
Joined: Mon Dec 09, 2013 6:37 pm

Re: Verj IO and Docker

#3

Postby Segi » Thu Jan 23, 2020 4:10 pm

I don't suppose that you guys have a Dockerfile already do you ?

I find that it makes it a lot easier to build a container

In case it isn't obvious, what I meant is that I want to create a Dockerfile to deploy a local Docker container for those that use Verj on their own server, not for anything cloud based.
0 x

Ian
Ebase Staff
Posts: 26
Joined: Wed Oct 10, 2007 9:40 am
Location: Ebase HQ
Contact:

Re: Verj IO and Docker

#4

Postby Ian » Fri Jan 24, 2020 11:26 am

Hi Segi,

I have put together a few notes on how to do this including what the contents of the Docker file should be and how to use it plus some notes on how to then interact with the container (wasn't sure of your docker skills :) )

The following assumes the operating system to be Linux based.

On the server that has docker installed issue the following commands:

mkdir -p /home/docker-images/ebase
Copy the VerjioServer.tar.gz file into /home/docker-images/ebase
Create a Dockerfile: touch /home/docker-images/ebase/Dockerfile
Copy the following into the Dockerfile:

Code: Select all

# ------------------------------------------
# Dockerfile to build an Ebase image
# ------------------------------------------
FROM ubuntu:18.04
 
# -----------------------------------------------
# Set up the Verj Server : version 5.6 and above
# -----------------------------------------------

# Install the server
RUN mkdir -p /home/software && chmod -R 777 /home/software
COPY VerjioServer.tar.gz /home/software/VerjioServer.tar.gz
RUN mkdir -p /home/verjio
RUN tar -zxf /home/software/VerjioServer.tar.gz -C /home/verjio 
RUN rm -R /home/software 
RUN chmod -R 777 /home/verjio

# Give the start-up script execute permissions
RUN chmod +x /home/verjio/VerjioServer/Server/start_verjio_server.sh 

# Expose required ports
# 3030: AJP connector
# 8009: Redirector
EXPOSE 3030 8009

# Start the ebase server when the container starts up 
CMD ["/home/verjio/VerjioServer/Server/start_verjio_server.sh","run"]

Save the Dockerfile

Docker commands

Build the docker image using: docker build -t {name to give the image} .
Example: docker build -t ebase .
Remember the . at the end

Create and start a container: docker run -d -p 3030:3030 -p 8009:8009 --name {a friendly name for the container} --net=bridge {name of the image you created}
Example: docker run -d -p 3030:3030 -p 8009:8009 --name ebase1 --net=bridge ebase

View containers: docker ps -a
View container logs: docker logs ebase1
Log in to a container: docker exec -it ebase1 bash
Stop a container: docker stop ebase1
Start a container: docker start ebase1
Restart a container: docker restart ebase1
Delete a container: docker rm -f ebase1

Copying from host to container: docker cp {file/folder} {container Id or friendly name}:{destination path}
For example to copy your local workspace into the container.
Logon onto to the server hosting the docker environment
Put your local workspace somewhere on this server
The docker command to copy the local workspace to the container would be
docker cp workspace ebase1:/home/verjio/UserData/Server/apps/ebase/

Copying from container to host: docker cp {container Id or friendly name}:{full path to copy} {destination path}
You can also copy files/folders from the container to the host.
Example: docker cp ebase1:/home/verjio/UserData/Server/apps/ebase/ebaseConf /home/
Would copy the ebaseCOnf folder from the container to /home
0 x

Ian
Ebase Staff
Posts: 26
Joined: Wed Oct 10, 2007 9:40 am
Location: Ebase HQ
Contact:

Re: Verj IO and Docker

#5

Postby Ian » Fri Jan 24, 2020 2:47 pm

Hi Segi,

You will also need to think about what data from within a running container you want to persist externally so that in the event of a container being killed, either manually or because docker needs to be restarted or a server reboot. Once a container is killed all of the data contained within the container is lost.

So, for example, you may want to externalise the workspace folder and/or the ebaseConf folder etc.

To do this you will need to add a -v parameter to the docker run command.
You will need one -v parameter for each externalised folder.

Syntax

-v "{location on host} : {location in the container}

Basically this is just mapping a container path to a path on the host.

Example:
-v "/home/myWorkspace:/home/verjio/UserData/Server/apps/ebase/workspace"
-v "/home/MyEbaseConf:/home/verjio/UserData/Server/apps/ebase/ebaseConf"

So the docker run command would look like this:

docker run -d -p 3030:3030 -p 8009:8009 -v "/home/myWorkspace:/home/verjio/UserData/Server/apps/ebase/workspace" -v "/home/MyEbaseConf:/home/verjio/UserData/Server/apps/ebase/ebaseConf" --name ebase1 --net=bridge ebase
0 x

Segi
Ebase User
Posts: 604
Joined: Mon Dec 09, 2013 6:37 pm

Re: Verj IO and Docker

#6

Postby Segi » Fri Jan 24, 2020 4:08 pm

Ian,

I understand about persistence in Docker which is why that has been my plan is to map an external volume
(C:\VerjIOData) to /VerjIOData so all of the user data is persistently stored, no matter what happens to the Docker container.

This is the main reason that I am only attempting this now with Verj 5.6 since the 2 parts of Verj (app vs userdata) are separated.

Thanks for the Dockerfile and Docker commands. That will help me a lot
0 x


Who is online

Users browsing this forum: No registered users and 10 guests