Skip to content

Commit

Permalink
Added: swarm gateway labels and migrate state
Browse files Browse the repository at this point in the history
  • Loading branch information
capcom6 committed Aug 3, 2023
1 parent e0ff502 commit 20ea4ed
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
4 changes: 2 additions & 2 deletions deployments/docker-swarm-terraform/backend.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
backend "s3" {
bucket = "cq55609-bread"
key = "terraform/terraform.tfstate"
bucket = "38e04e71-private"
key = "terraform/django-bread.tfstate"
region = "ru-1"
endpoint = "s3.timeweb.com"

Expand Down
19 changes: 17 additions & 2 deletions deployments/docker-swarm-terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ resource "docker_service" "app" {

task_spec {
container_spec {
image = docker_image.app.image_id
image = docker_image.app.name

env = {
WEBSITE_HOSTNAME = var.app-host
Expand All @@ -49,7 +49,7 @@ resource "docker_service" "app" {

resources {
limits {
nano_cpus = var.cpu-limit
# nano_cpus = var.cpu-limit
memory_bytes = var.memory-limit
}

Expand All @@ -60,6 +60,21 @@ resource "docker_service" "app" {
}
}

# Swarm Gateway support
labels {
label = "gateway.enabled"
value = true
}
labels {
label = "gateway.server.host"
value = var.app-host
}
labels {
label = "gateway.server.port"
value = 8000
}

# Traefik support
labels {
label = "traefik.enable"
value = true
Expand Down

0 comments on commit 20ea4ed

Please sign in to comment.