<p>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</p>
<p>Also the usage of environment variables to avoid hardcoded values are required.</p>
<p>The following strategies assume that you have shell access and a public ip or domain.</p>
<h2>let's not reinvent the wheel</h2>
<p><strong>Dokku</strong></p>
<p>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.</p>
<p>Basically, after the installation, you will have a private git url  in which if you push some standard code, the app will be deployed.</p>
<ul>
<li><a href="https://blog.back4app.com/what-is-dokku/" rel="nofollow noreferrer">https://blog.back4app.com/what-is-dokku/</a></li>
<li><a href="https://vimeo.com/68631325" rel="nofollow noreferrer">https://vimeo.com/68631325</a></li>
<li><a href="https://www.freecodecamp.org/news/how-to-build-your-on-heroku-with-dokku/" rel="nofollow noreferrer">https://www.freecodecamp.org/news/how-to-build-your-on-heroku-with-dokku/</a></li>
</ul>
<p>I don't know any other similar open source platform.</p>
<p><strong>Buddy</strong></p>
<p><a href="https://buddy.works/pricing" rel="nofollow noreferrer">https://buddy.works/pricing</a></p>
<p>In this platform you could automate some tasks. It is like a mini jenkins</p>
<h2>Minimal manual implementation</h2>
<ul>
<li>Create a github repository</li>
<li>Add a Dockerfile to your source code</li>
<li>Use environment variables instead hardcoded values of database connection in the source code</li>
<li>Install docker and git in the server</li>
<li>Start a mongodb using docker and volumes</li>
<li>After tests on your localhost, push to github</li>
<li>Enter to the cloud and clone the git repository</li>
<li>Execute the <code>docker build</code> to generate the image</li>
<li>Execute <code>docker run -p 80:xyz</code>. <strong>xyz</strong>* is the port of your application</li>
</ul>

CC BY-SA 4.0
2022-10-05T06:44:46.650Z
2022-10-05T06:44:46.650Z
JRichardsz
<p>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!</p>
<ol>
<li>should i simply install and run the mongoDB on my centos 7?</li>
<li>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?</li>
</ol>

CC BY-SA 4.0
2022-10-04T14:56:18.073Z
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
CC BY-SA 4.0
2022-10-04T15:48:30.297Z
@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.
devopsNovice00
CC BY-SA 4.0
2022-10-04T21:13:33.470Z
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
<docker><node.js><mongodb>
The best practice to set up cpanel with mongoDB on a cloud server!
devopsNovice00
# The best practice to set up cpanel with mongoDB on a cloud server!

(Asked by: username_0 on 2022-10-04)

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?

**Tags:** docker, node.js, mongodb

> **Comments:**
> **username_1**: 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?  
> **username_0**: @username_1 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.  
> **username_1**: 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.  

---

## 1 answers

### Answer by username_1 on 2022-10-05. Score: 0 | Accepted answer

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.

* <https://blog.back4app.com/what-is-dokku/>
* <https://vimeo.com/68631325>
* <https://www.freecodecamp.org/news/how-to-build-your-on-heroku-with-dokku/>

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


---

