gitea works with Postgre which is not exposed publicly, thanks to Consul Connect - the bug was that Nomad could not reach Consul's gRPC due to IPv4/6 mis-configuration

This commit is contained in:
LUXEY Adrien 2021-06-06 18:59:20 +02:00
parent 213e42f4ad
commit 1beced4c65
4 changed files with 55 additions and 19 deletions

View file

@ -12,7 +12,10 @@ job "gitea" {
network { network {
mode = "bridge" mode = "bridge"
port "http" { to = 3000 } port "http" {
static = 3000
to = 3000
}
port "ssh" { to = 22 } port "ssh" { to = 22 }
} }
@ -51,7 +54,7 @@ job "gitea" {
destination_name = "postgres" destination_name = "postgres"
local_bind_port = "5432" local_bind_port = "5432"
# Optional # Optional
# local_bind_address = "127.0.0.1" local_bind_address = "127.0.0.1"
} }
} }
} }
@ -99,9 +102,9 @@ EOH
} }
env { env {
DOMAIN = "gitea.hammerhead.luxeylab.net" DOMAIN = "gitea.hammerhead.luxeylab.net"
SSH_DOMAIN = "gitea.hammerhead.luxeylab.net" SSH_DOMAIN = "gitea.hammerhead.luxeylab.net"
DB_HOST = "${NOMAD_UPSTREAM_ADDR_postgres}" DB_HOST = "${NOMAD_UPSTREAM_ADDR_postgres}"
} }
} }
} }

View file

@ -4,29 +4,20 @@
"advertise_addr": "2001:41d0:8:ba0b::1", "advertise_addr": "2001:41d0:8:ba0b::1",
"addresses": { "addresses": {
"dns": "[::]", "dns": "[::]",
"http": "[::]" "http": "[::]",
"grpc": "[::]"
}, },
"retry_join": [
"2001:41d0:8:ba0b::1"
],
"bootstrap_expect": 1, "bootstrap_expect": 1,
"server": true, "server": true,
"ui": true, "ui_config": {
"enabled": true
},
"ports": { "ports": {
"dns": 53, "dns": 53,
"grpc": 8502 "grpc": 8502
}, },
"recursors": [
"213.186.33.99",
"172.104.136.243"
],
"encrypt": "2B2vxbfCRzu3Q29LEJAZBg==", "encrypt": "2B2vxbfCRzu3Q29LEJAZBg==",
"domain": "hammerhead.deuxfleurs.fr", "domain": "hammerhead.deuxfleurs.fr",
"performance": {
"raft_multiplier": 10,
"rpc_hold_timeout": "30s",
"leave_drain_time": "30s"
},
"connect": { "connect": {
"enabled": true "enabled": true
} }

View file

@ -0,0 +1,40 @@
{
"data_dir": "/var/lib/consul",
"bind_addr": "[::]",
"advertise_addr": "2001:41d0:8:ba0b::1",
"addresses": {
"dns": "[::]",
"http": "[::]"
},
"retry_join": [
"2001:41d0:8:ba0b::1"
],
"bootstrap_expect": 1,
"server": true,
"ui": {
"enabled": true
},
"acl": {
"enabled": true,
"default_policy": "deny",
"enable_token_persistence": true,
},
"ports": {
"dns": 53,
"grpc": 8502
},
"recursors": [
"213.186.33.99",
"172.104.136.243"
],
"encrypt": "2B2vxbfCRzu3Q29LEJAZBg==",
"domain": "hammerhead.deuxfleurs.fr",
"performance": {
"raft_multiplier": 10,
"rpc_hold_timeout": "30s",
"leave_drain_time": "30s"
},
"connect": {
"enabled": true
}
}

View file

@ -10,6 +10,8 @@ advertise {
serf = "2001:41d0:8:ba0b::1" serf = "2001:41d0:8:ba0b::1"
} }
bind_addr = "[::]"
data_dir = "/var/lib/nomad" data_dir = "/var/lib/nomad"
server { server {
@ -19,11 +21,11 @@ server {
consul { consul {
address = "[::1]:8500" address = "[::1]:8500"
grpc_address = "[::1]:8502"
} }
client { client {
enabled = true enabled = true
#cpu_total_compute = 4000
servers = ["[::1]:4648"] servers = ["[::1]:4648"]
network_interface = "eno1" network_interface = "eno1"
options { options {