LaunchTracks¶ ↑
LaunchTracks uses launchd and the Tracks Rack server to start your Ruby web apps on demand.
Install¶ ↑
gem install launch_tracks
Usage¶ ↑
To set up a Rack app:
cd /path/to/myapp launch_tracks setup 4000
If there’s a Gemfile in your app’s base directory then LaunchTracks will run your app with bundle exec
. You’ll have to edit your gemfile to add
gem "launch_tracks"
then run
bundle install
Your app will automatically start whenever you visit localhost:4000/ and shutdown after 10 minutes idle.
The output from stdout and stderr will be available at /tmp/myapp-out.txt and /tmp/myapp-err.txt respectively.
To restart your app touch restart.txt
in your app’s base directory.
Environment Variables¶ ↑
LaunchTracks will run your apps with the same environment variables as when it was set up. In the following example, both VAR1 and VAR2 would be available to the app.
export VAR1=foo VAR2=bar launch_tracks setup 4000
Commands¶ ↑
- setup
-
Creates a launchd plist for your app in ~/Library/LaunchAgents, and loads it, making your app available for on-demand startup. Requires a port number for your app to run on as an argument. Example:
launch_tracks setup 4000
- load
-
Loads your app’s launchd plist from ~/Library/LaunchAgents, making your app available for on-demand startup.
- unload
-
Unloads your app’s launchd plist from ~/Library/LaunchAgents, disabling on-demand startup.
- restart
-
Restart your app. The same can be achieved with
touch restart.txt
in your app’s base directory. - rm
-
Unload and remove your app’s plist from ~/Library/LaunchAgents, permanently disabling it.
Licence¶ ↑
(The MIT License)
Copyright © 2012 Matthew Sadler
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.