Best solutions for auto deployment of multiple server applications

I'm still a newbie to devops and overall sysadmin, and a few days ago I wanted to completely reinstall everything on my server and properly setup services and deployment for apps, now my problem is how I would properly approach automatically deploying an application, building it, automatically updating it and restarting it on crashes.

Before I did this using simple bash scripts that would run in the background and automatically check for updates and deploy them if there is a newer version on the remote repository.

I already looked a bit into the topic and found out about docker and docker, kubernetes and docker compose. They all seemed perfect at first, but when looking more into the topic I didn't completely see the need for them, since the applications I have don't need to be isolated or run on a completely separate instance from the main operating systems, the applications can be run on every major kernel.

Now what I would want to know is, if there are any tools or applications to achieve exactly this, I specifically need to

  • Pull from remote repository if there are any updates (Could also be achieved with Github Actions, to trigger an action on the server)
  • Automatically build the newer source and restart the application
  • Restart application if it crashes or the system crashes for whatever reason.

Solution 1:

It's perfectly acceptable to deploy an app without containers. We've been doing it forever and the procedures are well known and documented.

From your description it appears that you want to orchestrate deployment of your app and need a tool to do so. I would suggest getting started with something like ansible. It's very simple to get started but will scale as far up/out as far you can imagine. I wouldn't get involved with RHEL-specific components like Tower or Automation Platform yet though. Skip all such things until you have a very good understanding of Ansible.

To demonstrate the simplicity, here is an Ansible playbook that I wrote that installs all available updates on a wide variety of Linux distributions. You won't understand some of it, I'm sure, but the parts you do understand will be quite obvious.

---
- hosts: all
  strategy: free
  tasks:
    - block:
      - name: Update all packages
        dnf:
          name: "*"
          state: latest
          update_cache: yes

      - name: Autoremove old packages
        dnf:
          autoremove: yes

      when: ansible_pkg_mgr == 'dnf'

    - block:
      - name: Update all packages
        yum:
          name: "*"
          state: latest
          update_cache: yes

      - name: Autoremove old packages
        yum:
          autoremove: yes

      when: ansible_pkg_mgr == 'yum'

    - block:
      - name: Update all packages
        apt:
          name: "*"
          state: latest
          update_cache: yes

      - name: Autoremove old packages
        apt:
          autoremove: yes

      when: ansible_pkg_mgr == 'apt'