0

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.

  • 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. – anx May 22 '22 at 00:23
  • 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) – Divyansh Goenka May 23 '22 at 01:16
  • (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) – Divyansh Goenka May 23 '22 at 01:17
  • 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) – Divyansh Goenka May 23 '22 at 05:43
  • You could simply [background/detach the process](https://askubuntu.com/q/8653/4827) so it doesn't get killed when the parent process (shell) dies, or use `screen`/`tmux`. – Aaron Copley May 26 '22 at 01:30
  • @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 :) – Divyansh Goenka May 26 '22 at 09:17

1 Answers1

1

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.

Steve Butler
  • 1,016
  • 9
  • 19
  • 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) – Divyansh Goenka May 26 '22 at 09:22