product:restart

Table of contents

  1. Introduction
  2. Restarting in development
  3. Running the whole entrypoint again
  4. Restarting production
  5. When the app does not come up
  6. Reference
    1. Options
    2. Errors
  7. Requirements
  8. See also

Introduction

product:restart restarts your product’s app without recreating its containers, and waits until it answers. Run it when the hot reload missed a change, or after you change .env.

splent product:restart
    ⏳ cache@v1.5.6 ✓
    ⏳ proxy ✓
  restarting my_first_app (dev)
  waiting for the app to answer...
  done.

feature:add, feature:attach, feature:unlock, feature:remove and feature:detach reload the app themselves, so you rarely need it after them.


Restarting in development

In development the command does this, in order.

  1. Links the features again and installs, with pip install -e, each one the container does not have yet.
  2. Checks that bash can read docker/.env. If it cannot, nothing is restarted and the running app keeps running.
  3. Restarts the feature containers (a proxy, a cache) in load order.
  4. Stops Flask and starts it again with the current docker/.env.
  5. Waits up to 120 seconds for the app to answer on port 5000 in the container. Any HTTP status counts, a 500 included.

Nothing is uninstalled. A feature that switched between editable and pinned is not reinstalled, so use --full for that.


Running the whole entrypoint again

splent product:restart --full

This runs entrypoint.dev.sh again, which reinstalls dependencies, applies migrations and compiles the assets. The wait is up to 10 minutes, and a step that prints FAIL [<step>] ends it at once.

Do not use --full after db:rollback. The entrypoint runs db:upgrade, which applies the migrations you just rolled back.


Restarting production

splent product:restart --prod

This restarts the feature stacks, then the web container with docker restart, so the whole production entrypoint runs again, migrations included. When <product>_prod has no web container, it restarts the deployment’s <product>_web_deploy.

The command waits up to 180 seconds until the app answers below 500, the bar a feature that deploys the product can roll back on.

Nothing is installed, because the image carries its features. A feature change needs product:build and a deploy. Values in deploy/.env are read when a container is created, not when it restarts. --full changes nothing in production.


When the app does not come up

The command says why, shows the end of what the start wrote after the restart, and exits 1. In development it stops waiting at the first traceback.

  restarting my_first_app (dev)
  waiting for the app to answer...
  my_first_app (dev) did not start, the app failed to start.

    Traceback (most recent call last):
      File "/workspace/my_first_app/src/my_first_app/__init__.py", line 3, in <module>
        import missing_module
    ModuleNotFoundError: No module named 'missing_module'

  See the whole log with  docker exec 1a2b3c4d5e6f tail -n 100 /var/log/entrypoint.log

When bash cannot read docker/.env, write it again.

  my_first_app/docker/.env cannot be read by bash, so the app would not start. Nothing was restarted.
    /workspace/my_first_app/docker/.env: line 4: syntax error near unexpected token `('
  Write it again with  splent product:env --merge --dev

Files the CLI writes quote every value bash would misread (see product:env).


Reference

Options

Option Description
--dev Restart the development app
--prod Restart the production web container
--full Run the whole entrypoint again, in development

Without --dev or --prod, it uses SPLENT_ENV, and dev when that is unset.

Errors

Message What to do
N feature(s) failed to install; aborting restart. Fix the install error shown above it
The app is up, but N feature service(s) did not restart: <names>. Check those features’ containers. Exits 1
the app did not answer within <N> s Look at the log the command names
the container keeps restarting The production entrypoint fails. Look at docker logs
Failed to start <product> (<env>). The start could not be launched in the container
No docker-compose file found for <product> (<env>) The product has no compose file for that environment
No running container found for <product> (<env>) Start it with splent product:up

Requirements

  • A selected product (SPLENT_APP) and Docker running.

See also


Back to top

splent. Distributed by an LGPL license v3. Contact us: drorganvidez@us.es