{ pkg, config, lib, ... }: { docker-containers."wallabag-db" = { image = "postgres"; environment = { "POSTGRES_PASSWORD" = "wallaroot"; "POSTGRES_USER" = "postgres"; }; extraDockerOptions = [ "--network=wallabag-br" ]; volumes = [ "/opt/wallabag/data:/var/www/wallabag" ]; }; docker-containers."wallabag" = { image = "wallabag/wallabag"; ports = [ "800:80" ]; #volumes = [ "/opt/wallabag/data:/var/www/wallabag/data" "/opt/wallabag/images:/var/www/wallabag/web/assets/images" ]; environment = { "SYMFONY__ENV__DOMAIN_NAME" = "http://192.168.1.6:800"; "POSTGRES_PASSWORD" = "wallaroot"; "POSTGRES_USER" = "postgres"; "SYMFONY__ENV__DATABASE_DRIVER" = "pdo_pgsql"; "SYMFONY__ENV__DATABASE_DRIVER_CLASS" = "Wallabag\\CoreBundle\\Doctrine\\DBAL\\Driver\\CustomPostgreSQLDriver"; "SYMFONY__ENV__DATABASE_HOST" = "wallabag-db"; "SYMFONY__ENV__DATABASE_PORT" = "5432"; "SYMFONY__ENV__DATABASE_NAME" = "wallabag"; "SYMFONY__ENV__DATABASE_USER" = "wallabag"; "SYMFONY__ENV__DATABASE_PASSWORD" = "wallapass"; #"SYMFONY__ENV__DATABASE_CHARSET" = "utf8mb4"; }; extraDockerOptions = [ "--network=wallabag-br" ]; }; systemd.services.init-wallabag-docker-br = { description = "Create the network bridge wallabag."; after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; serviceConfig.Type = "oneshot"; script = let dockercli = "${config.virtualisation.docker.package}/bin/docker"; in '' # Put a true at the end to prevent getting non-zero return code, which will # crash the whole service. check=$(${dockercli} network ls | grep "wallabag-br" || true) if [ -z "$check" ]; then ${dockercli} network create wallabag-br else echo "wallabag-br already exists in docker" fi ''; }; networking.firewall.allowedTCPPorts = [ 800 ]; }