How to automate git -> production

Hi guys, I'm reading a lot about docker and some devops stuff since I want to improve some of our workflow processes at work. We have a ddev project (which uses docker) and GitHub. Everytime we make changes and merge into production, we have to manually ssh into the server and git pull. I was wondering how to automate it so that when a user pushes to a branch, that branch will automatically start building and deploying on the server. I know Netlify does this automatically, but I need to think of some platform-agnostic solution. Would appreciate some direction as I'm getting lost in the weeds of everything devops related.
40 Replies
vince
vinceOP9mo ago
i haven't even seen this yet, i'll take a look ty!
ἔρως
ἔρως9mo ago
you're welcome you should be able to add that server as a runner all deployment tasks run in that server, instead of github's servers
vince
vinceOP9mo ago
is there a reason I would want to do that? do non self-hosted runners cost $?
ἔρως
ἔρως9mo ago
you then can add automatic actions to run when you push code into specific tasks yup, and you can ensure your server has all that you need, and you can feel better knowing that the image cache is in your machine everything is in your own machine, but github just triggers it same as if you did the git pull and build it in your system
vince
vinceOP9mo ago
ohhh coool, ty!
ἔρως
ἔρως9mo ago
https://github.com/pricing usually, 2200 minutes of ci/cd should be enough but if you need more, or need to store more than 500mb of compiled code, then the free plan isnt enough
vince
vinceOP9mo ago
cool the pricing seems pretty reasonable too. i'll have to look what'll fit our use case(s) my end goal too is to eventually be able to easily switch between dev / staging / production environments in ddev / docker and be able to easily push our changes to the correct environment but i'm not even sure where to start lol (other than now the github runners for git -> prod part)
ἔρως
ἔρως9mo ago
you can have the local runners for all stages: dev, staging, production and whatever else you need just not hosting for production you can trigger the build pipeline by tag or branch for example, you have a dev tag, and you just push all your changes and the build system does everything obviously, you can run it locally as well, in your own device im not really good at devops, but a project that's using this system for it's builds and testing is the hazel game engine
vince
vinceOP9mo ago
thank you Epic 🙂 you gave me a lot to research and a direction to go into
ἔρως
ἔρως9mo ago
i found the video
ἔρως
ἔρως9mo ago
https://www.youtube.com/watch?v=0RDI41oBcmQ <-- this is the video that came before that
The Cherno
YouTube
Automatically Testing Hazel - My Game Engine
To try everything Brilliant has to offer—free—for a full 30 days, visit https://brilliant.org/TheCherno. The first 200 of you will get 20% off Brilliant’s annual premium subscription! Patreon ► https://patreon.com/thecherno Instagram ► https://instagram.com/thecherno Twitter ► https://twitter.com/thecherno Discord ► https://discord.gg/thecherno...
ἔρως
ἔρως9mo ago
in the top one, he made things work a lot better im just linking the video here just in case you feel like that some context is missing im not saying this is the final end-all solution, but it's a starting point you're welcome. im not an expert or even good at this, but i know that having somewhere to start is very important, and i had some ideas of where to start including an example of someone doing it
vince
vinceOP9mo ago
hopefully i inspired you to learn a bit more too haha
ἔρως
ἔρως9mo ago
i will be honest: devops is one of the things i hate the most but kinda fascinates me
vince
vinceOP9mo ago
I've always been very big into maintainability and easing dev processes so I think I want to learn more about it My work right now doesn't have like any established processes, so lots of improvement to be made everywhere
ἔρως
ἔρως9mo ago
implementing this should be a huge improvement
vince
vinceOP9mo ago
Yup yup! Just gotta convince the others lol. Everytime I brought up some type of dev pipeline I kind of get a lukewarm answer of "well the customer isn't paying for that". Well even if the customer isn't paying for it we should still set it up just to improve our own efficiency / deliverables
ἔρως
ἔρως9mo ago
the perfect environment that fits my tastes is to press ctrl-s, alt-tab, f5 and every change is ready that's actually really dumb absolutely morronic
vince
vinceOP9mo ago
Hehe for some of our clients we have to ftp into their WordPress site and drag and drop 🤭😂
vince
vinceOP9mo ago
I think its more of an excuse that they just haven't really set stuff up yet (they're not stupid they know this stuff exists). I work for an agency with 3 people including me and we are always against hours so it's very much "do this as quickly as possible to deliver something to the client" mentality. We need to spend some hours improving our processes soon so we can be more efficient
ἔρως
ἔρως9mo ago
i said what i said not because i think they aren't smart enough, but because it was a dumb take
vince
vinceOP9mo ago
It is lol and I don't think they really believe that take either
ἔρως
ἔρως9mo ago
the time you spend optimizing the process is time you will later save in building and testing and with that, you take less time to do things but now, you increased the value of the development, because you can test/deploy better and quicker and your boss gets to keep charging the same, so, more profit for him
vince
vinceOP9mo ago
Exactly and less hours I spend stressing out looking at how close I am to end of hours
ἔρως
ἔρως9mo ago
yup but hey, this is something you can add to your cv later on
vince
vinceOP9mo ago
Yup just don't know how well it'll fit with my seo, design, and development experience 😂 I might be a bit too generalized here lol
ἔρως
ἔρως9mo ago
"improved efficiency in development and deployment for the entire company, reducing the time to delivery by 10%"
vince
vinceOP9mo ago
Ohhh thats good
ἔρως
ἔρως9mo ago
that is a very good point for a cv but hey, start using it for yourself everybody else will ask you how you did it hey, if you try it for your own projects at home, you can implement it even faster at work
vince
vinceOP9mo ago
Ye that's what I'm gonna try to do a bit of after work tomorrow and over the weekend. Then once I get it set up at home I can make a little demo of it with one of our prod sites locally and show them Literally just today I git pulled after sshing and it broke the staging server. Second time that's happened so want to avoid that and make it as frictionless as possible
ἔρως
ἔρως9mo ago
if you had a better process, like an automatic runner, you would just break the docker container in the runner, which then is just discarded and you get a detailed record of everything no broken servers you can add that to your cv too
vince
vinceOP9mo ago
Ye that's my thought process as well. "If I'm able to break it it's probably a process issue"
ἔρως
ἔρως9mo ago
worse: if you're able to break it, EVERYTHING stops until you fix it and the more you break, the more fixing you do, instead of producing you're literally wasting productivity and your own sanity
vince
vinceOP9mo ago
Lol I never even thought about it like that that's a really good point I'm tired tho 😴 I'm gonna watch that video and then hit the hay, thank u again!!
ἔρως
ἔρως9mo ago
you're welcome obviously, try to take advice from others and other places as well, and decide what is best for you for example, for small projects, it might even be worth it to just stick to the free tier and use the free ci/cd minutes for it for a big project, your own hardware with better specs could be a better choice to reduce compilation times but the point is: aggregate advice - move forward with what makes sense for you
vince
vinceOP9mo ago
Agreed 🙂
ἔρως
ἔρως9mo ago
i agree too, mostly because i said it
Want results from more Discord servers?
Add your server