Every project is different and might need its server to be run in a specific way. There are also times when you need to run worker processes alongside your server to do background processing or other kinds of work.
Starting today, you can define your web server and worker processes in a Procfile - the way you would do in services like Heroku - and this will be used to run your project's server. You can even have a different Procfile for SourceLair and a different one for deploying to Heroku.
Setting up the environment of your project
With Procfile, we're also glad to introduce dotenv support. Every process - ie terminal, server, etc - you run in SourceLair, will source the environment variables you have defined in your .env
file. There, you can define things like DATABASE_URL
so that you can use libraries like dj-database-url for connecting to the correct database in different environment - ie SourceLair vs Heroku - without changing the code of your application.
Defining a custom Procfile
By default, SourceLair will search for a Procfile named Procfile.dev
in your root project directory and then fallback to Procfile
. This way, you can have a different Procfile for deploying and a different one for developing your applications. You can also define a custom Procfile by setting the SL_PROCFILE
environment variable in your .env
file and follow the naming convention of your liking.
These new features are available to all projects, be them old or new, without you needing to do anything. If you already have a Procfile, the next time your run your SourceLair server, your Procfile will be used instead. Wait no more, use our new Procfile and dotenv support or read more on how to cuztomize your server or environment in our help page!