Skip to content

Configuration

Adam Cooke edited this page Oct 12, 2019 · 25 revisions

You should already be familiar with the Procfile by this point. This file just contains the names of processes and the commands to run but there are lots of other configuration options which are available to you.

Procfile.options

In order to add configuration for Procodile, you'll need to create a Procfile.options file in the root of your application. This works alongside your Procfile so you need to keep that too. It is recommended that you check your Procfile.options file into your repository.

Every option in this file is optional. If you don't configure something, the default will be used. Below is a full example Procfile.options file with examples and the current defaults.

# The name of the application as shown on the console (default is 'Procodile')
app_name: Llama Kit

# The absolute path to the application (optional but useful when working
# with symlinks)
root: /absolute/path/to/app

# The directory that all PIDs will be stored in (default is 'pids')
pid_root: tmp/procodile-pids

# The path to the log file where the procodile log will be stored. By default
# this will be `procodile.log` in the root of your application.
log_path: log/procodile.log

# The directory where log files should be stored. This is optional. If specified,
# each process's log output will be stored in a separate file in this directory
# rather than being placed into the single procodile.log file
log_root: log

# The user that the application should be run as. If specified, procodile will
# ensure that commands are executed as this user using sudo.
user: rails

# If your application has a console, you can add it here so you can load it 
# your environment variables (below) already set. To open the console just 
# run `procodile console`.
console_command: bundle exec rails console

# You can add environment variables which should be provided to any
# spawned processes
env:
  RAILS_ENV: production
  SECRET_KEY_BASE: XXX

# Per-process configuration options
processes:
  web:
    # The number of this type of process that should be started (default is 1)
    quantity: 2
    # The path to store STDOUT/STDERR output for this process (default is to
    # store in the procodile log or in the log_root if specified)
    log_path: log/processs/web.log
    # Set the name of the log file to use if log_path isn't provided and a 
    # log_root has been set.
    log_file_name: webserver.log
    # The mode that should be used when restart this process (default
    # is term-start)
    restart_mode: usr2
    # The maximum number of respawns that are permitted in the re-spawn
    # window (default is 5)
    max_respawns: 10
    # The size of the respawn window (in seconds) (default is 3600)
    respawn_window: 300
    # The signal to send to terminate this process (default is TERM)
    term_signal: INT
    # If set, Procodile will automatically set PORT environment variables to 
    # instances of this process starting from this number
    allocate_port_from: 7000
    # The network protocol used by this process. This is used when allocating
    # a port number for this process if Procodile has been configured to 
    # handle port allocation for you. You can set it to tcp or udp (default tcp). The proxy
    # features below will not work unless this is set to tcp.
    network_protocol: tcp
    # Set the port (and address) that Procodile should listen on to proxy
    # TCP traffic to your instances when proxy mode is enabled (there is 
    # no default port and the default address is 127.0.0.1)
    proxy_port: 5050
    proxy_address: 0.0.0.0
    # Environment variables that will be given to all instances of this
    # process when they start
    env: 
      PORT: 5500

Procfile.local

In addition to the options file, Procodile will also look in a Procfile.local file. It is recommended that this file is not checked into your repository and it used to override configuration on a per deployment/installation basis. For example, you may wish to increase/decrease the quantity of processes in certain situations.

As above, you don't need to add every option, just ones you wish to override.

processes:
  worker:
    quantity: 4

Server-wide configuration

The server-wide configuration allows you to define one (or more) applications which can be invoked without first entering the application's directory. This allows you to run procodile commands from any directory and Procodile will make sure it is executed from the right place.

This file should be placed in /etc/procodile.

root: /opt/appmail/app/current

Defining multiple apps

If you have multiple applications on your server, you can define them all in this file. You'll be prompted to choose one when you run procodile.

-
  name: Widgets App
  root: /path/to/widgets/app
-
  name: Another App
  root: /path/to/another/app
Clone this wiki locally