Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental: CentOS base container #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lukepatrick
Copy link

Experimental PR: Do not merge! This is an experimental release of the CentOS container. The container is not guaranteed to be in a stable condition.

This is a fork off of the the StackStorm container (https://github.com/StackStorm/st2-dockerfiles) to change the OS to CentOS instead of Ubuntu. It fixes the systemd errors associated with a CentOS container and runs the container in a non-privileged environment.

Please review and critique - any feedback welcome

Copy link
Member

@arm4b arm4b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sharing the experimental CentOS8 StackStorm Docker image!
A lot of interesting work in there 👍

While we can't merge it yet while relying on the Ubuntu images everywhere,
I hope more people would find it interesting too or may even provide their feedback ℹ️

Comment on lines +30 to +42
## Installs Python3.7 from source - this is for running Packs with Python other than 3.6
RUN wget https://www.python.org/ftp/python/3.7.6/Python-3.7.6.tar.xz \
&& tar -xf ./Python-3.7.6.tar.xz \
&& cd ./Python-3.7.6 \
&& ./configure \
--enable-optimizations \
--with-ensurepip=install \
# --enable-loadable-sqlite-extensions \
# --enable-shared \
# --with-system-expat \
# --with-system-ffi \
&& make -j "$(nproc)" \
&& cd ..
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI Python 3.7 is not supported by stackstorm, not sure how it behaves even for packs
as we test with python 3.6 and 3.8.

I undersand this happens because there is no py3.6+ in EL8 package available, but building python from sources might be a non-stable approach in this scenario.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could really be any version of python. We have been running a separate python since early stackstorm at py2.x; so we built our packs with the 'major' python version at the time, py3.7.

though stackstorm itself runs with the py3.6 that the rpm installs with it.

yes, it would be great if there were updated EL8 packages for python (3.7, 3.8, etc...)


services:
stackstorm:
image: stackstorm/st2/all-in-one-st2:3.5.0-1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI we moved away from all-in-one Docker image with systemd and multiple processes inside sometime in the 2019 https://hub.docker.com/r/stackstorm/stackstorm

Won't go that path anymore as current st2-dockerfiles aligns with the docker practices running and configuring one service per container and avoiding systemd.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could easily configure this docker-compose like we do with kubernetes, running one container per service. We typically use the docker-compose for local development of packs, one stackstorm container is 'good enough' for us..

Comment on lines +50 to +54
healthcheck:
test: echo 'db.stats().ok' | mongo --quiet
interval: 5s
timeout: 5s
retries: 5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +24 to +29
### systemd fix
There are four fixes to allowing systemd to work inside a container.
1. Mounting /run as a tmpfs
2. Mounting the /sys/fs/cgroup as a read-only volume inside the Container
3. Removing all default systemd wants and only enabling services necessary to the application
4. Entrypoint is /sbin/init
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good info, very helpful to have it all together 👍

In the past, we tried to avoid this path as cgroup mounting is not always an option for the broader use.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

appreciate the comments; I am not beholden to this approach, this is just what we figured out that worked. Open to better ideas.


# Creates stanley user
RUN mkdir -p /home/stanley/.ssh && chmod 0700 /home/stanley/.ssh \
&& ssh-keygen -f /home/stanley/.ssh/stanley_rsa -P "" \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note that generating SSH key for stanley and bundle it in a Docker image would be a dangerous way.
Though fine for a demo image.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, should do this in a separate built process

Comment on lines +22 to +27
## Experimental
Dockerfiles to build and push CentOS/RPM based Stackstorm images

This builds a "all-in-one" container. Services can be started/stopped for each Stackstorm component.

This is initially for review, discussion, and verifying an alternative pathway.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI for someone who wants to try it or may need CentOS8 Docker images and provide feedback ℹ️

RUN mkdir /opt/stackstorm/packs.dev

# Update oslo/crudini
RUN source /opt/stackstorm/st2/bin/activate && pip install --upgrade oslo.config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any more context behind updating the oslo.config?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we needed this for crudini; I'll check again...

## Known Issues

## Kubernetes Deployments
Below are Helm Chart snippets to run this container
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's nice to have some K8s hints!

@@ -0,0 +1,112 @@
version: '3'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI we keep the Dockerfiles only in this repo.
And so the docker-compose deployment resides in https://github.com/stackStorm/st2-docker and K8s deployment in: https://github.com/stackStorm/stackstorm-ha

But for the feedback/demo purposes this PR includes all the deployment configuration as well from my understanding.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed; if this PR makes it beyond an experiment, I can work on separating out the other bits.

@lukepatrick
Copy link
Author

Thank you @armab for taking the time to review, I appreciate your comments.

@CLAassistant
Copy link

CLAassistant commented May 11, 2022

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants