Search code examples
wordpressdebiandevserver

What Debian server setup to use for dev environment to run MariaDB, core application (Python) and a Wordpress testsite


I'm just getting into development - so I might be asking dumb questions, but I get too many conflicting answers by just googling.

I'm developing a Wordpress plugin which will connect to a core application. The Core application will be written in Python and have a MariaDB. I have a laptop (i7, 16RAM, 1TB - with broken hinges and the case is not available anymore) which I would like to utilise as my dev server. Debian 12 without GUI is already installed. I'm going to use an IDE (PyCharm and VSCode) on my other laptop and deploy to the laptop with Debian server. What I think I need to run:

  • My core application
  • The MariaDB
  • An instance of Wordpress where I can test my WP plugin
  • And I need to be able to deploy to the server

What setup would be your advice - utilising mostly open-source tools?

E.g.: Can I run everything on a single machine, or should I use instances? What stack do you advice to run an instance of Wordpress? Which tools should I use to deploy to the Debian server?

I'm just blocked by the contradictions I find when searching online.

Is there a sort of a generic starters setup?


Solution

  • Run this proposed stack as Docker containers on one server. Using containers makes the system more portable, and keeping everything on one server improves performance in terms of inter-connectivity.

    To keep running the containers simple, use docker-compose. I asked ChatGPT to provide an example docker-compose.yml that you can use:

    version: '3.8'
    
    services:
      wordpress:
        image: wordpress:latest
        ports:
          - "8000:80"
        environment:
          WORDPRESS_DB_HOST: mariadb
          WORDPRESS_DB_USER: wordpress
          WORDPRESS_DB_PASSWORD: wordpress
          WORDPRESS_DB_NAME: wordpress
        volumes:
          - wordpress_data:/var/www/html
        depends_on:
          - mariadb
    
      mariadb:
        image: mariadb:latest
        environment:
          MYSQL_ROOT_PASSWORD: rootpassword
          MYSQL_DATABASE: wordpress
          MYSQL_USER: wordpress
          MYSQL_PASSWORD: wordpress
        volumes:
          - mariadb_data:/var/lib/mysql
        ports:
          - "3306:3306"
    
      myapp:
        build: ./myapp
        ports:
          - "5000:5000"
        environment:
          DATABASE_HOST: mariadb
          DATABASE_USER: root
          DATABASE_PASSWORD: rootpassword
          DATABASE_NAME: myappdb
        depends_on:
          - mariadb
    
    volumes:
      wordpress_data:
      mariadb_data: