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

Updating to base off of 'python:2.7.14-alpine3.6' instead of just 'alpine:3.6' #55

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bdlamprecht
Copy link

This is an update to both ansible-silo-base and ansible-silo.
I was having really weird issues getting the --bundle to work with certain python libraries as were described in issues #53 and #54.
Some minor enhancements that I made were the following:

  1. Due to the complexity of the command for installing the created bundle, several instructional lines were added to the build script so the user could easily copy / paste after the script ran.
  2. Similar to 1 above, I added the same type of lines to the Makefile for ansible-silo.
  3. Added a few additional libraries that I thought would be worthwhile for others such as bcrypt and napalm (for managing networking devices). That last requirement necessitated leaving pkgconf, libxml2, and libxslt around to connect to Juniper devices via junos-eznc. The additional space for this in ansible-silo-base is only an additional 29% (155MB for 2.0.1 and 201MB for 3.0.0). This size could be reduced further, but didn't want to spend time optimizing for diminishing returns unless it was a real issue.
  4. Added the option to install custom python libraries in the bundle if there was a requirements.txt file in the
  5. Probably something else, but don't recall at the moment.

This builds and runs just fine for me, but as you know Alpine Linux likes to not keep their libraries around for very long once a new version is released, so time is of the essence to get this merged if you approve of the changes.

@bdlamprecht
Copy link
Author

@udondan It looks like there might be a problem with your .travis.yml file when trying to install bats (0.4.0-1.1). Not sure how I can help resolve this issue.

Copy link
Collaborator

@udondan udondan left a comment

Choose a reason for hiding this comment

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

so time is of the essence to get this merged if you approve of the changes.

Yeaaaah, so... that didn't work out very well. :)

I looked at the PR when you sent it but because of the shuffling of all the packages in the base Dockerfile it was really really hard for me to see through. Then forgot to about it. Sorry.

I am about to work on a 3.0 release soonish. Before that I would like to complete this one to not completely make this PR unmergable and give you credit.

I'm happy to switch to the python-alpine based image and adding some commonly used python modules. But I added a couple of comments for other changes.

It looks like there might be a problem with your .travis.yml

Yeah, I got to look into that.


# Give the user a custom shell prompt
echo 'export PS1="[ansible-silo $SILO_VERSION|\w]\\$ "' > /home/user/.bashrc &&\

# Add alias for 'ls -l'
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer to not have this. Instead we should provide a way for the user to mount a custom profile so any alias, function or what not can be set up as required. Something for another PR I can take care of.


# Create directory for storing ssh ControlPath
mkdir -p /home/user/.ssh/tmp &&\
RUN mkdir -p /home/user/.ssh/tmp &&\
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe moving the lines around and splitting into separate layers was beneficial during development/experimenting to speed up builds. Is there a need for this to be merged? The number of layers should be as small as possible.

@echo " docker run --interactive --tty --rm --volume \"${HOME}/bin:/silo_install_path\" ${SILO_IMG}:${SILO_VERSION} --install"
@echo ""
@echo "To install '${SILO_IMG}:${SILO_VERSION}' for all users, run the following command:"
@echo " docker run --interactive --tty --rm --volume \"/usr/local/bin:/silo_install_path\" ${SILO_IMG}:${SILO_VERSION} --install"
Copy link
Collaborator

Choose a reason for hiding this comment

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

❤️


ansible-silo: validate-version
@docker build --build-arg "v=$(SILO_VERSION)" --tag "${SILO_IMG}:$(SILO_VERSION)" .
@echo ""
@echo "To install '${SILO_IMG}:${SILO_VERSION}' for just your user, run the following command:"
@echo " docker run --interactive --tty --rm --volume \"${HOME}/bin:/silo_install_path\" ${SILO_IMG}:${SILO_VERSION} --install"
Copy link
Collaborator

Choose a reason for hiding this comment

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

${HOME}

Should be

\$${HOME}

so the output would be

docker run --interactive --tty --rm --volume "${HOME}/bin:/silo_install_path" grpn/ansible-silo:3.0.0 --install

This way the user can easily copy and share the command.

pip install -r requirements.txt || exit
cd ..
fi

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is installing python modules on the host.

Shouldn't this be added to the Dockerfile of the bundle instead?

enum34==1.1.6\
idna==2.5\
ipaddress==1.0.18\
ncclient==0.5.3\
Copy link
Collaborator

Choose a reason for hiding this comment

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

ncclient Is missing now, which is used by many networking modules. #31

https://github.com/ansible/ansible/search?q=ncclient&unscoped_q=ncclient

pycparser==2.18\
pycrypto==2.6.1\
Copy link
Collaborator

Choose a reason for hiding this comment

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

pycrypto is missing.

@@ -127,7 +127,6 @@ RUN echo "@testing http://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/
isl\
libgomp\
libatomic\
pkgconf\
Copy link
Collaborator

Choose a reason for hiding this comment

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

If I understand correct this package is required, because you have junos-eznc in your bundles pip requirements and installing that requires pkgconf. Is that correct? Wouldn't it make more sense then to install it per the bundles Dockerfile?

sshpass=1.06-r0 &&\

# Install some required python modules which need compiling
apk add --no-cache gcc=6.3.0-r4\
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please keep this block as is. Ideally this apk command would create a virtual package, which later in the Dockerfile can be deleted. This is just not implemented as it was not working together with version pinning at the time of writing. See gliderlabs/docker-alpine#205

RUN echo "@testing http://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories

# Install common libraries
RUN apk add --no-cache libssl1.0==1.0.2n-r0\
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please restore original grouping. This makes it really hard to review. Some packages have been removed, some have been added, required version upgrades - but everything has been shuffled so it is really hard to see what actually happened and for what reason.

@bdlamprecht
Copy link
Author

Yeah, I don't really care about getting credit, I just had to make the changes I did to get the silo working for my project. I can resolve all of the issues which you brought up, but since it:

  1. Has been so long and most likely all of the packages have once again been changed
  2. Is your project which I just "commandeered" for my use

and

  1. You know the intricacies of what you had working more so than me

Why don't you go ahead and make the changes you'd like.
Let me know when I can cancel this PR.
Also, I'd be happy to help you test your version of the ansible-silo 3.0.0 release.

Does that work for you?

@udondan
Copy link
Collaborator

udondan commented Jun 8, 2018

Hi Brady,

sure, I'll take care of that. I'll make sure to switch to the python-alpine image and add the packages of your PR.

Thanks,
Daniel

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

Successfully merging this pull request may close these issues.

2 participants