To deploy the script, follow these steps:
ssh ... alembic upgrade head
Antii's answer gives a direct answer, which is the -c option:
ssh ... alembic -c /path/to/alembic.ini upgrade head
However, then you can get like me:
FAILED: Path doesn't exist: 'alembic'. Please use the 'init' command to create a new scripts folder.
Alembic cannot interpret your script_location intent in alembic.ini . Usually you run alembic from a directory using alembic.ini , and alembic can interpret your script_location as a relative path.
However, when you run it with a simple script deployment or otherwise from another directory, it does not know where to look, and it does not use the alembic.ini directory to guess the location (it seems to me that Antii suggested?).
If you look in the alembic source code here , you will see that alembic wants either 1) an absolute path, 2) a package path, or 3) a relative path from the working directory (default case).
Therefore the second level of this answer
Option 1: Absolute Path
(I have not tested this!) Specify the absolute path to the alembic directory in alembic.ini . This does not work for me because the code becomes unsportsmanlike:
... script_location = /path/to/alembic/ ...
Option 2: package path
Specify the package path in alembic.ini :
... script_location = rootpackage:alembic
and of course, it should actually be a package, so the place with alembic.ini should have __init__.py .
Option 3: Relative Path
Instead of starting the alembic update directly in your deployment script, make a bash script to cd in the right directory, and then run it.