Differences between revisions 1 and 22 (spanning 21 versions)
Revision 1 as of 2015-04-16 01:58:50
Size: 1128
Editor: terri
Comment: initial attempt at dockerfile. I'd be surprised if this one will work, just saving so I have a baseline.
Revision 22 as of 2016-03-03 12:30:41
Size: 3100
Editor: SimonHanna
Comment: update a couple of instructions
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
This is a scratchpad for a Dockerfile: This page is a scratchpad for Terri's Dockerfile, which sets up a very default version of Mailman in your container so that you can try out Mailman 3 suite. Suggestions and instructions for use welcome!
Line 3: Line 3:
== Prerequisites ==

To use this, you will need to have [[https://www.docker.com/|Docker]] set up. They have [[https://docs.docker.com/installation/#installation|docker setup instructions for many different platforms]]

== The Mailman 3 Suite Dockerfile ==
Line 4: Line 9:
Line 5: Line 11:
# Dockerfile to setup GNU Mailman Suite  # Dockerfile to setup GNU Mailman Suite
Line 15: Line 21:
RUN apt-get update
RUN apt-get install bzr python3-dev python3-pip python-dev python-pip python-virtualenv
RUN apt-get update && \
    apt-get install -y git python3-dev python3-pip python-dev python-pip python-virtualenv
Line 19: Line 25:
RUN apt-get install nodejs npm
RUN npm install -g less
RUN ln -s /usr/bin/nodejs /usr/bin/node
RUN apt-get install -y nodejs npm && \
    npm install -g less && \
    ln -s /usr/bin/nodejs /usr/bin/node
Line 27: Line 33:
RUN bzr branch lp:mailman-bundler RUN git clone https://gitlab.com/mailman/mailman-bundler.git
Line 36: Line 42:
RUN source venv/bin/activate RUN . venv/bin/activate
Line 39: Line 45:
EXPOSE 80 EXPOSE 8000
Line 45: Line 51:
RUN ./bin/mailman-web-django-admin runserver &
# This sets the django webserver up to not only run, but binds it to all interfaces, port 8000
ENTRYPOINT ./bin/mailman-web-django-admin runserver 0.0.0.0:8000
}}}

== Building the docker image ==

Copy the content above into a file named `Dockerfile` in a directory, and then run the following command:

{{{
sudo docker build -t mailman3 .
}}}

This will take some time to build a docker image with the required steps.

== Starting the container and mailman3 suite ==

Run this to start the newly built Mailman docker container:

{{{
sudo docker run -P mailman3
}}}

Then find out the container id by following command

{{{
sudo docker ps
}}}

The `-P` option exposes the Django port inside the container to localhost on a random port. To find this port do:

{{{
sudo docker ps
}}}

and look under the `PORTS` column. For example, if you see:

{{{
$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fa17316ce2d5 mailman3:latest "/bin/sh -c './bin/m 3 minutes ago Up 3 minutes 0.0.0.0:49153->8000/tcp ecstatic_mestorf
}}}

You should now be able to open `http://localhost:49153` and get to the !HyperKitty web page.


{{{#!wiki caution
'''Mac OS X users'''

The container seems to run without incident on MacOS X, but you can't seem to access it from a local browser for some reason. If anyone can help debug this, we would very much appreciate help!
}}}

This page is a scratchpad for Terri's Dockerfile, which sets up a very default version of Mailman in your container so that you can try out Mailman 3 suite. Suggestions and instructions for use welcome!

Prerequisites

To use this, you will need to have Docker set up. They have docker setup instructions for many different platforms

The Mailman 3 Suite Dockerfile

#########################################
# Dockerfile to setup GNU Mailman Suite
# Based on Ubuntu
#########################################
# Set the base image to Ubuntu
FROM ubuntu

# File Author / Maintainer
MAINTAINER Terri Oda

# Update the sources and install some basic python stuff
RUN apt-get update && \
    apt-get install -y git python3-dev python3-pip python-dev python-pip python-virtualenv

# Get the nodejs stuff
RUN apt-get install -y nodejs npm && \
    npm install -g less && \
    ln -s /usr/bin/nodejs /usr/bin/node

# Set the default directory where CMD will execute
WORKDIR /mailman3

# Get Mailman Bundler
RUN git clone https://gitlab.com/mailman/mailman-bundler.git

# Get buildout, go into Mailman Bundler and build
RUN pip install zc.buildout
WORKDIR /mailman3/mailman-bundler
RUN buildout

# Set up virtualenv
RUN virtualenv venv
RUN . venv/bin/activate

# Expose ports
EXPOSE 8000

# Prep some stuff
RUN ./bin/mailman-post-update
RUN ./bin/mailman-web-django-admin createsuperuser
RUN ./bin/mailman start

# This sets the django webserver up to not only run, but binds it to all interfaces, port 8000
ENTRYPOINT ./bin/mailman-web-django-admin runserver 0.0.0.0:8000 

Building the docker image

Copy the content above into a file named Dockerfile in a directory, and then run the following command:

sudo docker build -t mailman3 .

This will take some time to build a docker image with the required steps.

Starting the container and mailman3 suite

Run this to start the newly built Mailman docker container:

sudo docker run -P mailman3

Then find out the container id by following command

sudo docker ps

The -P option exposes the Django port inside the container to localhost on a random port. To find this port do:

sudo docker ps

and look under the PORTS column. For example, if you see:

$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS              PORTS                     NAMES
fa17316ce2d5        mailman3:latest     "/bin/sh -c './bin/m   3 minutes ago       Up 3 minutes        0.0.0.0:49153->8000/tcp   ecstatic_mestorf    

You should now be able to open http://localhost:49153 and get to the HyperKitty web page.

Mac OS X users

The container seems to run without incident on MacOS X, but you can't seem to access it from a local browser for some reason. If anyone can help debug this, we would very much appreciate help!

MailmanWiki: DEV/Mailman 3.0/Mailman 3.0 Suite Dockerfile (last edited 2016-03-03 12:30:41 by SimonHanna)