-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathguacamole.nomad.hcl
159 lines (132 loc) · 3.78 KB
/
guacamole.nomad.hcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
job "guacamole" {
datacenters = ["dc1","eu-west-2a","eu-west-2b","eu-west-2c","eu-west-2"]
group "database" {
count = 1
network {
port "db" {
static = 5432
}
}
service {
name = "postgres"
port = "db"
tags = ["database"]
check {
type = "tcp"
interval = "10s"
timeout = "2s"
}
}
task "init-script" {
driver = "raw_exec"
config {
command = "/bin/sh"
args = ["-c", "echo 'CREATE TABLE guacamole_entity (entity_id serial PRIMARY KEY, name varchar(128) NOT NULL UNIQUE, type varchar(32) NOT NULL); CREATE TABLE guacamole_user (entity_id integer PRIMARY KEY REFERENCES guacamole_entity(entity_id) ON DELETE CASCADE, username varchar(128) NOT NULL UNIQUE, password_hash bytea NOT NULL, password_salt bytea NOT NULL, password_date timestamp NOT NULL, disabled boolean NOT NULL DEFAULT false, expired boolean NOT NULL DEFAULT false, access_window_start time, access_window_end time, valid_from timestamp, valid_until timestamp, timezone varchar(64));' > ./tmp/local/postgres-init/initdb.sql"]
}
template {
data = <<EOF
#!/bin/bash
echo 'CREATE TABLE guacamole_entity (
entity_id serial PRIMARY KEY,
name varchar(128) NOT NULL UNIQUE,
type varchar(32) NOT NULL
);
CREATE TABLE guacamole_user (
entity_id integer PRIMARY KEY REFERENCES guacamole_entity(entity_id) ON DELETE CASCADE,
username varchar(128) NOT NULL UNIQUE,
password_hash bytea NOT NULL,
password_salt bytea NOT NULL,
password_date timestamp NOT NULL,
disabled boolean NOT NULL DEFAULT false,
expired boolean NOT NULL DEFAULT false,
access_window_start time,
access_window_end time,
valid_from timestamp,
valid_until timestamp,
timezone varchar(64)
);
-- Additional tables and indexes as required by Guacamole
-- Refer to the Guacamole schema documentation for a complete list of tables and indexes' > /local/postgres-init/initdb.sql
EOF
destination = "./tmp/local/postgres-init/initdb.sql"
}
lifecycle {
hook = "prestart"
}
resources {
cpu = 100
memory = 50
}
}
task "postgres" {
driver = "docker"
config {
image = "postgres:latest"
ports = ["db"]
env = {
POSTGRES_DB = "guacamole_db"
POSTGRES_USER = "guacamole_user"
POSTGRES_PASSWORD = "your-secure-password"
}
volumes = [
"./tmp/local/postgres-init:/docker-entrypoint-initdb.d"
]
}
resources {
cpu = 500
memory = 512
}
}
}
group "guacamole" {
count = 1
network {
port "guacamole" {
static = 8080
}
}
service {
name = "guacamole"
port = "guacamole"
tags = ["web"]
check {
type = "http"
path = "/"
interval = "10s"
timeout = "2s"
}
}
task "guacamole" {
driver = "docker"
config {
image = "guacamole/guacamole:latest"
ports = ["guacamole"]
env = {
GUACAMOLE_HOME = "/guacamole"
POSTGRES_HOSTNAME = "postgres.service.consul"
POSTGRES_PORT = "5432"
POSTGRES_DATABASE = "guacamole_db"
POSTGRES_USER = "guacamole_user"
POSTGRES_PASSWORD = "your-secure-password"
}
volumes = [
"local/guacamole:/guacamole"
]
}
resources {
cpu = 500
memory = 256
}
}
task "guacd" {
driver = "docker"
config {
image = "guacamole/guacd:latest"
}
resources {
cpu = 500
memory = 256
}
}
}
}