Struggling to deploy a docker app sending emails

Hello everyone,
I’m trying to run a script sending email with docker. I guess I’m doing something wrong with port configuration but I don’t know what :sweat_smile:

Here are the logs I saw when trying to deploy

 1 desired, 1 placed, 0 healthy, 1 unhealthy [health checks: 1 total, 1 critical]
Failed Instances

Failure #1

Instance
ID      	PROCESS	VERSION	REGION	DESIRED	STATUS 	HEALTH CHECKS      	RESTARTS	CREATED   
2bcb1ae3	app    	0      	cdg   	run    	running	1 total, 1 critical	0       	4m53s ago	

Recent Events
TIMESTAMP           	TYPE      	MESSAGE                 
2023-02-27T06:27:39Z	Received  	Task received by client	
2023-02-27T06:27:39Z	Task Setup	Building Task Directory	
2023-02-27T06:28:02Z	Started   	Task started by client 	

2023-02-27T06:27:46Z   [info]Unpacking image
2023-02-27T06:27:53Z   [info]Preparing kernel init
2023-02-27T06:27:53Z   [info]Setting up volume 'appointment_data'
2023-02-27T06:27:53Z   [info]Uninitialized volume 'appointment_data', initializing...
2023-02-27T06:27:53Z   [info]Encrypting volume
2023-02-27T06:28:00Z   [info]Opening encrypted volume
2023-02-27T06:28:02Z   [info]Formatting volume
2023-02-27T06:28:02Z   [info]Configuring firecracker
2023-02-27T06:28:02Z   [info]Starting virtual machine
2023-02-27T06:28:02Z   [info]Starting init (commit: 08b4c2b)...
2023-02-27T06:28:02Z   [info]Mounting /dev/vdc at /data w/ uid: 0, gid: 0 and chmod 0755
2023-02-27T06:28:02Z   [info]Preparing to run: `python main.py` as root
2023-02-27T06:28:02Z   [info]2023/02/27 06:28:02 listening on [fdaa:0:b152:a7b:5adc:5:4907:2]:22 (DNS: [fdaa::3]:53)
--> v0 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v1 

And here is my fly.toml file (I guess I can remove http and https configuration sections which are not useful in my use case since I’m not running a http service)

# fly.toml file generated for appointment on 2023-02-27T07:20:14+01:00

app = "appointment"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]

[experimental]
  auto_rollback = true

[mounts]
  destination = "/data"
  source = "appointment_data"

[[services]]
  http_checks = []
  internal_port = 587
  processes = ["app"]
  protocol = "tcp"
  script_checks = []
  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

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

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

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"

if anyone can tell me what I am doing wrong, I would be grateful :slight_smile:

What’s the output of fly status -all? That likely has clues to what’s going on.

Also, in the logs you shared, I see this line

Mounting /dev/vdc at /data

So, the volume is mounting just fine.

Make sure the app is listening for connections and health checks on TCP port 587.

In the fly.toml config, try relaxing the TCP checks, like so:

[[services.tcp_checks]]
    grace_period = "10s"
    interval = "15s"
    restart_limit = 0
    timeout = "5s"

And see if that works?


I think you’re also missing a TCP service entry (ie don’t intend to use HTTP or TLS)

  [[services.ports]]
      port = 587 

Ref: New dox dropped: running UDP and TCP (concurrently) on Fly.io apps

Hi @ignoramous
the result of fly status --all is the following

App
  Name     = appointment          
  Owner    = personal             
  Version  = 0                    
  Status   = running              
  Hostname = appointment.fly.dev  
  Platform = nomad                

Deployment Status
  ID          = ebb11836-52cc-7d48-d6f1-660225eb00ca                                           
  Version     = v0                                                                             
  Status      = failed                                                                         
  Description = Failed due to unhealthy allocations - no stable job version to auto revert to  
  Instances   = 1 desired, 1 placed, 0 healthy, 1 unhealthy                                    

Instances
ID      	PROCESS	VERSION	REGION	DESIRED	STATUS 	HEALTH CHECKS      	RESTARTS	CREATED   
2bcb1ae3	app    	0      	cdg   	run    	running	1 total, 1 critical	0       	2h22m ago

I have tried your suggestions, but it still does not work

1 Like

I didn’t see your suggestion for TCP service entry, now I have this error :confused:

==> Verifying app config


Configuration errors in /home/lewoudar/PycharmProjects/workshops/appointment/fly.toml:

    ✘ base: Services defined at indexes: 0 require a dedicated IP address. You currently have a shared IPv4 assigned to your app (`fly ips list`). Release the shared IP (`fly ips release <shared ip>`) and/or allocate only dedicated IPs before deploying (`fly ips allocate-v4` and/or `fly ips allocate-v6`). Affected services: 
  [0] tcp/587,80,443 => 587

Error App configuration is not valid

Like the log says, for a raw TCP service you’d need a dedicated IP. It seems like the app has a shared IP assigned too (announcement), which you can safely release.

# IPv6 is free, each IPv4 costs $2/mo
fly ips allocate-v6 -a appointment 
fly ips allocate-v4 -a appointment 

See if deploy then works after?

thanks for the tips, even when I released the IPv4 address, I still encountered the same deployment error :frowning:

App
  Name     = appointment          
  Owner    = personal             
  Version  = 2                    
  Status   = running              
  Hostname = appointment.fly.dev  
  Platform = nomad                

Deployment Status
  ID          = 2343ae7d-0fbe-5752-9843-52d8e0697dec                                           
  Version     = v2                                                                             
  Status      = failed                                                                         
  Description = Failed due to unhealthy allocations - no stable job version to auto revert to  
  Instances   = 1 desired, 1 placed, 0 healthy, 1 unhealthy                                    

Instances
ID      	PROCESS	VERSION	REGION	DESIRED	STATUS 	HEALTH CHECKS      	RESTARTS	CREATED   
2bcb1ae3	app    	2      	cdg   	run    	running	2 total, 2 critical	0       	4h52m ago

Can you share relevant logs?

Also, don’t forget to allocate dedicated IPv6 / IPv4 (as mentioned above).