Skip to content

Commit

Permalink
Merge pull request #401 from input-output-hk/extra-playground-instances
Browse files Browse the repository at this point in the history
Extra playground instances
  • Loading branch information
shmish111 committed Dec 7, 2018
2 parents 6fb21fa + 0952f66 commit 0634ef2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 36 deletions.
64 changes: 29 additions & 35 deletions plutus-playground/deployment/nixops/playground.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
{ mkInstance = { playground, defaultMachine, machines, ... }: node: { config, pkgs, lib, ... }:
let playgroundInstance = port: {
wantedBy = [ "nginx.service" ];
before = [ "nginx.service" ];
enable = true;
path = [
"${playground.plutus-server-invoker}"
];

serviceConfig = {
TimeoutStartSec = "0";
Restart = "always";
User = "plutus";
PrivateTmp = true;
};

script = "plutus-playground-server webserver -b 127.0.0.1 -p ${port} ${playground.plutus-playground-client}";
};
in
{
imports = [ (defaultMachine node pkgs)
];
Expand Down Expand Up @@ -33,6 +51,11 @@

upstreams.playground.servers."127.0.0.1:4000" = {};
upstreams.playground.servers."127.0.0.1:4001" = {};
upstreams.playground.servers."127.0.0.1:4002" = {};
upstreams.playground.servers."127.0.0.1:4003" = {};
upstreams.playground.servers."127.0.0.1:4004" = {};
upstreams.playground.servers."127.0.0.1:4005" = {};

virtualHosts = {
"~." = {
listen = [{ addr = "0.0.0.0"; port = 80; }];
Expand All @@ -54,41 +77,12 @@
};
};

systemd.services.plutus-playground-1 = {
wantedBy = [ "nginx.service" ];
before = [ "nginx.service" ];
enable = true;
path = [
"${playground.plutus-server-invoker}"
];

serviceConfig = {
TimeoutStartSec = "0";
Restart = "always";
User = "plutus";
PrivateTmp = true;
};

script = "plutus-playground-server webserver -b 127.0.0.1 -p 4000 ${playground.plutus-playground-client}";
};

systemd.services.plutus-playground-2 = {
wantedBy = [ "nginx.service" ];
before = [ "nginx.service" ];
enable = true;
path = [
"${playground.plutus-server-invoker}"
];

serviceConfig = {
TimeoutStartSec = "0";
Restart = "always";
User = "plutus";
PrivateTmp = true;
};

script = "plutus-playground-server webserver -b 127.0.0.1 -p 4001 ${playground.plutus-playground-client}";
};
systemd.services.plutus-playground-0 = playgroundInstance "4000";
systemd.services.plutus-playground-1 = playgroundInstance "4001";
systemd.services.plutus-playground-2 = playgroundInstance "4002";
systemd.services.plutus-playground-3 = playgroundInstance "4003";
systemd.services.plutus-playground-4 = playgroundInstance "4004";
systemd.services.plutus-playground-5 = playgroundInstance "4005";

};
}
2 changes: 1 addition & 1 deletion plutus-playground/plutus-playground-client/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ in {

name = "plutus-playground-client";

buildInputs = [ nodejs yarn git cacert purescript yarnDeps.offline_cache ];
buildInputs = [ nodejs yarn git cacert purescript yarnDeps.offline_cache python2 ];

bowerComponents = pkgs.buildBowerComponents {
name = "my-web-app";
Expand Down

0 comments on commit 0634ef2

Please sign in to comment.