'foreground' and 'start' have disappeared from a release

A phoenix release. The versions of Phoenix and Elixir are up to date.

And I have this systemd file:

    [Unit]
    Description=app123
    After=syslog.target
    Requires=postgresql.service

    [Service]
    ExecStart=/var/web/app123/bin/app123 foreground
    ExecStop=/var/web/app123/bin/app123 stop
    Restart=on-abort
    WorkingDirectory=/var/web/app123/bin
    Environment=MIX_ENV=prod
    SyslogIdentifier=app123
    User=user1

    [Install]
    WantedBy=multi-user.target

When I try to start it, it’ll give an exception:

    × app123.service - app123
         Loaded: loaded (/etc/systemd/system/app123.service; disabled; vendor preset: disabled)
         Active: failed (Result: exit-code) since Thu 2021-07-15 14:10:41 UTC; 5s ago
        Process: 841263 ExecStart=/var/web/app123/bin/app123 foreground (code=exited, status=1/FAILURE)
       Main PID: 841263 (code=exited, status=1/FAILURE)

    Jul 15 14:10:41 localhost app123[841263]:     eval "EXPR"    Executes the given expression on a new, non-booted system
    Jul 15 14:10:41 localhost app123[841263]:     rpc "EXPR"     Executes the given expression remotely on the running system
    Jul 15 14:10:41 localhost app123[841263]:     remote         Connects to the running system via a remote shell
    Jul 15 14:10:41 localhost app123[841263]:     restart        Restarts the running system via a remote command
    Jul 15 14:10:41 localhost app123[841263]:     stop           Stops the running system via a remote command
    Jul 15 14:10:41 localhost app123[841263]:     pid            Prints the operating system PID of the running system via a remote command
    Jul 15 14:10:41 localhost app123[841263]:     version        Prints the release name and version to be booted
    Jul 15 14:10:41 localhost app123[841263]: ERROR: Unknown command foreground
    Jul 15 14:10:41 localhost systemd[1]: app123.service: Main process exited, code=exited, status=1/FAILURE
    Jul 15 14:10:41 localhost systemd[1]: app123.service: Failed with result 'exit-code'.

What’s the matter? Where has ‘foreground gone’? Where are ‘start’, ‘start_iex’ or anything related to start at all?

Just a guess, but did you switch from distillery releases to mix releases? I think foreground is a command with distillery releases but not with mix releases.

2 Likes

It looks like your output is clipped to the last n lines so ‘start’ etc do not show. @John-Goff is right; For mix release the correct command is start.

It is a shell script, you can poke around or run in the command line to experiment.

2 Likes