Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Understanding docker use case for my websites
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Understanding docker use case for my websites

I mostly run a few WordPress sites (one of them is WooCommerce based) while there is another one I am working on which is totally custom coding. Sometime I get a new VPS and transfer websites from existing VPS to new one. Here is what I normally do:

  1. Create new users for each website and assign appropriate permission like www
  2. Install fail2ban
  3. Install ufw and block some ports
  4. Change SSH port and disable password login
  5. Install and configure nginx
  6. Install and configure php-fpm
  7. Install and configure mariadb
  8. Plus some other settings

Basically, these are repetitive tasks which I have to do every time I get a new VPS. Do you think using docker will make my life easier? I have never used it before. I was thinking of creating a docker container based on Debian and then install and configure everything on it like the way I want. Then when I need to move website to new VPS, I will simply move copy that container to new VPS and boooooom done!

Do you think I will be able to create a docker container based on above points or at least from points 1, 5, 6 and 7?

Comments

  • Try ansible / puppet.

    Docker is a hut or miss specially if you are new.

    I'd go with the automation experience first and tinker with docker when you have time on a test instance.

    Thanked by 2loay alilet
  • mailcheapmailcheap Member, Host Rep

    As you're managing self-contained applications (websites), containers are the way to go. For the host use a minimal, immutable OS like Fedora CoreOS or OpenSuse Aeon and set it to auto-update/reboot every week. Sort of like a set it and forget it situation with A/B root for rollback should you ever need it.

    I'd personally recommend podman over docker as it runs in rootless mode by default and doesn't need a daemon. Pretty much a drop-in replacement for docker so all those useful docker tips on the web are applicable for podman too.

    For an easy introduction, check out some podman GUIs:
    https://podman-desktop.io/
    https://github.com/marhkb/pods

    Pavin.

    Thanked by 3alilet dev077 argado
  • unsafetypinunsafetypin Member
    edited December 2023

    All of my sites and databases are containers with persistent storage on the host. If I want to move a site to another host, I simply stop the stack(or dont if you you can take a live backup), rsync the container directory and then bring the stack back up and point to the other host. Makes life easy for hosting random shit without changing the whole setup for 1 sites requirements. I use borgmatic to live backup the container databases as dumps safely and filesystem on whatever host.

    Thanked by 2alilet dev077
  • Ok let me try with docker and see how it goes. I might also check podman as it seems to be interesting new development.
    I will start with one site only to see how it goes. Hopefully one site on docker will be able to run on 1GB RAM.

  • Congratulations on achieving a seamless and secure experience! When using Docker Compose, it is important to note that ufw does not have an effect on the ports opened by Docker. The best practice in this scenario is to have only the Nginx container in Docker Compose to accept traffic from ports 80 and 443, while other containers should only listen on an internal port and be connected through Nginx. This approach ensures seamless expansion and security.

    Thanked by 2dev077 alilet
  • risharderisharde Patron Provider, Veteran

    As long as you aren't using docker on windows, you may be able to achieve this. I have encountered performance issues on Windows like slow file changes taking a while to be reflected in the container. Maybe it's been fixed though by now.

    I like docker for automation and for packaging multiple components together. However I remember reading docker was more a development tool so I do wonder if the developers aren't saying things that should be said.

    Thanked by 1alilet
  • mrl22mrl22 Member
    edited December 2023

    WordPress is not very docker-friendly due to how WordPress updates its files.

    Give https://cleavr.io a go. They will set up your server for you automatically and allow you to create users, virtual hosts and databases.

    Thanked by 1alilet
Sign In or Register to comment.