Hi,
I have Dockerfile, shell script and an ftly.toml config file in same directory
My dockerfile
FROM listmonk/listmonk:latest
ARG PORT ADMIN_USERNAME ADMIN_PASSWORD POSTGRES_HOST POSTGRES_PORT POSTGRES_USER POSTGRES_PASSWORD POSTGRES_DATABASE
ENV LISTMONK_APP__ADDRESS="0.0.0.0:${PORT}" \
LISTMONK_APP__ADMIN_USERNAME="${ADMIN_USERNAME}" \
LISTMONK_APP__ADMIN_PASSWORD="${ADMIN_PASSWORD}" \
LISTMONK_DB__HOST="${POSTGRES_HOST}" \
LISTMONK_DB__PORT=${POSTGRES_PORT} \
LISTMONK_DB__USER="${POSTGRES_USER}" \
LISTMONK_DB__PASSWORD="${POSTGRES_PASSWORD}" \
LISTMONK_DB__DATABASE="${POSTGRES_DATABASE}" \
LISTMONK_DB__SSL_MODE="disable" \
LISTMONK_DB__MAX_OPEN=3 \
LISTMONK_DB__MAX_IDLE=1
RUN ./listmonk --config="" --idempotent --yes --upgrade || ./listmonk --config="" --install --yes --upgrade
EXPOSE 8080
my shell script
#!/bin/bash
# Local .env
if [ -f .env ]; then
# Load Environment Variables for local development
echo "Loading .env"
export $(cat .env | awk '/=/ {print $1}')
fi
flyctl deploy \
--build-arg PORT="${PORT}" \
--build-arg ADMIN_USERNAME="${ADMIN_USERNAME}" \
--build-arg ADMIN_PASSWORD="${ADMIN_PASSWORD}" \
--build-arg POSTGRES_HOST="${POSTGRES_HOST}" \
--build-arg POSTGRES_PORT="${POSTGRES_PORT}" \
--build-arg POSTGRES_USER="${POSTGRES_USER}" \
--build-arg POSTGRES_PASSWORD="${POSTGRES_PASSWORD}" \
--build-arg POSTGRES_DATABASE="${POSTGRES_DATABASE}" \
--build-arg POSTGRES_SSL_MODE="disable" \
--build-arg POSTGRES_MAX_OPEN=3 \
--build-arg POSTGRES_MAX_IDLE=1 \
-c fly.toml \
--no-cache
# fly.toml file generated for email on 2022-12-14T22:56:57Z
app = "email"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
[env]
[experimental]
allowed_public_ports = []
auto_rollback = true
[[services]]
http_checks = []
internal_port = 8080
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"
I deploy this application with ./deploy.sh
but it fails healthcheck and I can not get any logs. I followed Troubleshooting your Deployment · Fly Docs but I am curious how can I debug this problem ?
I also changed my docker file as follows, I was hoping with following change I can ssh into machine and see what is the story but I no luck
FROM listmonk/listmonk:latest
ARG PORT ADMIN_USERNAME ADMIN_PASSWORD POSTGRES_HOST POSTGRES_PORT POSTGRES_USER POSTGRES_PASSWORD POSTGRES_DATABASE
ENV LISTMONK_APP__ADDRESS="0.0.0.0:${PORT}" \
LISTMONK_APP__ADMIN_USERNAME="${ADMIN_USERNAME}" \
LISTMONK_APP__ADMIN_PASSWORD="${ADMIN_PASSWORD}" \
LISTMONK_DB__HOST="${POSTGRES_HOST}" \
LISTMONK_DB__PORT=${POSTGRES_PORT} \
LISTMONK_DB__USER="${POSTGRES_USER}" \
LISTMONK_DB__PASSWORD="${POSTGRES_PASSWORD}" \
LISTMONK_DB__DATABASE="${POSTGRES_DATABASE}" \
LISTMONK_DB__SSL_MODE="disable" \
LISTMONK_DB__MAX_OPEN=3 \
LISTMONK_DB__MAX_IDLE=1
# RUN ./listmonk --config="" --idempotent --yes --upgrade || ./listmonk --config="" --install --yes --upgrade
ENTRYPOINT ["tail", "-f", "/dev/null"]
EXPOSE 8080
How can user debug this issue? (port variable is set to 8080)
kurt
December 16, 2022, 3:39pm
2
That last change is close, but you’ll need to set a blank services entry in your fly.toml
to turn off health checks and services:
# fly.toml file generated for email on 2022-12-14T22:56:57Z
app = "email"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
services = []
[env]
[experimental]
allowed_public_ports = []
auto_rollback = true
When health checks fail, it’s often because the app is only listening on localhost
: Troubleshooting your Deployment · Fly Docs
Most apps have a config option to let them listen on 0.0.0.0
.
Thanks @kurt for your time. I am already listening port 0.0.0.0 and when I apply your suggestion,
# fly.toml file generated for email on 2022-12-14T22:56:57Z
app = "email"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
services = []
[experimental]
allowed_public_ports = []
auto_rollback = true
[[services]]
http_checks = []
internal_port = 8080
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"
This gives me an error of
failed loading app config from fly.toml: toml: line 14: Key 'services' was already created and cannot be used as an array
I checked App Configuration (fly.toml) · Fly Docs doc as reference but I couldn’t find anything to services = []
kurt
December 16, 2022, 4:10pm
4
Oh, yes. Use the config exactly as I pasted. You need to remove the entire [[services]]
block at the bottom for this to work.
@kurt thanks for your help again but I still can’t get anything from this app.
# fly.toml file generated for email on 2022-12-14T22:56:57Z
app = "email"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
services = []
[experimental]
allowed_public_ports = []
auto_rollback = true
I can’t get logs, I can’t ssh into this machine.
This is the error I am getting
--> v12 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v13
This dockerfile works fine when I build and run locally. Is there any way I can get some logs?
I also added --remote-only --no-cache
options to my build script to make sure I don’t encounter problems due to having mac M1.
I can’t event ssh
flyctl ssh console --app email
Update available 0.0.439 -> 0.0.440.
Run "flyctl version update" to upgrade.
Error no instances found for email
My last experiment
FROM listmonk/listmonk:latest
ARG PORT ADMIN_USERNAME ADMIN_PASSWORD POSTGRES_HOST POSTGRES_PORT POSTGRES_USER POSTGRES_PASSWORD POSTGRES_DATABASE
ENV LISTMONK_APP__ADDRESS="0.0.0.0:${PORT}" \
LISTMONK_APP__ADMIN_USERNAME="${ADMIN_USERNAME}" \
LISTMONK_APP__ADMIN_PASSWORD="${ADMIN_PASSWORD}" \
LISTMONK_DB__HOST="${POSTGRES_HOST}" \
LISTMONK_DB__PORT=${POSTGRES_PORT} \
LISTMONK_DB__USER="${POSTGRES_USER}" \
LISTMONK_DB__PASSWORD="${POSTGRES_PASSWORD}" \
LISTMONK_DB__DATABASE="${POSTGRES_DATABASE}" \
LISTMONK_DB__SSL_MODE="disable" \
LISTMONK_DB__MAX_OPEN=3 \
LISTMONK_DB__MAX_IDLE=1
CMD ["/bin/sh", "-ec", "while :; do echo '.'; sleep 5 ; done"]
EXPOSE 8080
# fly.toml file generated for email on 2022-12-14T22:56:57Z
app = "email"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
services = []
[env]
[experimental]
allowed_public_ports = []
auto_rollback = true
I deploy with --remote-machine --no-cache
.
I still can’t ssh into machine becuase machine somehow is never online, its bit frusturating to be honest
I manage to solve this issue, I deleted builder vm and redeployed it and it seems its working. Maybe there is some kind of caching that leaves configuration in bad state. I am not sure.
1 Like