Deploy error: Protocol is not included in the list

Hello there,

I am trying to deploy an elixir/Phoenix app. This is my fly.toml :

# fly.toml file generated for crimson-wildflower-1711 on 2021-09-17T00:18:57-07:00

app = "crimson-wildflower-1711"

kill_signal = "SIGTERM"
kill_timeout = 5
processes = []

[env]
  auto_rollback = false
  PORT = 8080

[experimental]
  allowed_public_ports = []
  auto_rollback = true

[[services]]
  http_checks = []
  internal_port = 4000
  processes = ["app"]
  protocol = "https"
  script_checks = []

  [services.concurrency]
    hard_limit = 500
    soft_limit = 250
    type = "requests"

  [[services.ports]]
    handlers = ["https"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "https"]
    port = 443

  [[services.https_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 6
    timeout = "2s"
    method = "get"
    path = "/"
    protocol = "https"
    [services.https_checks.headers]

and my error is:

Error Services [0] Protocol is not included in the list

Any help would be great! Also, here’s my dockerfile:

###
### Fist Stage - Building the Release
###
FROM hexpm/elixir:1.12.1-erlang-24.0.1-alpine-3.13.3 AS build

# install build dependencies
RUN apk add --no-cache build-base npm

# prepare build dir
WORKDIR /app

# extend hex timeout
ENV HEX_HTTP_TIMEOUT=20

# install hex + rebar
RUN mix local.hex --force && \
    mix local.rebar --force

# set build ENV as prod
ENV MIX_ENV=prod
ENV SECRET_KEY_BASE=nokey

# Copy over the mix.exs and mix.lock files to load the dependencies. If those
# files don't change, then we don't keep re-fetching and rebuilding the deps.
COPY mix.exs mix.lock ./
COPY config config

RUN mix deps.get --only prod && \
    mix deps.compile

# install npm dependencies
COPY assets/package.json assets/package-lock.json ./assets/
RUN npm --prefix ./assets ci --progress=false --no-audit --loglevel=error

COPY priv priv
COPY assets assets

# NOTE: If using TailwindCSS, it uses a special "purge" step and that requires
# the code in `lib` to see what is being used. Uncomment that here before
# running the npm deploy script if that's the case.
COPY lib lib

# build assets
RUN npm run --prefix ./assets deploy
RUN mix phx.digest

# copy source here if not using TailwindCSS
COPY lib lib

# compile and build release
COPY rel rel
RUN mix do compile, release

###
### Second Stage - Setup the Runtime Environment
###

# prepare release docker image
FROM alpine:3.13.3 AS app
RUN apk add --no-cache libstdc++ openssl ncurses-libs

WORKDIR /app

RUN chown nobody:nobody /app

USER nobody:nobody

COPY --from=build --chown=nobody:nobody /app/_build/prod/rel/fly ./

ENV HOME=/app
ENV MIX_ENV=prod
ENV SECRET_KEY_BASE=nokey
ENV PORT=4000
EXPOSE 8080

CMD ["bin/fly", "start"]

This is strange! protocol should be tcp here. Is this a config we generated for you?

I might have edited it in error. I adjust per your comment but was still unsuccessful:

Recent Logs
2021-09-18T07:11:48Z [info] Shutting down virtual machine
2021-09-18T07:11:48Z [info] Sending signal SIGTERM to main child process w/ PID 510
2021-09-18T07:11:48Z [info] 07:11:48.967 [info] SIGTERM received - shutting down
2021-09-18T07:11:51Z [info] Main child exited normally with code: 0
2021-09-18T07:11:51Z [info] Starting clean up.
2021-09-18T07:11:52Z [info] Health check status changed 'critical' => 'passing'
2021-09-18T07:11:54Z [info] Starting instance
2021-09-18T07:11:54Z [info] Configuring virtual machine
2021-09-18T07:11:54Z [info] Pulling container image
2021-09-18T07:11:54Z [info] Unpacking image
2021-09-18T07:11:54Z [info] Preparing kernel init
2021-09-18T07:11:55Z [info] Configuring firecracker
2021-09-18T07:11:55Z [info] Starting virtual machine
2021-09-18T07:11:55Z [info] Starting init (commit: 9445492)...
2021-09-18T07:11:55Z [info] Running: `bin/fly start` as nobody
2021-09-18T07:11:55Z [info] 2021/09/18 07:11:55 listening on [fdaa:0:337a:a7b:ad1:5d6b:b273:2]:22 (DNS: [fdaa::3]:53)
2021-09-18T07:11:55Z [info] Starting Elixir app: prod, DB=
2021-09-18T07:11:56Z [info] Reaped child process with pid: 551, exit code: 0
2021-09-18T07:11:57Z [info] =ERROR REPORT==== 18-Sep-2021::07:11:57.968412 ===
2021-09-18T07:11:57Z [info] Invalid -name given to erl,
2021-09-18T07:11:58Z [info] =ERROR REPORT==== 18-Sep-2021::07:11:57.968412 ===
2021-09-18T07:11:58Z [info] Invalid -name given to erl,
2021-09-18T07:11:58Z [info] 07:11:58.020 [info] Running FlyWeb.Endpoint with cowboy 2.9.0 at :::8080 (http)
2021-09-18T07:11:58Z [info] 07:11:58.024 [info] Access FlyWeb.Endpoint at http://crimson-wildflower-1711.fly.dev
2021-09-18T07:11:58Z [info] Reaped child process with pid: 572 and signal: SIGUSR1, core dumped? false
2021-09-18T07:13:13Z [info] Shutting down virtual machine
2021-09-18T07:13:13Z [info] Sending signal SIGTERM to main child process w/ PID 510
2021-09-18T07:13:13Z [info] 07:13:13.127 [info] SIGTERM received - shutting down
2021-09-18T07:13:16Z [info] Main child exited normally with code: 0
2021-09-18T07:13:16Z [info] Starting clean up.
***v10 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v11 

# fly.toml file generated for crimson-wildflower-1711 on 2021-09-17T00:18:57-07:00

app = "crimson-wildflower-1711"

kill_signal = "SIGTERM"
kill_timeout = 5
processes = []

[env]
  auto_rollback = false
  PORT = 8080

[experimental]
  allowed_public_ports = []
  auto_rollback = true

[[services]]
  http_checks = []
  internal_port = 4000
  processes = ["app"]
  protocol = "tcp"
  script_checks = []

  [services.concurrency]
    hard_limit = 500
    soft_limit = 250
    type = "requests"

  [[services.ports]]
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 6
    timeout = "2s"
    method = "get"
    path = "/"
    protocol = "tcp"
    [services.tcp_checks.headers]

This is likely the problem. Do you have an environment.sh or environment.sh.ex somewhere? It might be trying to set -name to a blank environment variable.

Hi I don’t have anything by that name. These are my environment variables when I type in flyctl config env :

Environment variables
NAME VALUE
PORT 8080
auto_rollback f

here are two files which sound close to what you’re referring to:

env.bat.eex

@echo off
rem Set the release to work across nodes. If using the long name format like
rem the one below (my_app@127.0.0.1), you need to also uncomment the
rem RELEASE_DISTRIBUTION variable below. Must be "sname", "name" or "none".
rem set RELEASE_DISTRIBUTION=name
rem set RELEASE_NODE=<%= @release.name %>@127.0.0.1

env.sh.eex

#!/bin/sh

echo "Starting Elixir app: $MIX_ENV, DB=$DATABASE_URL"

ip=$(grep fly-local-6pn /etc/hosts | cut -f 1)
export RELEASE_DISTRIBUTION=name
export RELEASE_NODE=$crimson-wildflower-1711@$fe80::929c:4aff:febd:e92d
export ELIXIR_ERL_OPTIONS="-proto_dist inet6_tcp"

Try changing the env.sh.eex file RELEASE_NODE line to this:

export RELEASE_NODE=$FLY_APP_NAME@$ip

That should get interpolated at runtime.

v12 failed - Failed due to unhealthy allocations - no stable job version to auto revert to
Failed Instances

==> Failure #1

Instance
  ID            = 2a045814             
  Task          =                      
  Version       = 12                   
  Region        = sjc                  
  Desired       = run                  
  Status        = failed               
  Health Checks = 1 total, 1 critical  
  Restarts      = 2                    
  Created       = 59m9s ago            

Recent Events
TIMESTAMP            TYPE             MESSAGE                                                         
2021-09-20T20:30:24Z Received         Task received by client                                         
2021-09-20T20:30:24Z Task Setup       Building Task Directory                                         
2021-09-20T20:30:27Z Started          Task started by client                                          
2021-09-20T20:31:44Z Restart Signaled healthcheck: check "0a33a4f86fa24b92a038e7a2786f7e82" unhealthy 
2021-09-20T20:31:49Z Terminated       Exit Code: 0                                                    
2021-09-20T20:31:49Z Restarting       Task restarting in 1.19408766s                                  
2021-09-20T20:31:55Z Started          Task started by client                                          
2021-09-20T20:33:12Z Restart Signaled healthcheck: check "0a33a4f86fa24b92a038e7a2786f7e82" unhealthy 
2021-09-20T20:33:17Z Terminated       Exit Code: 0                                                    
2021-09-20T20:33:17Z Restarting       Task restarting in 1.116509507s                                 
2021-09-20T20:33:24Z Started          Task started by client                                          
2021-09-20T20:34:41Z Restart Signaled healthcheck: check "0a33a4f86fa24b92a038e7a2786f7e82" unhealthy 
2021-09-20T20:34:46Z Terminated       Exit Code: 0                                                    
2021-09-20T20:34:46Z Not Restarting   Exceeded allowed attempts 2 in interval 5m0s and mode is "fail" 
2021-09-20T20:34:46Z Alloc Unhealthy  Unhealthy because of failed task                                
2021-09-20T20:34:46Z Killing          Sent interrupt. Waiting 5s before force killing                 

Recent Logs
***v12 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v13 

Where can I find my allocations to check their health? Do they need a vaccine?

That means the application is exiting, though code 0 means it probably didn’t crash.

You should be able to see any log output with fly logs -i 2a045814. That will hopefully give you an indication.

I’m not sure what I’m to be looking for here. The last line says the health check status changed to healthy, but also it doesn’t point to anything in my code that could be the issue:

2021-09-20T20:30:24.741640851Z runner[2a045814] sjc [info] Starting instance
2021-09-20T20:30:24.757177330Z runner[2a045814] sjc [info] Configuring virtual machine
2021-09-20T20:30:24.758087351Z runner[2a045814] sjc [info] Pulling container image
2021-09-20T20:30:26.735076830Z runner[2a045814] sjc [info] Unpacking image
2021-09-20T20:30:27.135858442Z runner[2a045814] sjc [info] Preparing kernel init
2021-09-20T20:30:27.529098216Z runner[2a045814] sjc [info] Configuring firecracker
2021-09-20T20:30:27.624877690Z runner[2a045814] sjc [info] Starting virtual machine
2021-09-20T20:30:27.748735274Z app[2a045814] sjc [info] Starting init (commit: 50ffe20)...
2021-09-20T20:30:27.762332824Z app[2a045814] sjc [info] Preparing to run: `bin/fly start` as nobody
2021-09-20T20:30:27.768262826Z app[2a045814] sjc [info] 2021/09/20 20:30:27 listening on [fdaa:0:337a:a7b:ad1:2a04:5814:2]:22 (DNS: [fdaa::3]:53)
2021-09-20T20:30:27.777167107Z app[2a045814] sjc [info] Starting Elixir app: prod, DB=
2021-09-20T20:30:28.767491016Z app[2a045814] sjc [info] Reaped child process with pid: 547, exit code: 0
2021-09-20T20:30:30.156215508Z app[2a045814] sjc [info] 20:30:30.155 [info] Running FlyWeb.Endpoint with cowboy 2.9.0 at :::8080 (http)
2021-09-20T20:30:30.158344459Z app[2a045814] sjc [info] 20:30:30.158 [info] Access FlyWeb.Endpoint at http://crimson-wildflower-1711.fly.dev
2021-09-20T20:30:30.769872484Z app[2a045814] sjc [info] Reaped child process with pid: 568 and signal: SIGUSR1, core dumped? false
2021-09-20T20:30:42.456950021Z proxy[2a045814] sjc [error] Health check status changed 'warning' => 'critical'
2021-09-20T20:31:44.683417193Z runner[2a045814] sjc [info] Shutting down virtual machine
2021-09-20T20:31:44.779541774Z app[2a045814] sjc [info] Sending signal SIGTERM to main child process w/ PID 510
2021-09-20T20:31:44.782926984Z app[2a045814] sjc [info] 20:31:44.779 [info] SIGTERM received - shutting down
2021-09-20T20:31:47.783330318Z app[2a045814] sjc [info] Main child exited normally with code: 0
2021-09-20T20:31:47.783574012Z app[2a045814] sjc [info] Starting clean up.
2021-09-20T20:31:54.975788441Z runner[2a045814] sjc [info] Starting instance
2021-09-20T20:31:54.991864205Z runner[2a045814] sjc [info] Configuring virtual machine
2021-09-20T20:31:54.992845021Z runner[2a045814] sjc [info] Pulling container image
2021-09-20T20:31:55.359483036Z runner[2a045814] sjc [info] Unpacking image
2021-09-20T20:31:55.362462774Z runner[2a045814] sjc [info] Preparing kernel init
2021-09-20T20:31:55.740941395Z runner[2a045814] sjc [info] Configuring firecracker
2021-09-20T20:31:55.831864720Z runner[2a045814] sjc [info] Starting virtual machine
2021-09-20T20:31:55.936504972Z app[2a045814] sjc [info] Starting init (commit: 50ffe20)...
2021-09-20T20:31:55.950085780Z app[2a045814] sjc [info] Preparing to run: `bin/fly start` as nobody
2021-09-20T20:31:55.956787280Z app[2a045814] sjc [info] 2021/09/20 20:31:55 listening on [fdaa:0:337a:a7b:ad1:2a04:5814:2]:22 (DNS: [fdaa::3]:53)
2021-09-20T20:31:55.964565138Z app[2a045814] sjc [info] Starting Elixir app: prod, DB=
2021-09-20T20:31:56.957110915Z app[2a045814] sjc [info] Reaped child process with pid: 547, exit code: 0
2021-09-20T20:31:58.346228485Z app[2a045814] sjc [info] 20:31:58.345 [info] Running FlyWeb.Endpoint with cowboy 2.9.0 at :::8080 (http)
2021-09-20T20:31:58.348475560Z app[2a045814] sjc [info] 20:31:58.348 [info] Access FlyWeb.Endpoint at http://crimson-wildflower-1711.fly.dev
2021-09-20T20:31:58.959931599Z app[2a045814] sjc [info] Reaped child process with pid: 568 and signal: SIGUSR1, core dumped? false
2021-09-20T20:32:04.469031013Z proxy[2a045814] sjc [warn] Health check status changed 'passing' => 'warning'
2021-09-20T20:32:13.743408409Z proxy[2a045814] sjc [error] Health check status changed 'warning' => 'critical'
2021-09-20T20:33:12.940850479Z runner[2a045814] sjc [info] Shutting down virtual machine
2021-09-20T20:33:13.147325576Z app[2a045814] sjc [info] Sending signal SIGTERM to main child process w/ PID 510
2021-09-20T20:33:13.150384185Z app[2a045814] sjc [info] 20:33:13.147 [info] SIGTERM received - shutting down
2021-09-20T20:33:16.153367219Z app[2a045814] sjc [info] Main child exited normally with code: 0
2021-09-20T20:33:16.153603789Z app[2a045814] sjc [info] Starting clean up.
2021-09-20T20:33:23.085190376Z runner[2a045814] sjc [info] Starting instance
2021-09-20T20:33:23.099989401Z runner[2a045814] sjc [info] Configuring virtual machine
2021-09-20T20:33:23.100955830Z runner[2a045814] sjc [info] Pulling container image
2021-09-20T20:33:23.770181197Z runner[2a045814] sjc [info] Unpacking image
2021-09-20T20:33:23.773222153Z runner[2a045814] sjc [info] Preparing kernel init
2021-09-20T20:33:24.151268531Z runner[2a045814] sjc [info] Configuring firecracker
2021-09-20T20:33:24.230438505Z runner[2a045814] sjc [info] Starting virtual machine
2021-09-20T20:33:24.355185171Z app[2a045814] sjc [info] Starting init (commit: 50ffe20)...
2021-09-20T20:33:24.368915333Z app[2a045814] sjc [info] Preparing to run: `bin/fly start` as nobody
2021-09-20T20:33:24.375637622Z app[2a045814] sjc [info] 2021/09/20 20:33:24 listening on [fdaa:0:337a:a7b:ad1:2a04:5814:2]:22 (DNS: [fdaa::3]:53)
2021-09-20T20:33:24.383906314Z app[2a045814] sjc [info] Starting Elixir app: prod, DB=
2021-09-20T20:33:25.374849692Z app[2a045814] sjc [info] Reaped child process with pid: 547, exit code: 0
2021-09-20T20:33:26.792729825Z app[2a045814] sjc [info] 20:33:26.792 [info] Running FlyWeb.Endpoint with cowboy 2.9.0 at :::8080 (http)
2021-09-20T20:33:26.794914131Z app[2a045814] sjc [info] 20:33:26.794 [info] Access FlyWeb.Endpoint at http://crimson-wildflower-1711.fly.dev
2021-09-20T20:33:27.377358464Z app[2a045814] sjc [info] Reaped child process with pid: 568 and signal: SIGUSR1, core dumped? false
2021-09-20T20:33:36.877865645Z proxy[2a045814] sjc [error] Health check status changed 'warning' => 'critical'
2021-09-20T20:34:41.192606679Z runner[2a045814] sjc [info] Shutting down virtual machine
2021-09-20T20:34:41.270016073Z app[2a045814] sjc [info] Sending signal SIGTERM to main child process w/ PID 510
2021-09-20T20:34:41.273332052Z app[2a045814] sjc [info] 20:34:41.270 [info] SIGTERM received - shutting down
2021-09-20T20:34:44.273290423Z app[2a045814] sjc [info] Main child exited normally with code: 0
2021-09-20T20:34:44.273552461Z app[2a045814] sjc [info] Starting clean up.
2021-09-20T20:34:45.738898741Z proxy[2a045814] sjc [info] Health check status changed 'critical' => 'passing'

How can I change my code to successfully deploy this app?

The issue was resolved by changing my [services] internal_port in my Fly.toml from 4000 to 8080!!