# Self hosted Mender server

**URL:** <https://hub.mender.io/t/self-hosted-mender-server/5731>\
**Category:** General Discussions\
**Created:** [April 4, 2023, 4:58am UTC](https://hub.mender.io/t/self-hosted-mender-server/5731 "2023-04-04T04:58:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![silviub](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@silviub](https://hub.mender.io/u/silviub)\
**Post date:** [April 4, 2023, 4:58am UTC](https://hub.mender.io/t/self-hosted-mender-server/5731/1 "2023-04-04T04:58:19Z")

</div>

Hello,

I am looking for some guidance in the following:  
I want to host a Mender server for, hopefully, future production use. For simplicity’s sake, we need to host our own server so it makes sense to do so. My question is: what issues have people been facing when hosting their own server.  
Also, one of my questions would be: if the mender server completely crashes, for any reason at all, creating a new Mender server and hosting it at the same URL would allow me to “recover” (re-add) all the devices without having to manually connect to each one? In my opinion, since mender.conf has the following stanza:

```auto
    "ServerCertificate": "/etc/mender/mender.pem",
    "Servers": [
        {
            "ServerURL": "https://mender.domain"
        }
    ]

```

I would guess that the devices will, at regular intervals poll [https://mender.domain](https://mender.domain), which will allow me to just accept all the devices as new devices. Is that right?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [April 5, 2023, 8:05am UTC](https://hub.mender.io/t/self-hosted-mender-server/5731/2 "2023-04-05T08:05:43Z")

</div>

Hi @silviub,

while I do not really know what you mean by “completely crashing”, the general advice, as anywhere in IT is: have a tested backup and restore strategy. The documentation on this is [here](https://docs.mender.io/3.5/server-installation/installation-with-docker-compose/backup-and-restore).

What issues you may face depends on your project and set up, like scaling, hosting, etc. If you run into a specific problem, feel free to ask about it here, or (sales pitch) just use Hosted Mender where we take care of this 🙂

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![silviub](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@silviub](https://hub.mender.io/u/silviub)\
**Post date:** [April 5, 2023, 8:12am UTC](https://hub.mender.io/t/self-hosted-mender-server/5731/3 "2023-04-05T08:12:32Z")

</div>

Hello, @TheYoctoJester,

By “complete crashing” I mean something catastrophic. I don’t know, the DC catches fire 😃  
The question is: would a new mender instance, hosted at the same URL, using certificates signed by the same authority, be able to register the devices that were already registered in the old Mender server? That’s basically my question, since this is an extreme scenario so, if something like this happens, and it’s still possible to recover, then I guess anything else is rather simple 😃

Thank you.

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [April 5, 2023, 8:16am UTC](https://hub.mender.io/t/self-hosted-mender-server/5731/4 "2023-04-05T08:16:06Z")

</div>

Hi @silviub,

lets say, according to my understanding it should work like that. But why not just give it a short test, and then let us know? Should be relatively straightforward.

1. get the integration repo
2. spin up server
3. register device
4. spin down server
5. wipe server  
6 spin up server again
6. see what happens 🙂

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![silviub](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@silviub](https://hub.mender.io/u/silviub)\
**Post date:** [April 6, 2023, 5:09am UTC](https://hub.mender.io/t/self-hosted-mender-server/5731/5 "2023-04-06T05:09:05Z")

</div>

To be honest, I was hoping someone already tested this.

Still, I ran the tests, it works. The only thing is that the devices need a reboot / a restart of the mender-client. I would guess that the DNS is cached somewhere, and on `systemctl restart mender-client` that DNS entry is flushed or something.

P.S. (1): the OS DNS was updated, as both `ping mender.domain` and `dig mender.domain` were showing the correct IP address.  
P.S. (2): It might make sense to update that DNS record either on schedule or before calling the endpoint.

Thank you!
