# Project not respecting fly.toml

**URL:** <https://community.fly.io/t/project-not-respecting-fly-toml/21153>\
**Category:** Questions / Help\
**Tags:** machines, login-only\
**Created:** [August 6, 2024, 12:04am UTC](https://community.fly.io/t/project-not-respecting-fly-toml/21153 "2024-08-06T00:04:33Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicolasyahni](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/nicolasyahni/32/15495_2.png) [@nicolasyahni](https://community.fly.io/u/nicolasyahni)\
**Post date:** [August 6, 2024, 12:04am UTC](https://community.fly.io/t/project-not-respecting-fly-toml/21153/1 "2024-08-06T00:04:33Z")

</div>

Hello. I have a fly.toml with this configuration:

```auto
app = 'company-backend'
primary_region = 'mia'

[http_service]
  internal_port = 8080
  force_https = true
  auto_stop_machines = 'stop'
  auto_start_machines = true
  min_machines_running = 1
  processes = ['app']

[[vm]]
  memory = '1gb'
  cpu_kind = 'shared'
  cpus = 1

[build]
  dockerfile = "Dockerfile"

[env]
  PORT = "8080"

```

However, I’m getting 2 machines in the SCL region instead of MIA, and my project is scaling to zero. So it always is suspended and with both machines stopped, unless I make a request to the server and one of the machine gets temporarily activated for a short time, then goes back into suspension.

What’s up with this?  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![khuezy](https://avatars.discourse-cdn.com/v4/letter/k/4da419/32.png) [@khuezy](https://community.fly.io/u/khuezy)\
**Post date:** [August 6, 2024, 12:14am UTC](https://community.fly.io/t/project-not-respecting-fly-toml/21153/2 "2024-08-06T00:14:25Z")

</div>

Assuming that there isn’t an issue on [Fly.io](http://Fly.io), did you accidentally create your app in `scl` and then updated your config to `mia`? If so, `fly deploy` doesn’t look at the region, it only configures that at launch (initial) time. `fly scale count 0` to clear them, then go back up to 2. `min_machines_running` only applies to the original primary region.

---

<div class="post-metadata">

**Author:** ![nicolasyahni](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/nicolasyahni/32/15495_2.png) [@nicolasyahni](https://community.fly.io/u/nicolasyahni)\
**Post date:** [August 6, 2024, 1:37am UTC](https://community.fly.io/t/project-not-respecting-fly-toml/21153/3 "2024-08-06T01:37:58Z")

</div>

I used `fly launch` for creating the project with the fly.toml already created and configured like I showed. I tried `fly scale count 0` and setting it back to 2 but that didn’t work. I’m still getting the new machines on SCL, even though my config is still in MIA.

---

<div class="post-metadata">

**Author:** ![andie](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/andie/32/11768_2.png) [@andie](https://community.fly.io/u/andie)\
**Post date:** [August 6, 2024, 11:30pm UTC](https://community.fly.io/t/project-not-respecting-fly-toml/21153/4 "2024-08-06T23:30:21Z")

</div>

I’m wondering if your new app is actually using the fly.toml above or if the launch scanner is detecting your app and creating a new fly.toml file with the primary region set to your closest region?

When you ran `fly launch` did you note the region that was output in the suggested settings for the app?

---

<div class="post-metadata">

**Author:** ![travtarr](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/travtarr/32/14026_2.png) [@travtarr](https://community.fly.io/u/travtarr)\
**Post date:** [August 7, 2024, 12:04am UTC](https://community.fly.io/t/project-not-respecting-fly-toml/21153/5 "2024-08-07T00:04:37Z")

</div>

You can also specify the region when you run that scale command using the `--region mia` option. Just note if you still have machines in the _scl_ region, you’ll want to specify that region when you scale it to 0.

---

<div class="post-metadata">

**Author:** ![nicolasyahni](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/nicolasyahni/32/15495_2.png) [@nicolasyahni](https://community.fly.io/u/nicolasyahni)\
**Post date:** [August 8, 2024, 3:08am UTC](https://community.fly.io/t/project-not-respecting-fly-toml/21153/6 "2024-08-08T03:08:01Z")

</div>

I think this might be it. Why is this happening and how can I fix this?

---

<div class="post-metadata">

**Author:** ![nicolasyahni](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/nicolasyahni/32/15495_2.png) [@nicolasyahni](https://community.fly.io/u/nicolasyahni)\
**Post date:** [August 8, 2024, 4:02am UTC](https://community.fly.io/t/project-not-respecting-fly-toml/21153/7 "2024-08-08T04:02:26Z")

</div>

That would fix the region issue manually, but I want to make fly respect the fly.toml file I have, since the region is only one of the issues (I want also to respect the other configs in fly.toml, like min\_machines\_running=1)

---

<div class="post-metadata">

**Author:** ![andie](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/andie/32/11768_2.png) [@andie](https://community.fly.io/u/andie)\
**Post date:** [August 8, 2024, 3:53pm UTC](https://community.fly.io/t/project-not-respecting-fly-toml/21153/8 "2024-08-08T15:53:17Z")

</div>

You need to make sure the fly.toml file with the settings you want is at the top level of your project directory where you run your commands.

If you then scale to zero (`fly scale count 0`)and then redeploy with `fly deploy`, the deploy (and any subsequent deploys) should respect the fly.toml settings.

---

<div class="post-metadata">

**Author:** ![nicolasyahni](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/nicolasyahni/32/15495_2.png) [@nicolasyahni](https://community.fly.io/u/nicolasyahni)\
**Post date:** [August 8, 2024, 4:51pm UTC](https://community.fly.io/t/project-not-respecting-fly-toml/21153/9 "2024-08-08T16:51:38Z")

</div>

Did that with fly.toml at the root of my project and still, no luck. Still deploying at a different region and probably not respecting any other configs inside my fly.toml

My project looks something like this:

```auto
/project-directory
│
├── my_backend/
│ └── app.py
│
├── .env
├── Dockerfile
├── fly.toml
├── poetry.lock
└── pyproject.toml

```

My Dockerfile is clearly being respected since the deployment is successful and functional. Here is my dockerfile:

```auto
FROM python:3.11.9-bookworm AS builder

ENV PYTHONUNBUFFERED=1 \

PYTHONDONTWRITEBYTECODE=1

RUN pip install poetry && poetry config virtualenvs.in-project true

WORKDIR /app

COPY pyproject.toml poetry.lock ./

RUN poetry install

# Runtime stage

FROM python:3.11.9-slim-bookworm

WORKDIR /app

# Install python-dotenv

RUN pip install python-dotenv

COPY --from=builder /app .

COPY my_backend/ ./my_backend/

COPY .env .env

CMD ["/app/.venv/bin/python", "my_backend/app.py", "--host=0.0.0.0", "--port=8080"]

```

I can’t wrap my head around why it’s not respecting the fly.toml configs

---

<div class="post-metadata">

**Author:** ![khuezy](https://avatars.discourse-cdn.com/v4/letter/k/4da419/32.png) [@khuezy](https://community.fly.io/u/khuezy)\
**Post date:** [August 8, 2024, 4:58pm UTC](https://community.fly.io/t/project-not-respecting-fly-toml/21153/10 "2024-08-08T16:58:09Z")

</div>

is this only happening for `mia`? Can you try a different `primary_region` to see if that repros

---

<div class="post-metadata">

**Author:** ![nicolasyahni](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/nicolasyahni/32/15495_2.png) [@nicolasyahni](https://community.fly.io/u/nicolasyahni)\
**Post date:** [August 8, 2024, 5:04pm UTC](https://community.fly.io/t/project-not-respecting-fly-toml/21153/11 "2024-08-08T17:04:00Z")

</div>

Tried Spain (Madrid) and Mexico. Nothing.

It’s just fly not respecting the configs inside my fly.toml

---

<div class="post-metadata">

**Author:** ![andie](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/andie/32/11768_2.png) [@andie](https://community.fly.io/u/andie)\
**Post date:** [August 8, 2024, 5:59pm UTC](https://community.fly.io/t/project-not-respecting-fly-toml/21153/12 "2024-08-08T17:59:10Z")

</div>

I took at a peek at your `fly.toml` from our side and it’s not the same file you posted above. It looks like a default file, with default settings, and the region set to “scl”.

I’m not sure why!

Could you try making a copy of your project and just running `fly launch` in it? You can say `y` to tweak settings and change the region to `mia` before deploy. Once it’s deployed, open the new `fly.toml` file and edit `min_machines_running` to `1`, save it, then run `fly deploy`. This should result in the app behaviour and settings you want.

---

<div class="post-metadata">

**Author:** ![nicolasyahni](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/nicolasyahni/32/15495_2.png) [@nicolasyahni](https://community.fly.io/u/nicolasyahni)\
**Post date:** [August 9, 2024, 2:41am UTC](https://community.fly.io/t/project-not-respecting-fly-toml/21153/13 "2024-08-09T02:41:57Z")

</div>

this solved my issue, so i was probably making a very DUMB mistake. I’m sorry and thank you.

---

<div class="post-metadata">

**Author:** ![andie](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/andie/32/11768_2.png) [@andie](https://community.fly.io/u/andie)\
**Post date:** [August 9, 2024, 12:48pm UTC](https://community.fly.io/t/project-not-respecting-fly-toml/21153/14 "2024-08-09T12:48:17Z")

</div>

I’m going to do some testing of what happens when you use `fly launch` with an existing `fly.toml` and see if we can improve things at all. It should be an acceptable workflow and it might not be clear enough what’s happening. Glad your app is working as it should now!

---

<div class="post-metadata">

**Author:** ![khuezy](https://avatars.discourse-cdn.com/v4/letter/k/4da419/32.png) [@khuezy](https://community.fly.io/u/khuezy)\
**Post date:** [August 9, 2024, 1:14pm UTC](https://community.fly.io/t/project-not-respecting-fly-toml/21153/15 "2024-08-09T13:14:07Z")

</div>

I tried that a few weeks ago and it overwrote and added some configs on the existing `fly.toml`

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/fly1/original/3X/6/e/6e8955d00cb218e186ebbe3a6ab06fefdce15290.svg) [@system](https://community.fly.io/u/system)\
**Post date:** [August 16, 2024, 1:14pm UTC](https://community.fly.io/t/project-not-respecting-fly-toml/21153/16 "2024-08-16T13:14:28Z")

</div>

Closed on August 16, 2024, 1:14pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
