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

Enable Docker for demoing purposes #3106

Merged
merged 1 commit into from
Mar 15, 2019
Merged

Conversation

kinduff
Copy link
Contributor

@kinduff kinduff commented Feb 16, 2019

Description
Enables Solidus to be ran using Docker for demoing purposes. This provides an easy way for newcomers to test the storefront out without going through the install process and avoiding a Heroku deployment.

Ref #3103

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)

How to test it out:
As the README states, just run the following command to download the image and run it at http://localhost:3000.

docker run --rm -it -p 3000:3000 kinduff/solidus-demo:latest

The admin can be found at http://localhost:3000/admin/, credentials are [email protected] and test123.

Notes & Questions:
This PR is not ready to be merged since I pushed the Docker image to my own Dockerhub account.

Wanted to submit and ask before adding more work into this if it would be worth to create some sort of Rake task to generate an image for each of the existing versions or just rely on master.

Also to ask if anyone has insights about how to automate this with Circle CI and have an up to date image everytime there's a change.

@kennyadsl
Copy link
Member

@kinduff thanks for the contribution. My first thought has been that I don't want to maintain this Docker Demo feature, mostly because I don't have a lot of experience with Docker and there's no way to know if it's still working for all solidus features (eg. file upload or other things which could depend on the system). On the other end, the same could happen (and happens often) with Heroku. For sure we'll talk about this on the next Core Team meeting.

@dhonig
Copy link

dhonig commented Feb 18, 2019

+1 for docker.
It opens up lots of cloud platforms. Maintenance shouldn’t be too hard. Ill be glad to help

@kennyadsl
Copy link
Member

Also to ask if anyone has insights about how to automate this with Circle CI and have an up to date image everytime there's a change.

@kinduff maybe a GitHub Action?

@aitbw
Copy link
Contributor

aitbw commented Feb 19, 2019

Hi @kinduff, thanks a lot for PR. I have a few improvements / questions on this:

  • I think the Dockerfile is still missing some essential packages, such as postgresql-client and imagemagick —I think we should add them in order to provide a seamless Docker experience

  • I'm no Docker expert, but I think we should be using docker compose to handle database responsabilities. What do you think?

  • Does this work without any extra configuration on Solidus?

  • The last time I worked with Docker, when we ran the commands to build the container, Docker did not respect the files' ownership —this means we had to use sudo for every command every time we were not using Docker, which was very annoying. Is this the case here? If so, can we think of a solution?

  • Does the full spec suite runs green without any extra configuration? I remember the --no-sandbox flag had to be included to the Headless Chrome setup under Docker containers.

Let me know what you think! 🤗

@kinduff
Copy link
Contributor Author

kinduff commented Feb 19, 2019

Thanks for your input @aitbw, I'm quoting and responding.

I think the Dockerfile is still missing some essential packages, such as postgresql-client and imagemagick —I think we should add them in order to provide a seamless Docker experience

imagemagick is already installed. I'm not sure about postgresql-client since by default sandbox environment is using sqlite, so for a demo purposes it works well.

I'm no Docker expert, but I think we should be using docker compose to handle database responsabilities. What do you think?

I'm all in with docker-compose files, but since this is a demo just to run and see Solidus, I think we should treat it as is, since it's using sqlite. If we want to provide the developers a Docker guidance, as an official way to setup the project - for dev, staging and production, I can help with that.

Does this work without any extra configuration on Solidus?

Works with Solidus out of the box, since it's just a demo meant to be ran in local and not a development platform.

The last time I worked with Docker, when we ran the commands to build the container, Docker did not respect the files' ownership —this means we had to use sudo for every command every time we were not using Docker, which was very annoying. Is this the case here? If so, can we think of a solution?

It's not the case since it's using a sandbox user to lock it out, since the owner of the app is this user, you don't need sudo. If you need to /bin/bash into containers to modify things, then the setup for Docker and the application is not set correctly.

Does the full spec suite runs green without any extra configuration? I remember the --no-sandbox flag had to be included to the Headless Chrome setup under Docker containers.

I'm working on adjustments to enable the tests suits on this image related to chromedriver, it's necessary but it's shouldn't be a blocker since it doesn't break the backend/frontend demo as this image is intended to provide.

