Deploying a Rails Application with Docker

  Рет қаралды 23,121

CoderJourney

CoderJourney

Күн бұрын

Пікірлер: 49
@Osteele
@Osteele 8 жыл бұрын
What I really liked about the this video is that it was very "Real World" Errors and all. Thank you so much for sharing your time and knowledge. Much appreciated.
@Coderjourney
@Coderjourney 8 жыл бұрын
I'm glad you liked it. I do a dry-run for these tutorials and if I hit something that I think is a good education point then I will plan to hit the error, other times errors just happen while I'm recording and I think it's good to humanize the process. This particular one had a few of both :)
@jmares93
@jmares93 7 жыл бұрын
completely agree. I was struggling to get a docker-compose deployment and only after hours of scouring tutorials did I come across this video that explained the problem with using volumes on production. You really made my day man.
@Coderjourney
@Coderjourney 7 жыл бұрын
+Jonathan Mares awesome, I'm glad this was what you were looking for.
@Norm7264
@Norm7264 7 жыл бұрын
Many thanks for this excellent tutorial. At the end of the video you say "don't get me wrong in thinking that this is an actual good deployment... there's a lot more that we should have done...". My suggestion for another video would be to flesh out some of the details that have been skipped here, but which are essential for a "real world" docker/rails deployment.
@Coderjourney
@Coderjourney 7 жыл бұрын
The end of my rails tutorial covers one way of doing an improved deployment. Take a look at that series to see some next steps (adds nginx, asset precompilation, etc).
@hafizullahqasemi7332
@hafizullahqasemi7332 5 жыл бұрын
Really great series of videos, helps really for someone like who's new to docker :)), but can you do one more video about like a real world production, as you mention at the end of the video...
@queuebit
@queuebit 8 жыл бұрын
I still really love these videos. Thanks!
@Coderjourney
@Coderjourney 8 жыл бұрын
I'm glad you like them. I have a few more to release that I think will be really helpful.
@muhammadehsanulhaq8573
@muhammadehsanulhaq8573 7 жыл бұрын
Gave a thumbs up for the intro.
@Coderjourney
@Coderjourney 7 жыл бұрын
Thank you.
@sergevinogradoff6024
@sergevinogradoff6024 3 жыл бұрын
following step by step for the 3rd time. Failed. "ActiveRecord::NoDatabaseError: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?" I guess it's time to look for a 2021 tutorial.
@pging8328
@pging8328 2 жыл бұрын
LOL managing secrets is very important thing - perhaps the most important. Any advice on how to manage that? IT would be like teaching folks how to fly a plane and then skipping lessons about how to land it safely ( 'guys this is a demo - obviously, you wouldn't crash plane into the ground IRL') I appreciate the tutorial, nonetheless :)
@UnitedLionForPeace
@UnitedLionForPeace 6 жыл бұрын
Thanks CoderJourney this is a very clear tutorial, I was looking for deployment of a dockerized flask application with nginx and gunicorn. Can't really find a good one. Maybe you know some good tutorials on how to deploy flask apps with postgres using docker? Exact the same way you do but a flask app? Thanks in advance!
@gioivanmaniego301
@gioivanmaniego301 4 жыл бұрын
How can i change port number to 8080?
@joannamaysa1897
@joannamaysa1897 7 жыл бұрын
Hello! Good stuff! Could you continue on making more videos about Docker, f.e how better deploy to DigitalOcean and so far. Thanks in advance!
@Coderjourney
@Coderjourney 7 жыл бұрын
+joanna małysa I'll see what I can do.
@ThesamBETH
@ThesamBETH 6 жыл бұрын
What if I want to deploy the app on a company apache server which is not digital ocean or aws. How do I use docker machine to work with that?
@Coderjourney
@Coderjourney 6 жыл бұрын
Have a look at the “Generic” docker machine driver that works using SSH. docs.docker.com/machine/drivers/generic/
@yevheniikovalenko4637
@yevheniikovalenko4637 6 жыл бұрын
Guys does anyone faced problem like this? ( SSL error: HTTPSConnectionPool ) after im trying to do docker-compose up -d
@kojie333
@kojie333 8 жыл бұрын
trying to run this locally and i still get the /usr/src/app/Gemfile not found .. ?
@Coderjourney
@Coderjourney 8 жыл бұрын
+Ryan Clemente what command are you running that's giving you that output?
@kojie333
@kojie333 8 жыл бұрын
CoderJourney docker-compose up .... when I comment out the volumes in docker-compose.yml it runs
@Coderjourney
@Coderjourney 8 жыл бұрын
Have you already run `eval $(docker-machine env MACHINE_NAME)`. Trying to share code locally into a volume on a remote Docker host doesn't work. If the docker host is local though, then the directory you're in isn't set up to be shared onto the Docker host. In that case you'll need to go into the Docker for Mac/Windows preferences and make sure that your project is in a child directory of one of the ones mentioned in the "File Sharing" section.
@kojie333
@kojie333 8 жыл бұрын
CoderJourney will try that. Weird that everything works in my other MacBook
@Coderjourney
@Coderjourney 8 жыл бұрын
Hi! Your problem likely isn't with file permissions. Are you using a docker-compose file that doesn't have the volume sharing? You can't share your local directory into a container that is running on a remote host. Make sure that the docker-compose.yml file that you're using for deployment doesn't contain any lines like: volumes: - .:/usr/src/app
@SaladoElFede
@SaladoElFede 6 жыл бұрын
But this method involves outage deployments, how would you handle a zero-downtime approach?
@Coderjourney
@Coderjourney 6 жыл бұрын
Use a blue green deployment approach (martinfowler.com/bliki/BlueGreenDeployment.html). Most people can afford 1-2 seconds of downtime if we’re being honest.
@SaladoElFede
@SaladoElFede 6 жыл бұрын
I totally agree with that! This video has been really helpful! I just didn't have any idea how "bad" could be this approach in terms of down-times, because I didn't try it yet. I'm just starting to work with cloud services and I find it really difficult to implement a cheap way to host this kind of multi-service apps with docker. The approach suggested by the link you've shared is not really cheap. You need multiple droplets and a load balancer. It would be cool to learn how to do everything inside the same droplet, with some automation scripts and nginx for small apps. Probably using docker swarm / docker stack / or even docker-compose with scalability of services for blue/green deployments
@Coderjourney
@Coderjourney 6 жыл бұрын
You can do blue green deployments on the same machine running multiple containers of the same image behind a load balancer (NGINX or HAProxy). It does get a little cumbersome, but I’ve done this in production without much issue besides Docker’s networking flaking our a bit. You might consider looking into Kubernetes for container orchestration, won’t be any cheaper, but if you’re going to spin up multiple modes at the same time it will make things easier. Another alternative that I’m digging into more is using Habitat, but I haven’t learned enough to really comment on it (still experimenting).
@SaladoElFede
@SaladoElFede 6 жыл бұрын
Makes sense. Thank you! This video has helped me a lot, I'm almost ready to start trying out my prod env, just one more thing... Download source and build images in the server, or download the latest image (built somewhere else) and just mount it in the server? The first approach would save bandwidth, but consume quite a lot of resources (ram and cpu). What do you suggest? It could be a good video about docker in production, best practices, costs, etc...
@Coderjourney
@Coderjourney 6 жыл бұрын
I’m glad you’ve found this helpful. Normally, you’d have a machine in a continuous integration setup build the image and push to a registry and then have your production server pull it down and start a new container with that image. With that approach your production machine doesn’t really need to install much other than Docker.
@umairmunir1295
@umairmunir1295 7 жыл бұрын
whenever i run this command to create and migrate database ✗ docker-compose -f docker-compose.prod.yml run --rm app rake db:create db:migrate ----------------------- It shows the following error. ----------------------- PG::ConnectionBad: could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432? ----------------------- I have tried a lot but unable to find what is actually wrong there. Can you please help me in this?
@Coderjourney
@Coderjourney 7 жыл бұрын
+umair munir it looks like your .env file is missing the POSTGRES_HOST value (should be set to 'db')
@umairmunir1295
@umairmunir1295 7 жыл бұрын
Thanks a lot, It worked for me. I am facing one more issue. I ran the server from my local system It was working fine before but now when i try to tun server systems says that app_1 | A server is already running. Check /usr/src/app/tmp/pids/server.pid. app_1 | => Booting WEBrick app_1 | => Rails 4.2.6 application starting in production on 0.0.0.0:3000 app_1 | => Run `rails server -h` for more startup options app_1 | => Ctrl-C to shutdown server app_1 | Exiting how can I handle this issue? because I have to build image multiple times in future and re-run the server. And, How can we run server id daemon? Please help me in this.
@Coderjourney
@Coderjourney 7 жыл бұрын
This is fixed in a later tutorial, take a look at this commit for a way to get around it: github.com/coderjourney/meal_plan/commit/11c5fdb138fcb9e76270c6f93dfbc160b96c2bca
@Coderjourney
@Coderjourney 7 жыл бұрын
Make sure that you `chmod +x` the script
@umairmunir1295
@umairmunir1295 7 жыл бұрын
Thanks Man, You are the best. (y)
@mass13982
@mass13982 8 жыл бұрын
Dude....you're awesome :)
@Coderjourney
@Coderjourney 8 жыл бұрын
+moeabdol thanks man! If you liked this one we actually dig a little deeper in the tutorial for this week kzbin.info/www/bejne/g4vWZoyQe6eji6s and we will be putting some more on top next week.
@joseesteves1247
@joseesteves1247 6 жыл бұрын
Thanks, great video!
@Coderjourney
@Coderjourney 6 жыл бұрын
Thanks, I’m glad you liked it.
@MOOnLight2k
@MOOnLight2k 5 жыл бұрын
If you watch this in the yer 2019 then you should make those changes to your prod file to make magic happen. app: environment: RAILS_LOG_TO_STDOUT: "true" tty: true stdin_open: false Then you should also do something with your assets on build
Dockerizing an Existing Rails Application
20:53
CoderJourney
Рет қаралды 27 М.
Deploy Rails 7.1 To AWS With Docker And Nginx!
22:11
Deanin
Рет қаралды 18 М.
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
Learn to use Docker in Development - Part 1
15:52
CoderJourney
Рет қаралды 44 М.
Deploy Ruby on Rails To Production in 2019
32:39
GoRails
Рет қаралды 43 М.
18 Weird and Wonderful ways I use Docker
26:18
NetworkChuck
Рет қаралды 477 М.
docker stack is my new favorite way to deploy to a VPS
27:47
Dreams of Code
Рет қаралды 149 М.
Docker Basics for Ruby on Rails Developers
13:27
GoRails
Рет қаралды 27 М.
Dockerizing a Rails Development Environment - Demo
51:30
Dev Edmonton
Рет қаралды 6 М.
Web Server Concepts and Examples
19:40
WebConcepts
Рет қаралды 270 М.
Ruby On Rails 7.1 Production Deploy Speedrun
11:14
Deanin
Рет қаралды 6 М.
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН