Jump to content
mariusk

Docker image for plastic server

Recommended Posts

Hi,

 

I was wondering whether I was allowed to publish Dockerfile with accompanying files, or even the image itself in the docker hub for plastic scm server.

I have managed to create an image for version 5.4.16.619. Though I am not that familiar with linux or docker and it is tailored to my needs - UP mode, hardcoded password, postgres db only.

 

I was unable to make apt-get installation to work, so I went with mono image and server binaries (wget'ed from https://www.plasticscm.com/download/5.4.16.619/plasticscm/linux_x64/serverzip during the build).

Share this post


Link to post
Share on other sites

Hi Marius,

 

I don't know what DockerFile is ... :P Seems like a way to package software and distribute it?

 

Regarding the apt-get issue, which distro are you using?

Share this post


Link to post
Share on other sites

I was trying to install plastic scm server in docker container which was based on Ubuntu and the issue seemed to be in some missing mono base libraries.

However I just tried it once again and it seems to be working fine now.

 

Dockerfile is simply an instruction file that is used to create a docker image, e.g. in case of apt install Dockerfile for plastic could look like:

FROM ubuntu:14.04

RUN apt-get update \
    && apt-get install curl \
    && rm -rf /var/lib/apt/lists/*

RUN curl -O http://www.plasticscm.com/plasticrepo/5.0/Ubuntu_14.04/Release.key'>http://www.plasticscm.com/plasticrepo/5.0/Ubuntu_14.04/Release.key \
    && apt-key add Release.key

RUN echo "deb http://www.plasticscm.com/plasticrepo/5.0/Ubuntu_14.04/ ./" > /etc/apt/sources.list.d/plasticscm.list \
    && apt-get update \
    && apt-get install -y plasticscm-server \
    && rm -rf /var/lib/apt/lists/*
 
And after running

 sudo docker build . 
it would create a docker image for plasticscm server. Of course running this image on itself will not work as there is no configuration for plastic scm nor there is an entrypoint.

I think that it is ok to add my Dockerfile for manual installation as I do not include plasticd.lic.

Disclaimer: I am still learning both linux and docker and there are still many improvements to be had.

To create an image run extract the content of plasticscm-server-docker.zip to some folder (I will assume to be ~/plasticscm) and execute:

cd ~/plasticscm
sudo docker build -t localhost:5000/plasticscm:5.4.16.621 .
This will create an image based on the Dockerfile and will also create a tag for it.

The image is postgres based (I did not try to add different configuration types or anything it is also would be much simpler to use embedded database [sqlite] just for testing, however I wanted an option to delete container and retain all of my source code data) thus we need either a real postgres db with role [plasticscm] that is allowed to create databases or a postgres container:

 

sudo docker run -d -v /var/lib/postgresql/data --name plasticscm_db_data busybox
sudo docker run -d --volumes-from plasticscm_db_data --name plasticscm_db postgres
sudo docker run -it --rm --link plasticscm_db:postgres postgres /bin/bash -c 'psql -h $POSTGRES_PORT_5432_TCP_ADDR -p $POSTGRES_PORT_5432_TCP_PORT -U postgres -c "CREATE ROLE plasticscm CREATEDB LOGIN;"'
In this case I am using a data only container [plasticscm_db_data] which is not really necessary but this is the setup I am using.

No that we have postgres container we can run image we created previously:

sudo docker run -d -t -p 8084:8084 --link plasticscm_db:postgres --name plasticscm_server localhost:5000/plasticscm:5.4.16.621
Once this command finishes we will have a running plastic server listening to 8084 port. If you have a corresponding client, you can try connecting to this server with root:root credentials (and of course one can change the password, I think by using `cm passwd` command).

The image is almost usable - it will run in demo mode which will expire in 5 days (I think). To provide a license file we can either map a local license file to containers plasticd.lic [i haven't tested that so I do not know whether that works] or create a different image that includes the actual license file.

Download your license file to a local directory (in my case ~/plasticscm_community), and create the following Dockerfile:

FROM localhost:5000/plasticscm:5.4.16.621

COPY plasticd.lic /opt/plasticscm5/server/plasticd.lic
Create an image and run the container (i you were running bare plasticscm container, you have to stop and delete it because I use named containers):

cd ~/plasticscm_community
sudo docker build -t localhost:5000/plasticscm_community:5.4.16.621
sudo docker run -d -t -p 8084:8084 --link plasticscm_db:postgres --name plasticscm_server localhost:5000/plasticscm_community:5.4.16.621
Some of the issues I had:
  • plastic server requires configuration to be in db.conf so the entrypoint recreates this file on startup, it would be nice to specify very simple connection options in command line args
  • plasticd is run with --console which requires a tty, thus we are running container with -t to allocate pseudo-tty (see docker documentation)
  • the mono image although has libz, but there is no symlink and thus DllnotFoundExceptions are raised, to solve this the Dockerfile I attached contains a work-around that simply creates symlink in /usr/lib
The created image could be pushed to a docker hub so that others would not need to build their own image however I am sure that if we were allowed to do that we must not include our license file.

plasticscm-server-docker.zip

Share this post


Link to post
Share on other sites

Hi mariusk,

 

Thanks for your interest! We had a look at your work and put together our very own Plastic SCM Docker image. You can find it now at the Docker Hub! https://registry.hub.docker.com/u/plasticscm/server/

We also published a blog post detailing our ideal deployment process, as well as the Dockerfile sources via Github (https://github.com/PlasticSCM/plastic-docker): http://codicesoftware.blogspot.com/2015/01/plastic-meets-docker.html

 

As you'll see, this is just a first approach, probably not suitable for production environments. However, we're planning on improving it in the future to allow configuration of auth modes and backend types at run time, among other things. We hope you'll find it interesting and we'd love to have more feedback from you regarding Plastic and Docker :-)

 

Thank you!

 

Miguel

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...