Setting up AppSignal on Shelly Cloud
To set up AppSignal on Shelly Cloud, you first have to add both the dotenv-rails
and the appsignal
gem to your Gemfile
. Make sure that the dotenv-rails
gem is the very first gem in your Gemfile
as it will set up important environment variables as soon as it is required.
# Gemfile
source 'https://rubygems.org'
gem 'dotenv-rails'
gem 'appsignal'
# All of your other gems
Next, you have to create a new configuration file for your cloud to set up the APPSIGNAL_PUSH_API_KEY
environment variable. This is pretty simple using shelly config create .env
and enter this as its content:
APPSIGNAL_PUSH_API_KEY: your-appsignal-push-api-key-here
Finally make sure you have a proper config/appsignal.yml
file set up. Simply create it with something similar to this as its content:
default: &defaults
push_api_key: "<%= ENV['APPSIGNAL_PUSH_API_KEY'] %>"
# Your app's name
name: "Your app's name here"
# The cuttoff point in ms above which a request is considered slow, default is 200
# slow_request_threshold: 200
# Configuration per environment, leave out an environment or set active
# to false to not push metrics for that environment.
development:
<<: *defaults
active: false
production:
<<: *defaults
active: true
Thats it! After pushing your changes to Shelly Cloud, you should be seeing data showing up in AppSignal soon.
Bonus: Deployment notifications
If you want to get deployment notifications every time you deploy a new version of your application to Shelly Cloud, simply create a file called config/deploy/shelly/after_successful_deploy
:
set -e
bundle exec dotenv appsignal notify_of_deploy --revision=$DEPLOYED_REVISION --user=$DEPLOY_AUTHOR --environment=$RAILS_ENV