Commit 401e2b5e authored by toastal's avatar toastal
Browse files

nixos/dolibarr: add h2o+postgres setup as an extra test machine

parent 3fdabe09
Loading
Loading
Loading
Loading
+77 −51
Original line number Diff line number Diff line
@@ -3,7 +3,8 @@
  name = "dolibarr";
  meta.maintainers = [ ];

  nodes.machine =
  nodes = {
    nginx_mysql =
      { ... }:
      {
        services.dolibarr = {
@@ -13,12 +14,29 @@
            forceSSL = false;
            enableACME = false;
          };
          database.type = "mysql";
        };

        networking.firewall.allowedTCPPorts = [ 80 ];
      };
    h2o_postgresql =
      { ... }:
      {
        services.dolibarr = {
          enable = true;
          domain = "localhost";
          h2o = {
            acme.enable = false;
          };
          database.type = "postgresql";
        };

  testScript = ''
        networking.firewall.allowedTCPPorts = [ 80 ];
      };
  };

  testScript = # python
    ''
      from html.parser import HTMLParser
      start_all()

@@ -32,12 +50,20 @@
        def handle_endtag(self, tag): pass
        def handle_data(self, data): pass

      # wait for app
      for machine in (nginx_mysql, h2o_postgresql):
        machine.wait_for_unit("phpfpm-dolibarr.service")
    machine.wait_for_unit("nginx.service")
    machine.wait_for_open_port(80)

      # wait for web servers
      nginx_mysql.wait_for_unit("nginx.service")
      nginx_mysql.wait_for_open_port(80)
      h2o_postgresql.wait_for_unit("h2o.service")
      h2o_postgresql.wait_for_open_port(80)

      for machine in (nginx_mysql, h2o_postgresql):
        # Sanity checks on URLs.
    # machine.succeed("curl -fL http://localhost/index.php")
    # machine.succeed("curl -fL http://localhost/")
        machine.succeed("curl -fL http://localhost/index.php")
        machine.succeed("curl -fL http://localhost/")
        # Perform installation.
        machine.succeed('curl -fL -X POST http://localhost/install/check.php -F selectlang=auto')
        machine.succeed('curl -fL -X POST http://localhost/install/fileconf.php -F selectlang=auto')