anvilistas / amoni

A command line utility for local development of Anvil apps.
Other
14 stars 4 forks source link

"amoni start" fails. #25

Closed telemix closed 9 months ago

telemix commented 1 year ago

I am following your getting started instructions, and it all seems work right up to the final docker compose up, when I get this :

[+] Running 3/4
 ✔ Network demo_default      Created                                       0.2s 
 ✔ Volume "demo_postgresql"  Created                                       0.0s 
 ✔ Container demo-db-1       Healthy                                       3.2s 
 ⠿ Container demo-app-1      Starting                                      3.9s 
Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "anvil-app-server": executable file not found in $PATH: unknown
Traceback (most recent call last):

  File "/home/user/.local/bin/amoni", line 8, in <module>
    sys.exit(cmd())

  File "/home/user/.local/pipx/venvs/amoni/lib/python3.10/site-packages/amoni/cli/amoni.py", line 54, in start
    api.start_service("app", detach=True)

  File "/home/user/.local/pipx/venvs/amoni/lib/python3.10/site-packages/amoni/api.py", line 110, in start_service
    docker.compose.up([name], detach=detach)

  File "/home/user/.local/pipx/venvs/amoni/lib/python3.10/site-packages/python_on_whales/components/compose/cli_wrapper.py", line 737, in up
    run(full_cmd, capture_stdout=quiet, capture_stderr=quiet)

  File "/home/user/.local/pipx/venvs/amoni/lib/python3.10/site-packages/python_on_whales/utils.py", line 177, in run
    raise DockerException(

python_on_whales.exceptions.DockerException: The docker command executed was `/snap/bin/docker compose up --detach app`.
It returned with code 1
The content of stdout can be found above the stacktrace (it wasn't captured).
The content of stderr can be found above the stacktrace (it wasn't captured).

There is an empty error.log file in ./logs.

I'm not sure where the PATH should be pointing, or even which PATH it is referring to (maybe there's one in the container?)

Any help gratefully received...

$ docker ps -la
CONTAINER ID   IMAGE      COMMAND                  CREATED          STATUS    PORTS                                       NAMES
073d3f9c4637   demo-app   "anvil-app-server --…"   20 minutes ago   Created   0.0.0.0:3030->3030/tcp, :::3030->3030/tcp   demo-app-1

I'm running on Ubuntu 22.04.

meatballs commented 1 year ago

I'm away at the moment. I'll have a look at this once I'm back home in a couple of weeks.

meatballs commented 1 year ago

Is it possible that creative Procrastination comes to the rescue here?

https://anvil.works/forum/t/no-module-named-functools-when-using-anvil-app-server/18591/7

telemix commented 1 year ago

Possibly :)

Do i need to update the anvil docker image within amoni or do I just pull the latest version of the app server directly in docker (eg something like docker pull) ?

I don;t know how to do either, but it would be good to know that I'm banging my head against the right method ... :)

-- David Wylie @.***

On Wed, 13 Sep 2023, at 17:51, Owen Campbell wrote:

Is it possible that creative Procrastination comes to the rescue here?

https://anvil.works/forum/t/no-module-named-functools-when-using-anvil-app-server/18591/7?u=owen.campbell

— Reply to this email directly, view it on GitHub https://github.com/anvilistas/amoni/issues/25#issuecomment-1718064392, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD3CVT4PNDUIAGWWCXOIN33X2HXANANCNFSM6AAAAAA4M6HNNQ. You are receiving this because you authored the thread.Message ID: @.***>

meatballs commented 1 year ago

sorry I can't look into this properly right now. Life is getting in the way.

Try amoni start --update which should update the docker image for you.

vidz1979 commented 1 year ago

Same error here! Ubuntu 22.04 also.

telemix commented 11 months ago

It fails on Debian 12, Ubuntu 22.04 and Centos 9. The centos output is here :

[+] Running 4/4l app and database servers
 ✔ Network demo_default      Created                                                                                                                                                                                                           0.1s 
 ✔ Volume "demo_postgresql"  Created                                                                                                                                                                                                           0.0s 
 ✔ Container demo-db-1       Healthy                                                                                                                                                                                                           0.0s 
 ✔ Container demo-app-1      Created                                                                                                                                                                                                           0.0s 
Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "anvil-app-server": executable file not found in $PATH: unknown
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /root/.local/pipx/venvs/amoni/lib64/python3.9/site-packages/amoni/cli/amoni.py:54 in start       │
│                                                                                                  │
│   51 │   │   api.build_image("app")                                                              │
│   52 │   │   api.pull_image("db")                                                                │
│   53 │   with echo.working("Starting anvil app and database servers"):                           │
│ ❱ 54 │   │   api.start_service("app", detach=True)                                               │
│   55 │   echo.progress("Your app is available at http://localhost:3030")                         │
│   56 │   if launch:                                                                              │
│   57 │   │   typer.launch("http://localhost:3030")                                               │
│                                                                                                  │
│ ╭──── locals ────╮                                                                               │
│ │ launch = True  │                                                                               │
│ │ update = False │                                                                               │
│ ╰────────────────╯                                                                               │
│                                                                                                  │
│ /root/.local/pipx/venvs/amoni/lib64/python3.9/site-packages/amoni/api.py:110 in start_service    │
│                                                                                                  │
│   107 │   detach                                                                                 │
│   108 │   │   Whether to detach from the service console                                         │
│   109 │   """                                                                                    │
│ ❱ 110 │   docker.compose.up([name], detach=detach)                                               │
│   111                                                                                            │
│   112                                                                                            │
│   113 def stop_services() -> None:                                                               │
│                                                                                                  │
│ ╭──── locals ────╮                                                                               │
│ │ detach = True  │                                                                               │
│ │   name = 'app' │                                                                               │
│ ╰────────────────╯                                                                               │
│                                                                                                  │
│ /root/.local/pipx/venvs/amoni/lib64/python3.9/site-packages/python_on_whales/components/compose/ │
│ cli_wrapper.py:749 in up                                                                         │
│                                                                                                  │
│   746 │   │   │   services = to_list(services)                                                   │
│   747 │   │   │   full_cmd += services                                                           │
│   748 │   │   # important information is written to both stdout AND stderr.                      │
│ ❱ 749 │   │   run(full_cmd, capture_stdout=quiet, capture_stderr=quiet)                          │
│   750 │                                                                                          │
│   751 │   def version(self) -> str:                                                              │
│   752 │   │   """Returns the version of docker compose as a `str`."""                            │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ abort_on_container_exit = False                                                              │ │
│ │     attach_dependencies = False                                                              │ │
│ │                   build = False                                                              │ │
│ │                   color = True                                                               │ │
│ │                  detach = True                                                               │ │
│ │          force_recreate = False                                                              │ │
│ │                full_cmd = [PosixPath('/usr/bin/docker'), 'compose', 'up', '--detach', 'app'] │ │
│ │              log_prefix = True                                                               │ │
│ │      no_attach_services = None                                                               │ │
│ │                no_build = False                                                              │ │
│ │                    pull = None                                                               │ │
│ │                   quiet = False                                                              │ │
│ │                recreate = True                                                               │ │
│ │          remove_orphans = False                                                              │ │
│ │                  scales = {}                                                                 │ │
│ │                    self = <python_on_whales.components.compose.cli_wrapper.ComposeCLI object │ │
│ │                           at 0x7f8b4e8f03a0>                                                 │ │
│ │                services = ['app']                                                            │ │
│ │                   start = True                                                               │ │
│ │                    wait = False                                                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /root/.local/pipx/venvs/amoni/lib64/python3.9/site-packages/python_on_whales/utils.py:194 in run │
│                                                                                                  │
│   191 │   │   │   │   │   completed_process.stderr,                                              │
│   192 │   │   │   │   )                                                                          │
│   193 │   │                                                                                      │
│ ❱ 194 │   │   raise DockerException(                                                             │
│   195 │   │   │   args,                                                                          │
│   196 │   │   │   completed_process.returncode,                                                  │
│   197 │   │   │   completed_process.stdout,                                                      │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │              args = ['/usr/bin/docker', 'compose', 'up', '--detach', 'app']                  │ │
│ │    capture_stderr = False                                                                    │ │
│ │    capture_stdout = False                                                                    │ │
│ │ completed_process = CompletedProcess(args=['/usr/bin/docker', 'compose', 'up', '--detach',   │ │
│ │                     'app'], returncode=1)                                                    │ │
│ │               env = {}                                                                       │ │
│ │             input = None                                                                     │ │
│ │     return_stderr = False                                                                    │ │
│ │       stderr_dest = None                                                                     │ │
│ │       stdout_dest = None                                                                     │ │
│ │    subprocess_env = {                                                                        │ │
│ │                     │   'SHELL': '/bin/bash',                                                │ │
│ │                     │   'HISTCONTROL': 'ignoredups',                                         │ │
│ │                     │   'HOSTNAME': 'centos-s-1vcpu-2gb-sfo3-01',                            │ │
│ │                     │   'HISTSIZE': '1000',                                                  │ │
│ │                     │   'PWD': '/root/demo',                                                 │ │
│ │                     │   'LOGNAME': 'root',                                                   │ │
│ │                     │   'XDG_SESSION_TYPE': 'tty',                                           │ │
│ │                     │   'MOTD_SHOWN': 'pam',                                                 │ │
│ │                     │   'HOME': '/root',                                                     │ │
│ │                     │   'LANG': 'en_US.UTF-8',                                               │ │
│ │                     │   ... +22                                                              │ │
│ │                     }                                                                        │ │
│ │               tty = False                                                                    │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
DockerException: The docker command executed was `/usr/bin/docker compose up --detach app`.
It returned with code 1
The content of stdout can be found above the stacktrace (it wasn't captured).
The content of stderr can be found above the stacktrace (it wasn't captured).
jonp92 commented 10 months ago

Is Amoni dead? This issue is STILL persisting.

meatballs commented 10 months ago

It's open source. Anyone is welcome to contribute.

meatballs commented 9 months ago

It looks like the image build failed silently:

https://github.com/anvilistas/amoni/actions/runs/6169626033/job/16744258595#step:6:8961

telemix commented 9 months ago

It looks like the image build failed silently:

https://github.com/anvilistas/amoni/actions/runs/6169626033/job/16744258595#step:6:8961

Is that something I'm doing wrong?

meatballs commented 9 months ago

It looks like the image build failed silently: https://github.com/anvilistas/amoni/actions/runs/6169626033/job/16744258595#step:6:8961

Is that something I'm doing wrong?

Definitely not!

There's a docker image that gets automatically built and deployed whenever the anvil app server itself is updated. The last time that happened, the build failed silently. I don't yet understand why!

telemix commented 9 months ago

It looks like the image build failed silently: https://github.com/anvilistas/amoni/actions/runs/6169626033/job/16744258595#step:6:8961

Is that something I'm doing wrong?

Definitely not!

There's a docker image that gets automatically built and deployed whenever the anvil app server itself is updated. The last time that happened, the build failed silently. I don't yet understand why!

Ah ok. Cheers.

meatballs commented 9 months ago

Related: https://anvil.works/forum/t/docker-build-fails-for-anvil-server/19412

nickantonaccio commented 9 months ago

I've had some issues running recent versions of anvil-app-server on Ubuntu (no Docker involved). Have you tried using version 1.7.3?

meatballs commented 9 months ago

No, I need to try it with various different versions but just haven't had the time.

meatballs commented 9 months ago

This should now be fixed. There are new images for both the app server and the db which you can use with:

amoni start --upgrade

Watch out if you have an existing db. The new image uses postgresql 16 and it will fail to start if you have a db from the older image because that used postgresql 15.

If you only want to upgrade the app server and leave the db untouched, use:

docker compose pull app
amoni start
telemix commented 9 months ago

Just to say it seems to be working fine for me now as well. Thanks!