-
-
Save pta2002/5f5f4ff56cd0b92511478ef08366152a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs, config, ... }: | |
let | |
containerInPod = pod: container: container // { | |
extraOptions = [ "--pod" pod ]; | |
}; | |
in { | |
# Very very hacky way to ensure that the feedbin pod exists! | |
systemd.services.init-feedbin-pods = { | |
description = "Create the pod for feedbin"; | |
after = [ "network.target" ]; | |
serviceConfig.Type = "oneshot"; | |
script = let podmancli = "${config.virtualisation.podman.package}/bin/podman"; | |
in '' | |
${podmancli} pod rm --force feedbin-pod || true | |
${podmancli} pod create --name feedbin-pod -p 9292:9292 || true | |
''; | |
}; | |
virtualisation.oci-containers = { | |
backend = "podman"; | |
containers = { | |
feedbin = (containerInPod "feedbin-pod" { | |
image = "pta2002/feedbin:latest"; | |
environment = { | |
RAILS_ENV = "production"; | |
RACK_ENV = "production"; | |
SECRET_KEY_BASE = "very very secret!!"; | |
DATABASE_URL = "postgres://feedbin:feedbin@localhost:5432/feedbin"; | |
REDIS_URL = "redis://localhost:6379"; | |
FEEDBIN_HOST = "feedbin.pta2002.com"; | |
MEMCACHED_HOSTS = "localhost:11211"; | |
ELASTICSEARCH_URL = "http://localhost:9200"; | |
EXTRACT_HOST = "localhost"; | |
EXTRACT_PORT = "3000"; | |
EXTRACT_SECRET = "extract"; | |
EXTRACT_USER = "extract"; | |
}; | |
}); | |
feedbin-extract = (containerInPod "feedbin-pod" { | |
image = "pta2002/feedbin-extract"; | |
environment = { | |
EXTRACT_USER = "extract"; | |
EXTRACT_SECRET = "extract"; | |
}; | |
}); | |
feedbin-refresher = (containerInPod "feedbin-pod" { | |
image = "pta2002/feedbin-refresher:latest"; | |
environment = { | |
REDIS_URL = "redis://localhost:6379"; | |
}; | |
}); | |
postgres = (containerInPod "feedbin-pod" { | |
image = "postgres"; | |
environment = { | |
POSTGRES_PASSWORD = "feedbin"; | |
POSTGRES_USER = "feedbin"; | |
POSTGRES_DB = "feedbin"; | |
}; | |
volumes = [ "postgresql_data:/var/lib/postgresql/data" ]; | |
}); | |
elasticsearch = (containerInPod "feedbin-pod" { | |
image = "elasticsearch:2.4"; | |
}); | |
memcached = (containerInPod "feedbin-pod" { | |
image = "memcached"; | |
}); | |
redis = (containerInPod "feedbin-pod" { | |
image = "redis"; | |
}); | |
}; | |
}; | |
services.nginx.virtualHosts."feedbin.pta2002.com" = { | |
enableACME = true; | |
forceSSL = true; | |
locations."/".proxyPass = "http://localhost:9292"; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment