0

I'm trying to set up my cloud server so i can run an app made with nodeJs and mongoDB, now for nodeJs my setup is to deploy it using cpanel on a cenos 7 os and since cpanel does not really support mongoDB i wonder what's the best practice to deploy mongoDB alongside of it!

  1. should i simply install and run the mongoDB on my centos 7?
  2. should i install docker alongside cpanel and run mongoDB inside a docker container? i prefer this choice since docker has an official mongoDB Image but what i'm concerned about whether it would be okay if my cpanel is not actually in a docker container itself?
3
  • What cloud are you using (aws, gcp, azure, huawei, digital ocean, heroku, etc) ? What are the hardware specs? Do you plan to host more applications or just the nodejs and mongo? Do you plan to have at least a testing & prod environment? Is a proof of concept or an enterprise application? Do you want to use devops or just a simple, not frequent and manual deploy?
    – JRichardsz
    Oct 4, 2022 at 14:56
  • @JRichardsz I am using hetzner cloud. the specs are atleast vCPU: 4 AMD EPYC 2nd Gen or Intel® Xeon® Gold, RAM: 8 GB, Disk space: 160 GB NVMe SSD. i only want to host just the nodeJs and mongo. no need for a testing & prod environment. it's not a proof of concept. of course devops would be preferable but many services(such as the cloud services you mentioned) that would make my life easier are not available to me and at this stage i would just be happy with a stable simple, not frequent and manual deploy. Oct 4, 2022 at 15:48
  • Does the hetzner cloud give you shell access with root privileges? Do you use github, gitlab or bitbucket? I would be delighted to help you set up a devops environment for your applications in your cloud. Add the description of the previous comment to your question.
    – JRichardsz
    Oct 4, 2022 at 21:13

1 Answer 1

0

At a minimum you need access to the shell. Without the shell, you will work as if you were 20 years ago or more. If you will host just one web application, at least you also need a public ip or domain preferable with https

Also the usage of environment variables to avoid hardcoded values are required.

The following strategies assume that you have shell access and a public ip or domain.

let's not reinvent the wheel

Dokku

Dokku is an open-source platform-as-a-service (PaaS). If you're familiar with Heroku, you can consider Dokku a private Heroku that you manage.

Basically, after the installation, you will have a private git url in which if you push some standard code, the app will be deployed.

I don't know any other similar open source platform.

Buddy

https://buddy.works/pricing

In this platform you could automate some tasks. It is like a mini jenkins

Minimal manual implementation

  • Create a github repository
  • Add a Dockerfile to your source code
  • Use environment variables instead hardcoded values of database connection in the source code
  • Install docker and git in the server
  • Start a mongodb using docker and volumes
  • After tests on your localhost, push to github
  • Enter to the cloud and clone the git repository
  • Execute the docker build to generate the image
  • Execute docker run -p 80:xyz. xyz* is the port of your application

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.