-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Dockerized version of the application #66
base: master
Are you sure you want to change the base?
Conversation
…npm run all and npm cmds
@kvirani can you take a look at this and weigh in on whether this should be closed or merged? |
@FrancisBourgouin would love your input into this given that you're working on new vagrant and WSL2 images. @misterhtmlcss is there a lot of startup issues with this app? Why would it not be launchable with the traditional non-containerized approach? |
Hi @kvirani, I don't know what else is going on, so it's hard to say with absolute certainty that my approach is better, but I'll layout my thoughts. Also I'll pull @geeklady2 (Shannon) into this too as she has her own separate experiences from my own with Docker. Straight up, I have had issues with every project and in some cases it's been a consistent and growing problem. I hope you don't mind itemized form; just makes it easier for me to express my thoughts. General Reasons for Docker and why I did this test project as a showcase:
|
I'd just like to weigh in here with my 2 cents: From my own corner of the industry, it seems like Vagrant never really "caught on" that much. It seemed to have been mostly popular with the Ruby folks, but outside that I haven't seen it much. I have had exactly 0 clients using it. By contrast, Docker is massively popular, and seems to hover at around 50% of my clients either using it or thinking about using it. I think Docker skills would be much more valuable to our students than Vagrant skills. I'd argue for dropping Vagrant in the first few weeks & going with natively-installed node via nvm, up until Tweeter, where I'd introduce Docker. Jungle could probably still be distributed as a Vagrant project (the concept would hopefully be easily understood by then). Regarding actual consumption of a Docker-based project, it's indeed just cloning a repo, maybe setting up environment variables (for API keys & other secrets if applicable) and running Of course, this is my own personal experience, from my own personal corner of the industry (React & node Web dev). |
|
||
|
||
COPY package*.json ./ | ||
RUN npm install --silent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd run npm ci
here instead; it'll install exactly the versions used in package-lock.json.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great point Emile.
COPY package*.json ./ | ||
RUN npm install --silent | ||
|
||
COPY . ./ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way I usually do this step is by individually copying the relevant top-level files or directories. In this case, it'll probably cause problems if the student did an "npm install" before building the image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give me a more specific suggestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we only need public
and server
in this case, so I'd do:
COPY ./public ./public
COPY ./server ./server
- "3000:3000" | ||
volumes: | ||
- .:/src/app | ||
- /src/app/node_modules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why you make node_modules a volume?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like all things weird I had a problem once and it was a while ago and it fixed it. Sometimes when I copy and paste across most of my existing processes I forget to delete something. Thanks for pointing this out.
"docker:init": "docker-compose up --build --force-recreate", | ||
"docker:start": "docker-compose start", | ||
"docker:halt": "docker-compose stop", | ||
"docker:destroy": "docker-compose down -v" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd probably just add these commands to the readme, so the students get familiar with them. npm run docker:halt" is arguably harder to remember than
docker-compose stop`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually put halt
because it's the word they are familiar with from Vagrant. I use stop, but I'm indifferent on this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point; I think it's a good idea for the transition, but if we go all-in on Docker, it'll be better to use the Docker terms from the start.
dockerfile: Dockerfile | ||
ports: | ||
- "5000:5000" | ||
- "3000:3000" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why port 3000?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quoted from above: Like all things weird I had a problem once and it was a while ago and it fixed it. Sometimes when I copy and paste across most of my existing processes I forget to delete something. Thanks for pointing this out.
Also I just wrote this quickly. I never thought it would go to production as is, so no judging please ;)
Consider this just a quick and dirty draft that I put out there and I'm happy to update it and make it final after I hear there is appetite for this kind of change to our way of doing things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem! That's why we do code reviews ;)
I'm on board with all of these comments. I've never encountered vagrant in the workplace, but then I'm not a Ruby developer. However, I have encountered docker a fair amount and have had no issues with getting it going on Windows, linux, or Mac. It is quite likely students will encounter docker in their career. I have literally spent hours diagnosing system issues, which from what I can see is due to incompatibilities in libraries between projects and expecting mentors to know all of this when working in silos and in some cases only 3 hours a week is in my opinion asking too much. Docker is one solution to this issue, another would be to provide to each mentor a list of common issues for each project and the solution (this will need to be updated regularly. The docker solution would allow the project to be out-dated, or use the latest tools without causing issues with the other projects. LHL can keep a docker registry (https://docs.docker.com/registry/) which you can think of as version control for docker. If the latest updates don't work, students can pull the previous docker version. There are issues with keeping software up-to-date in the docker containers and application secure and safe, but in this case that's a low priority. |
Also based on the slack convo, I also think that @jensen would like to probably have a iron in this fire. Jensen I leave it with you to voice as wish. I won't prod you further :) |
Thanks for the invite, although I think Docker is a great tool which I use for my own projects, I don't believe it will solve our problems here. I'll leave it up to you to discuss and change if you wish. |
Purpose:
Reduce tech support for when students launch this application inside of Vagrant/host system.
Updates:
Gaps:
Suggestions/Next steps
npm start
. This can be done with an ENV, but I didn't do it.