threefoldtech / terraform-provider-grid

Apache License 2.0
8 stars 5 forks source link

Peertube Deployment gives Bad Gateway #312

Closed mohamedamer453 closed 1 year ago

mohamedamer453 commented 2 years ago

Description

After successfully deploying a peertube instance through terraform on qanet i tried to access the instance but i got a Bad Gateway

image

and when i tried to ssh to the vm to get the zinit logs i got the following error

ssh: connect to host 300:8c6c:fabd:b329:2269:276:a701:352d port 22: Connection refused

image

Deployment Output

https://gist.github.com/mohamedamer453/eafafc50a036d2584c693dd32bc4bc46

main.tf

  terraform {
    required_providers {
      grid = {
        source = "threefoldtech/grid"
      }
    }
  }

  provider "grid" {
  }

  # this data source is used to break circular dependency in cases similar to the following:
  # vm: needs to know the domain in its init script
  # gateway_name: needs the ip of the vm to use as backend.
  # - the fqdn can be computed from grid_gateway_domain for the vm
  # - the backend can reference the vm ip directly 
  data "grid_gateway_domain" "domain" {
    node = 3
    name = "testpeertube"
  }
  resource "grid_network" "net1" {
      nodes = [3]
      ip_range = "10.1.0.0/16"
      name = "network"
      description = "newer network"
      add_wg_access = true
  }
  resource "grid_deployment" "d1" {
    node = 3
    network_name = grid_network.net1.name
    ip_range = lookup(grid_network.net1.nodes_ip_range, 3, "")
    vms {
      name = "vm1"
      flist = "https://hub.grid.tf/tf-official-apps/peertube-v3.1.1.flist"
      cpu = 2 
      # publicip = true
      entrypoint = "/usr/local/bin/entrypoint.sh"
      memory = 4096
      env_vars = {
        SSH_KEY = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC533B35CELELtgg2d7Tsi5KelLxR0FYUlrcTmRRQuTNP9arP01JYD8iHKqh6naMbbzR8+M0gdPEeRK4oVqQtEcH1C47vLyRI/4DqahAE2nTW08wtJM5uiIvcQ9H2HMzZ3MXYWWlgyHMgW2QXQxzrRS0NXvsY+4wxe97MMZs9MDs+d+X15DfG6JffjMHydi+4tHB50WmHe5tFscBFxLbgDBUxNGiwi3BQc1nWIuYwMMV1GFwT3ndyLAp19KPkEa/dffiqLdzkgs2qpXtfBhTZ/lFeQRc60DHCMWExr9ySDbavIMuBFylf/ZQeJXm9dFXJN7bBTbflZIIuUMjmrI7cU5eSuZqAj5l+Yb1mLN8ljmKSIM3/tkKbzXNH5AUtRVKTn+aEPvJAEYtserAxAP5pjy6nmegn0UerEE3DWEV2kqDig3aPSNhi9WSCykvG2tz7DIr0UP6qEIWYMC/5OisnSGj8w8dAjyxS9B0Jlx7DEmqPDNBqp8UcwV75Cot8vtIac= root@mohamed-Inspiron-3576"
        PEERTUBE_DB_SUFFIX = "_prod"
        PEERTUBE_DB_USERNAME = "peertube"
        PEERTUBE_DB_PASSWORD = "peertube"
        PEERTUBE_ADMIN_EMAIL = "support@threefold.com"
        PEERTUBE_WEBSERVER_HOSTNAME = data.grid_gateway_domain.domain.fqdn
        PEERTUBE_WEBSERVER_PORT = 443
        PEERTUBE_SMTP_HOSTNAME = "https://app.sendgrid.com"
        PEERTUBE_SMTP_USERNAME = "sendgridusername"
        PEERTUBE_SMTP_PASSWORD = "sendgridpassword"
        PEERTUBE_BIND_ADDRESS = "::",
      }
      planetary = true
    }
  }
  resource "grid_name_proxy" "p1" {
    node = 3
    name = "testpeertube"
    backends = [format("http://[%s]:9000", grid_deployment.d1.vms[0].ygg_ip)]
    tls_passthrough = false
  }
  output "fqdn" {
      value = data.grid_gateway_domain.domain.fqdn
  }
  output "node1_zmachine1_ip" {
      value = grid_deployment.d1.vms[0].ip
  }
  # output "public_ip" {
  #     value = split("/",grid_deployment.d1.vms[0].computedip)[0]
  # }

  output "ygg_ip" {
      value = grid_deployment.d1.vms[0].ygg_ip
  }
MarioBassem commented 2 years ago

https://github.com/threefoldtech/terraform-provider-grid/pull/317

khaledyoussef24 commented 2 years ago

tested also on qanet but the problem still exist

steps made to check the problem:

  1. deploy peertube
  2. try to connect and to ssh on the ip
  3. and accessing the website gives 404 error Screenshot from 2022-09-24 17-16-27 Screenshot from 2022-09-24 17-16-01 Screenshot from 2022-09-24 17-15-40
khaledyoussef24 commented 2 years ago

tested on dev net the problem still exist

Screenshot from 2022-10-09 10-56-55 Screenshot from 2022-10-09 10-57-10 Screenshot from 2022-10-09 11-05-21