@aitbw
Copy link
Contributor

aitbw commented Feb 20, 2019

Hey @kinduff, thanks for the answers! Just one question:

imagemagick is already installed. I'm not sure about postgresql-client since by default sandbox environment is using sqlite, so for a demo purposes it works well.

Are you sure about this? Because on the last project I worked on, we had to install imagemagick when building the container.

@kinduff
Copy link
Contributor Author

kinduff commented Feb 20, 2019

Are you sure about this? Because on the last project I worked on, we had to install imagemagick when building the container.

Yes @aitbw, give it a try:

docker run --rm -it kinduff/solidus-demo:latest convert --version

Should output:

Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP 
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib

I also updated the README to point to the correct image, sorry about that. You should be able to run it too as a demo server.

@kennyadsl
Copy link
Member

In the last Core Team meeting, we had a chat about this and we are ok with this PR if the image is hosted on a Solidus Docker Hub account. There's an existing solidusio org on Docker Hub, trying to understand who created that.

@kinduff
Copy link
Contributor Author

kinduff commented Feb 25, 2019

@kennyadsl That's awesome. Let me know how I can help or if I can be added as a collaborator 👍

@dhonig
Copy link

dhonig commented Feb 25, 2019 via email

Copy link
Contributor

@jacobherrington jacobherrington 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 this idea @kinduff! 🙏

I'm all for dockerizing the demo, it increases our portability. After discussing this with the rest of the core team, I have two changes I'd like to see:

  1. Inidicating that the Dockerfile is ONLY for the demo in a more obvious way, not for developing against or deploying Solidus itself. I am all for the comment you've put in the Dockerfile. Because renaming a Dockerfile is not the best idea, this actually leads to my second ask.

  2. Can we move the Dockerfile to the monorepo's lib folder? This is where sandbox.sh already lives. This might also achieve the first ask if we create another directory (e.g. lib/demo/Dockerfile). What do you think?

Dockerfile Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@kinduff
Copy link
Contributor Author

kinduff commented Feb 27, 2019

@jacobherrington I ❤️ your suggestions. I was thinking to use a namespace like Dockerfile.demo but your lib suggestion sounds way better. I'll address these changes in a bit, and also the changes on the README file.

@kinduff
Copy link
Contributor Author

kinduff commented Mar 6, 2019

@jacobherrington Just pushed the latest updates by your request. How do you think we could push this demo image to the official Solidus Dockerhub?

docker-entrypoint.sh Outdated Show resolved Hide resolved
@kinduff
Copy link
Contributor Author

kinduff commented Mar 11, 2019

Looks like everything is set up, we're just missing to have the docker image in the official Dockerhub account.

@kennyadsl
Copy link
Member

@kinduff great, thanks. I've opened a support ticket on DockerHub to understand how we could get the solidusio or solidus organization ownership, which already exist but no one seems to have created.

In the meantime, maybe you could rebase the PR since I think one single, well-documented commit in enough for this change, thanks!

@kinduff kinduff force-pushed the docker_demo branch 2 times, most recently from fdcf224 to 84d30a6 Compare March 13, 2019 16:30
This commit adds a Dockerfile and entrypoint in
the lib/demo folder, as well as useful documentation
in the README file.

This demo allows users to test out the latest version
of solidus using Docker locally. This setup is very
flexible and provides another option besides using
Heroku or manually installing everything.
@kennyadsl
Copy link
Member

Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

Thanks, @kinduff!

@tvdeyen
Copy link
Member

tvdeyen commented Mar 14, 2019

🎉

The correct link https://hub.docker.com/r/solidusio/solidus-demo

Copy link
Contributor

@jacobherrington jacobherrington left a comment

Choose a reason for hiding this comment

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

Thanks @kinduff, excited to see this get merged. 👍

@dhonig
Copy link

dhonig commented Mar 14, 2019

Nice work all!

If there is interest in a development setup I would be happy to donate that.

@kennyadsl kennyadsl changed the title Docker Demo Enable Docker for demoing purposes Mar 15, 2019
@kennyadsl kennyadsl merged commit 4d968a1 into solidusio:master Mar 15, 2019
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.

6 participants