theycallmemac / odin

A programmable, observable and distributed job orchestration system.
MIT License
471 stars 20 forks source link

[Feature Request] Provide Docker images #49

Open TylorS opened 4 years ago

TylorS commented 4 years ago

Is your feature request related to a problem? Please describe. Not a problem per se, but just a thought for lowering the barrier to entry.

Describe the solution you'd like It'd be convenient to publish a docker image for Odin that can be used for easy deployments and quick installation. Perhaps even a docker-compose.yml could be added to the repository to facilitate setting up Odin + the communication with Mongo and later on for other databases that are supported.

Describe alternatives you've considered Not much at this time

Additional context Not much at this time

TylorS commented 4 years ago

I had a whirl at spinning things up with Docker..but I believe the issue comes from the makefile being tied to systemd which is not available within the docker images for ubuntu as Docker is about process isolation and not OS virtualization.

The specific error is

System has not been booted with systemd as init system (PID 1). Can't operate.

Here's the Dockerfile I was attempting to create

FROM ubuntu:18.04

WORKDIR /odin
COPY . /odin

# Get some prerequisites
RUN apt-get update
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y tzdata wget build-essential sudo apt-utils systemd

# Install Go
RUN wget -c https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
ENV PATH=$PATH:/usr/local/go/bin
RUN go version

# Build Odin
ENV ODIN_EXEC_ENV True
ENV ODIN_MONGODB "mongodb://localhost:27017"
RUN make

# Make sure odin's running
CMD systemctl status odin
theycallmemac commented 4 years ago

Originally working on this project I aimed to provide Docker images, I also ran into the issue of systemd.

ylmcc commented 3 years ago

After some googling and tinkering with the build file in this thread I was able to get the container to build however I have yet to launch it

I came across this website which I changed systemctl status odin to /etc/init.d/odin status.

After building the image after a countless amount of times I was greeted with:

Step 15/15 : CMD ["/etc/init.d/odin", "status"]---> Running in 64903e04830c  
Removing intermediate container 64903e04830c ---> 7e7c90c5d81d  
Successfully built 7e7c90c5d81d  

Dockerfile as follows:

FROM ubuntu:18.04
LABEL author="Kyle McCann <ylmcc@redbrick.dcu.ie>"

WORKDIR /home/kyle/testing
COPY . /odin-testing

# Get some prerequisites
RUN apt-get update
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y tzdata wget build-essential sudo apt-utils systemd

# Install Go
RUN wget -c https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
ENV PATH=$PATH:/usr/local/go/bin
RUN go version

# Build Odin
ENV ODIN_EXEC_ENV True
ENV ODIN_MONGODB "mongodb://localhost:27017"
RUN ls /odin-testing
RUN sudo make /odin-testing

VOLUME ["/home/kyle/testing/"]
CMD ["/etc/init.d/odin", "status"]

(Sorry if my formatting is awful, first time commenting on an issue.)

theycallmemac commented 3 years ago

No worries on the formatting. I can take some time to run this, if it's building I think you're good to open a PR on this and reference this issue. Once you've done that I can take time to test it out 💯