Skip to content
Advertisement

How should I deploy a web application to Debian?

Ideally I’d like to build a package to deploy to Debian. Ideally the installation process would check the system has the required dependencies installed, as well as configure Cronjobs, set up users etc.

I’ve tried googling around and I understand a .deb is the format I can distribute in – but that is as far as I got since I’m getting confused now with the tooling I need to get up to speed with. The other option is to just git clone on the server and configure the environment manually… but that’s not preferable for obvious reasons.

How can I get started with building a Debian package and is that the right direction for deploying web applications? If anyone could point me in the right direction tools-wise and perhaps a tutorial that would be massively appreciated 🙂 also if you advise to just take the simple route with git, happy to take that advice as well if you explain why. if it makes any difference I’m deploying one nodejs and one python web application

Advertisement

Answer

You can for sure package everything as a Linux application; for example using pyinstaller for your python webapp.

Besides that, it depends on your use case.

I will focus on the second part of your question,

How can I get started with building a Debian package and is that the right direction for deploying web applications?

as that seems to be what you are after when considering other alternatives to .dev already in your question.

I want to deploy 1-2 websites on my linux server

In this case, I’d say manually git clone and configure everything. Its totally fine when you know that there won’t be much more running on the server and is pretty hassle free. Why spend time packaging when noone will need the package ever again after you just installed it on your server?

I want to distribute my webapps to others on Debian

Here a .deb would make total sense. For example Plex media server and other applications are shipped like this. If the official Debian wiki is too abstract, there are also other more hands on guides to get you started quickly. You could also get other .deb Packages and extract them to see what they are made up from. You mentioned one of your websites is using python, so I just suspect it might be flask or Django. If it’s Django, there is an example repository you might want to check out.

I want to run a lot of stuff on my server / distribute to other devs and platforms / or scale soon

In this case I would make the webapps into docker containers. They are easy to build, share, and deploy. On top you can easily bundle all dependencies and scripts to make sure everything is setup right. Also they are easy to run and stop. So you have a simple “on/off” switch if your server is running low on resources while you want to run something else. I highly favour this solution, as it also allows you to easily control what is running on what ip when you deploy more and more applications to your server. But, as you pointed out, it runs with a bit of overhead and is not the best solution on weak hardware. Also, if you know for sure what will be running on the server long term and don’t need the flexibility I would probably skip Docker as well.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement