Application Tasks - One-off Containers


When your app is deployed on our infrastructure, the Procfile of your project is analysed and the different way to start your project are registered and are available for scaling in your dashboard.

For various reason you may need to run other tasks in the environment of your application (a database migration, rails console, rake tasks, etc.).

If you’re looking to execute scheduled tasks, you’d better read this page.


To achieve those operations you have to use the command run of our command line tool which will launch a one-off container.

Tasks can be interactive (like bash) or non-interactive (like rake task or shell command like ls -l).

A one-off container is a copy of your production environment. After the execution of the task, the environment is destroyed. Thus, do not expect any created file to show up in your production environment. The production environment is immutable.

Execute a shell command

$ scalingo run ls
app  bin  config  db  Gemfile  Gemfile.lock  lib  log  Procfile  public  Rakefile  test  tmp  vendor

Don’t forget to quote command argument:

$ scalingo run 'ls -l'
total 40
drwxrwxr-x 1 appsdeck appsdeck    84 Sep 23 07:42 app
drwxrwxr-x 1 appsdeck appsdeck   114 Sep 23 07:42 bin
drwxrwxr-x 1 appsdeck appsdeck   226 Sep 23 07:42 config
-rw-rw-r-- 1 appsdeck appsdeck   154 Sep 23 07:42
drwxrwxr-x 1 appsdeck appsdeck    48 Sep 23 07:42 db
-rw-rw-r-- 1 appsdeck appsdeck  2208 Sep 23 07:42 Gemfile
-rw-rw-r-- 1 appsdeck appsdeck 11085 Sep 23 07:42 Gemfile.lock
drwxrwxr-x 1 appsdeck appsdeck    40 Sep 23 07:42 lib
drwxrwxr-x 1 appsdeck appsdeck    38 Sep 23 07:42 log
-rw-rw-r-- 1 appsdeck appsdeck   137 Sep 23 07:42 Procfile
drwxrwxr-x 1 appsdeck appsdeck   220 Sep 23 07:42 public
-rw-rw-r-- 1 appsdeck appsdeck   249 Sep 23 07:42 Rakefile
drwxrwxr-x 1 appsdeck appsdeck   128 Sep 23 07:42 test
drwxrwxr-x 1 appsdeck appsdeck    76 Sep 23 07:43 tmp
drwxrwxr-x 1 appsdeck appsdeck    56 Nov 13  2014 vendor

Execute bash

$ scalingo --app my-app run bash
[10:45] Scalingo ~ $ ls
bin  Godeps  main.go  Procfile  templates

Execute bash with custom environment variables

$ scalingo --app my-app run --env VAR1=VAL1 --env VAR2=VAL2 bash
[10:51] Scalingo ~ $ env | grep VAR

Upload an archive and extract it on the server

  • Use the --file flag to select the files to upload
$ scalingo --app my-app run --file ./dump.tar bash
Upload /tmp/job-file635294589/dump.tar to container.
  • Uploaded files are located in the directory /tmp/uploads
[10:51] Scalingo ~ $ ls /tmp/uploads
  • Extract the archive to /tmp
[10:51] Scalingo ~ $ tar -C /tmp -xvf /tmp/uploads/dump.tar
  • Use these files with a script
[10:51] Scalingo ~ $ /app/ /tmp/dump/*.json
schedule 02 Oct 2014