-
Notifications
You must be signed in to change notification settings - Fork 3
/
nginxproxymanager.tf
84 lines (61 loc) · 1.7 KB
/
nginxproxymanager.tf
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
resource "docker_image" "npm" {
name = "jc21/nginx-proxy-manager:latest"
keep_locally = true
}
resource "docker_image" "db" {
name = "jc21/mariadb-aria:latest"
keep_locally = true
}
resource "docker_container" "nginx_proxy_manager_db" {
name = "npm-db"
image = docker_image.db.image_id
restart = "always"
hostname = "db"
env = ["MYSQL_ROOT_PASSWORD=npm", "MYSQL_DATABASE=npm", "MYSQL_USER=npm", "MYSQL_PASSWORD=npm"]
### Path to the mysql DB. Change the host_path to match your system
volumes {
container_path = "/var/lib/mysql"
host_path = "${var.appdata_prefix}/nginx/data/mysql"
}
}
### Default username/password [email protected]/changeme admin_url http://$HOST:81
resource "docker_container" "nginx_proxy_manager_app" {
name = "npm-app"
image = docker_image.npm.image_id
restart = "always"
## Makes nginx aware of the db container created previously
host {
host = "db"
ip = docker_container.nginx_proxy_manager_db.ip_address
}
ports {
external = 1880
internal = 80
ip = "0.0.0.0"
protocol = "tcp"
}
ports {
external = 81
internal = 81
ip = "0.0.0.0"
protocol = "tcp"
}
ports {
external = 18443
internal = 443
ip = "0.0.0.0"
protocol = "tcp"
}
env = ["DB_MYSQL_HOST=db", "DB_MYSQL_PORT=3306", "DB_MYSQL_USER=npm", "DB_MYSQL_PASSWORD=npm", "DB_MYSQL_NAME=npm"]
volumes {
container_path = "/etc/letsencrypt"
host_path = "${var.appdata_prefix}/nginx/letsencrypt"
}
volumes {
container_path = "/data"
host_path = "${var.appdata_prefix}/nginx/data"
}
depends_on = [
docker_container.nginx_proxy_manager_db
]
}