Deploying monorepo without SSH

cn flag

Full Disclosure: I'm a DevOps noob.

I am running a MERN mono repo on an EC2 instance. Originally, I would always SSH into my machine, pull from the repository, and build again. But there are problems with this.. the build process takes longer and so when the SSH connection breaks at times, the build process gets terminated. This happens a lot making deploying difficult.

I thought about it, and I am sure there is a service that can do this: I can use a CI/CD pipeline in my repo (BitBucket), so when there is a commit on the main branch, it can ping my instance, and then there is an application running on my instance, which when it receives this ping, pulls, rebuilds and restarts the repo. Therefore, since it would be an application inside the EC2 there would a.) be no need to SSH in, and b.) be a reliable solution to deploy. Nice to have would be if there was anyways to monitor the build process when it is triggered.

I'm being unable to express my requirement hence I'm unable to look at the solutions available to do so, please suggest the same.

anx avatar
fr flag
If you have the BitBucket pipeline features and are content with them, what is the question, then? Just.. use them? If you are willing to hand them suitable ssh keys, their connection is not going to be affected by your local connectivity issues.
cn flag
My question is this: is there such an application available, which can be just pinged by BitBucket (via the Elastic IP and is running inside the EC2 machine) and when pinged it will pull and build on the EC2 (this is the easy part)
cn flag
(Again, noob here, I'm sure there is such a thing but I just didn't know how to describe it so I came here)
cn flag
further simplified: my current setup of deployment involves SSH tunneling and as we know, those can be unstable, hence interrupting the build process and knock-on effect being site down. So I want to start avoiding it in favor of a solution that just starts a local build (Script) on its own given some kind of invocation (like an REST invocation for example)
Aaron Copley avatar
cn flag
You could simply [background/detach the process]( so it doesn't get killed when the parent process (shell) dies, or use `screen`/`tmux`.
cn flag
@AaronCopley thanks, that's one good idea for manual deployments but at the same time, it would be nice to rid me of even this needing to this :)
dj flag

I'd recommend learning more about how CI/CD works. Bitbucket pipelines are fairly adequate to do what you want. What you want does exist in the scope of many tools. There aren't single tools that do everything exactly, some people use Kubernetes, some use docker-compose. For the health checking, that's usually handled on a load balancer or the like. Some create custom scripts to manage everything. From what you've described, it sounds like a lot of manual script writing would be the most appropriate.

cn flag
yes, I'm aware that bitbucket is adequate, but since I believe there might be some local configurations required that should only be left on my EC2 machines, I would like to keep the build running there itself.... so all that bitbucket needs to do is to ping my machine - (CHECK, using webhooks), and the only piece of the puzzle remaining is an application to receive that webhook call on that machine and start the build process there (run a script there)

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.