338 lines
10 KiB
Nix
338 lines
10 KiB
Nix
# Auto-generated using compose2nix v0.1.6.
|
|
{ pkgs, lib, ... }:
|
|
|
|
{
|
|
# Runtime
|
|
virtualisation.podman = {
|
|
enable = true;
|
|
autoPrune.enable = true;
|
|
dockerCompat = true;
|
|
defaultNetwork.settings = {
|
|
# Required for container networking to be able to use names.
|
|
dns_enabled = true;
|
|
};
|
|
};
|
|
virtualisation.oci-containers.backend = "podman";
|
|
|
|
# Containers
|
|
virtualisation.oci-containers.containers."blackbird-api" = {
|
|
image = "";
|
|
environment = {
|
|
API_DOMAIN = "http://localhost:3000";
|
|
DATABASE_URL = "postgresql://nomads:nomads@pgsql:5432/nomads?schema=public";
|
|
JWT_SECRET = "test1234";
|
|
MEDIA_LOCATION = "./data/media/";
|
|
MEDIA_LOCATION_DOWNLOAD_CACHE = "/data/media/downloadCache";
|
|
MEDIA_LOCATION_INCOMING = "/data/media/incoming";
|
|
MINIO_HOST = "minio";
|
|
MINIO_PORT = "9000";
|
|
MINIO_ROOT_PASSWORD = "password";
|
|
MINIO_ROOT_USER = "blackbird";
|
|
NODE_ENV = "development";
|
|
PORT = "3000";
|
|
POSTGRES_LOCAL_MACHINE_PORT = "5434";
|
|
POSTGRES_PASSWORD = "nomads";
|
|
POSTGRES_USER = "nomads";
|
|
REACT_APP_API_DOMAIN = "http://localhost:3000";
|
|
REDIS_HOST = "redis";
|
|
REDIS_PASSWORD = "password";
|
|
REDIS_PORT = "6379";
|
|
REFRESH_TOKEN_SECRET = "test1234";
|
|
STATIC_MEDIA_HOST = "http://localhost:3000";
|
|
STRIPE_KEY = "";
|
|
};
|
|
volumes = [
|
|
"/home/anish/.ssh:/root/.ssh:rw"
|
|
"/home/anish/usr/mirlo:/var/www/api:rw"
|
|
"/home/anish/usr/mirlo/data/media/downloadCache:/data/media/downloadCache:rw"
|
|
"/home/anish/usr/mirlo/data/media/incoming:/data/media/incoming:rw"
|
|
];
|
|
ports = [
|
|
"3000:3000/tcp"
|
|
];
|
|
cmd = [ "/bin/sh" "-c" "yarn && yarn migrate:deploy && yarn dev:api" ];
|
|
dependsOn = [
|
|
"blackbird-minio"
|
|
"blackbird-pgsql"
|
|
"blackbird-redis"
|
|
];
|
|
log-driver = "journald";
|
|
extraOptions = [
|
|
"--network-alias=api"
|
|
"--network=mirlo-api-network"
|
|
"--network=mirlo-redis-network"
|
|
];
|
|
};
|
|
systemd.services."podman-blackbird-api" = {
|
|
serviceConfig = {
|
|
Restart = lib.mkOverride 500 "always";
|
|
};
|
|
after = [
|
|
"podman-network-mirlo-api-network.service"
|
|
"podman-network-mirlo-redis-network.service"
|
|
];
|
|
requires = [
|
|
"podman-network-mirlo-api-network.service"
|
|
"podman-network-mirlo-redis-network.service"
|
|
];
|
|
partOf = [
|
|
"podman-compose-mirlo-root.target"
|
|
];
|
|
unitConfig.UpheldBy = [
|
|
"podman-blackbird-minio.service"
|
|
"podman-blackbird-pgsql.service"
|
|
"podman-blackbird-redis.service"
|
|
];
|
|
wantedBy = [
|
|
"podman-compose-mirlo-root.target"
|
|
];
|
|
};
|
|
virtualisation.oci-containers.containers."blackbird-background" = {
|
|
image = "";
|
|
environment = {
|
|
API_DOMAIN = "http://localhost:3000";
|
|
DATABASE_URL = "postgresql://nomads:nomads@pgsql:5432/nomads?schema=public";
|
|
JWT_SECRET = "test1234";
|
|
MEDIA_LOCATION = "./data/media/";
|
|
MEDIA_LOCATION_DOWNLOAD_CACHE = "/data/media/downloadCache";
|
|
MEDIA_LOCATION_INCOMING = "/data/media/incoming";
|
|
MINIO_HOST = "minio";
|
|
MINIO_PORT = "9000";
|
|
MINIO_ROOT_PASSWORD = "password";
|
|
MINIO_ROOT_USER = "blackbird";
|
|
NODE_ENV = "development";
|
|
PORT = "3000";
|
|
POSTGRES_LOCAL_MACHINE_PORT = "5434";
|
|
POSTGRES_PASSWORD = "nomads";
|
|
POSTGRES_USER = "nomads";
|
|
REACT_APP_API_DOMAIN = "http://localhost:3000";
|
|
REDIS_HOST = "redis";
|
|
REDIS_PASSWORD = "password";
|
|
REDIS_PORT = "6379";
|
|
REFRESH_TOKEN_SECRET = "test1234";
|
|
STATIC_MEDIA_HOST = "http://localhost:3000";
|
|
STRIPE_KEY = "";
|
|
};
|
|
volumes = [
|
|
"/home/anish/.ssh:/root/.ssh:rw"
|
|
"/home/anish/usr/mirlo:/var/www/api:rw"
|
|
"/home/anish/usr/mirlo/data/media/processing:/data/media/processing:rw"
|
|
];
|
|
dependsOn = [
|
|
"blackbird-api"
|
|
"blackbird-minio"
|
|
"blackbird-pgsql"
|
|
"blackbird-redis"
|
|
];
|
|
log-driver = "journald";
|
|
extraOptions = [
|
|
"--network-alias=background"
|
|
"--network=mirlo-api-network"
|
|
"--network=mirlo-redis-network"
|
|
];
|
|
};
|
|
systemd.services."podman-blackbird-background" = {
|
|
serviceConfig = {
|
|
Restart = lib.mkOverride 500 "always";
|
|
};
|
|
after = [
|
|
"podman-network-mirlo-api-network.service"
|
|
"podman-network-mirlo-redis-network.service"
|
|
];
|
|
requires = [
|
|
"podman-network-mirlo-api-network.service"
|
|
"podman-network-mirlo-redis-network.service"
|
|
];
|
|
partOf = [
|
|
"podman-compose-mirlo-root.target"
|
|
];
|
|
unitConfig.UpheldBy = [
|
|
"podman-blackbird-api.service"
|
|
"podman-blackbird-minio.service"
|
|
"podman-blackbird-pgsql.service"
|
|
"podman-blackbird-redis.service"
|
|
];
|
|
wantedBy = [
|
|
"podman-compose-mirlo-root.target"
|
|
];
|
|
};
|
|
virtualisation.oci-containers.containers."blackbird-minio" = {
|
|
image = "minio/minio";
|
|
environment = {
|
|
API_DOMAIN = "http://localhost:3000";
|
|
DATABASE_URL = "postgresql://nomads:nomads@pgsql:5432/nomads?schema=public";
|
|
JWT_SECRET = "test1234";
|
|
MEDIA_LOCATION = "./data/media/";
|
|
MEDIA_LOCATION_DOWNLOAD_CACHE = "/data/media/downloadCache";
|
|
MEDIA_LOCATION_INCOMING = "/data/media/incoming";
|
|
MINIO_HOST = "minio";
|
|
MINIO_PORT = "9000";
|
|
MINIO_ROOT_PASSWORD = "password";
|
|
MINIO_ROOT_USER = "blackbird";
|
|
PORT = "3000";
|
|
POSTGRES_LOCAL_MACHINE_PORT = "5434";
|
|
POSTGRES_PASSWORD = "nomads";
|
|
POSTGRES_USER = "nomads";
|
|
REACT_APP_API_DOMAIN = "http://localhost:3000";
|
|
REDIS_HOST = "redis";
|
|
REDIS_PASSWORD = "password";
|
|
REDIS_PORT = "6379";
|
|
REFRESH_TOKEN_SECRET = "test1234";
|
|
STATIC_MEDIA_HOST = "http://localhost:3000";
|
|
STRIPE_KEY = "";
|
|
};
|
|
volumes = [
|
|
"/home/anish/usr/mirlo/data/minio_storage:/data:rw"
|
|
];
|
|
ports = [
|
|
"9000:9000/tcp"
|
|
"9001:9001/tcp"
|
|
];
|
|
cmd = [ "server" "--console-address" ":9001" "/data" ];
|
|
log-driver = "journald";
|
|
extraOptions = [
|
|
"--network-alias=minio"
|
|
"--network=mirlo-api-network:alias=minio"
|
|
];
|
|
};
|
|
systemd.services."podman-blackbird-minio" = {
|
|
serviceConfig = {
|
|
Restart = lib.mkOverride 500 "no";
|
|
};
|
|
after = [
|
|
"podman-network-mirlo-api-network.service"
|
|
];
|
|
requires = [
|
|
"podman-network-mirlo-api-network.service"
|
|
];
|
|
partOf = [
|
|
"podman-compose-mirlo-root.target"
|
|
];
|
|
wantedBy = [
|
|
"podman-compose-mirlo-root.target"
|
|
];
|
|
};
|
|
virtualisation.oci-containers.containers."blackbird-pgsql" = {
|
|
image = "postgres:14-alpine";
|
|
environment = {
|
|
API_DOMAIN = "http://localhost:3000";
|
|
DATABASE_URL = "postgresql://nomads:nomads@pgsql:5432/nomads?schema=public";
|
|
JWT_SECRET = "test1234";
|
|
MEDIA_LOCATION = "./data/media/";
|
|
MEDIA_LOCATION_DOWNLOAD_CACHE = "/data/media/downloadCache";
|
|
MEDIA_LOCATION_INCOMING = "/data/media/incoming";
|
|
MINIO_HOST = "minio";
|
|
MINIO_PORT = "9000";
|
|
MINIO_ROOT_PASSWORD = "password";
|
|
MINIO_ROOT_USER = "blackbird";
|
|
PORT = "3000";
|
|
POSTGRES_LOCAL_MACHINE_PORT = "5434";
|
|
POSTGRES_PASSWORD = "nomads";
|
|
POSTGRES_USER = "nomads";
|
|
REACT_APP_API_DOMAIN = "http://localhost:3000";
|
|
REDIS_HOST = "redis";
|
|
REDIS_PASSWORD = "password";
|
|
REDIS_PORT = "6379";
|
|
REFRESH_TOKEN_SECRET = "test1234";
|
|
STATIC_MEDIA_HOST = "http://localhost:3000";
|
|
STRIPE_KEY = "";
|
|
};
|
|
volumes = [
|
|
"/home/anish/usr/mirlo/data/pgsql:/var/lib/postgresql/data:rw"
|
|
"/home/anish/usr/mirlo/data/pgsql_backups:/backups:rw"
|
|
];
|
|
ports = [
|
|
"5432:5432/tcp"
|
|
];
|
|
log-driver = "journald";
|
|
extraOptions = [
|
|
"--network-alias=pgsql"
|
|
"--network=mirlo-api-network:alias=pgsql"
|
|
];
|
|
};
|
|
systemd.services."podman-blackbird-pgsql" = {
|
|
serviceConfig = {
|
|
Restart = lib.mkOverride 500 "no";
|
|
};
|
|
after = [
|
|
"podman-network-mirlo-api-network.service"
|
|
];
|
|
requires = [
|
|
"podman-network-mirlo-api-network.service"
|
|
];
|
|
partOf = [
|
|
"podman-compose-mirlo-root.target"
|
|
];
|
|
wantedBy = [
|
|
"podman-compose-mirlo-root.target"
|
|
];
|
|
};
|
|
virtualisation.oci-containers.containers."blackbird-redis" = {
|
|
image = "redis";
|
|
ports = [
|
|
"6379:6379/tcp"
|
|
];
|
|
cmd = [ "redis-server" "--appendonly" "yes" "--requirepass " ];
|
|
log-driver = "journald";
|
|
extraOptions = [
|
|
"--network-alias=redis"
|
|
"--network=mirlo-redis-network"
|
|
];
|
|
};
|
|
systemd.services."podman-blackbird-redis" = {
|
|
serviceConfig = {
|
|
Restart = lib.mkOverride 500 "always";
|
|
};
|
|
after = [
|
|
"podman-network-mirlo-redis-network.service"
|
|
];
|
|
requires = [
|
|
"podman-network-mirlo-redis-network.service"
|
|
];
|
|
partOf = [
|
|
"podman-compose-mirlo-root.target"
|
|
];
|
|
wantedBy = [
|
|
"podman-compose-mirlo-root.target"
|
|
];
|
|
};
|
|
|
|
# Networks
|
|
systemd.services."podman-network-mirlo-api-network" = {
|
|
path = [ pkgs.podman ];
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
RemainAfterExit = true;
|
|
ExecStop = "${pkgs.podman}/bin/podman network rm -f mirlo-api-network";
|
|
};
|
|
script = ''
|
|
podman network inspect mirlo-api-network || podman network create mirlo-api-network --opt isolate=true
|
|
'';
|
|
partOf = [ "podman-compose-mirlo-root.target" ];
|
|
wantedBy = [ "podman-compose-mirlo-root.target" ];
|
|
};
|
|
systemd.services."podman-network-mirlo-redis-network" = {
|
|
path = [ pkgs.podman ];
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
RemainAfterExit = true;
|
|
ExecStop = "${pkgs.podman}/bin/podman network rm -f mirlo-redis-network";
|
|
};
|
|
script = ''
|
|
podman network inspect mirlo-redis-network || podman network create mirlo-redis-network --opt isolate=true
|
|
'';
|
|
partOf = [ "podman-compose-mirlo-root.target" ];
|
|
wantedBy = [ "podman-compose-mirlo-root.target" ];
|
|
};
|
|
|
|
# Root service
|
|
# When started, this will automatically create all resources and start
|
|
# the containers. When stopped, this will teardown all resources.
|
|
systemd.targets."podman-compose-mirlo-root" = {
|
|
unitConfig = {
|
|
Description = "Root target generated by compose2nix.";
|
|
};
|
|
wantedBy = [ "multi-user.target" ];
|
|
};
|
|
}
|