Environment variables overview

Gobierto requires a few environment variables to be setup properly in order for the application to run. To help with the setup, a file named .env.example has been added to the repository:

# Rails configuration variables
SECRET_KEY_BASE=
RACK_ENV=development
RAILS_ENV=development
TLD_LENGTH=2
HOST=gobierto.test
BASE_HOST=gobierto.test
PORT=3000
RAILS_MAX_THREADS=5

# Poltergeist debug and inspector variables
INTEGRATION_DEBUG=false
INTEGRATION_INSPECTOR=false

# Populate data variables
# - Main endpoint
POPULATE_DATA_ENDPOINT=
# - Max dataset size to not apply a default LIMIT on queries
MAX_DATASET_SIZE_FOR_QUERIES=
# - Suggestion endpoint for municipalities suggestion
MUNICIPALITIES_SUGGESTIONS_ENDPOINT=

# Elastic search URL
ELASTICSEARCH_URL=http://localhost:9200

# Redis Sidekiq
REDIS_SIDEKIQ_URL=redis://localhost:6379/0
REDIS_SIDEKIQ_PASSWORD=
REDIS_SIDEKIQ_CA_FILE=
# Redis for Rails caching
REDIS_CACHE_URL=redis://localhost:6379/1
REDIS_CACHE_PASSWORD=
REDIS_CACHE_CA_FILE=

# Rollbar API token (https://rollbar.com). Replace it by other bug tracking system
ROLLBAR_ACCESS_TOKEN=

# Rails performance
APPSIGNAL_PUSH_API_KEY=

# Amazon S3 credentials, to upload assets
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_REGION=eu-west-1
S3_BUCKET_NAME=gobierto-dev

# Cloudinary credentials to crop images
CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=

# Google Places API Key, to geolocalize places
GOOGLE_PLACES_API_KEY=

# Google Maps Geocoding API Key, to get coordinates from addresses names or find addresses based on either geographic coordinates or place IDs
GOOGLE_MAPS_GEOCODING_API_KEY=

# Action mailer config
MAILER_DELIVERY_METHOD=
MAILER_SMTP_ADDRESS=
MAILER_SMTP_USER_NAME=
MAILER_SMTP_PASSWORD=
# If webservice delivery is enabled
# MAIL_WEBSERVICE_ADDRESS=

# AsymmetricEncryptor
ASYMMETRIC_ENCRYPTION_KEY=

# Gobierto settings
GOBIERTO_PUBLIC_PATH=
GOBIERTO_FILE_UPLOADS_ADAPTER=

Rails configuration variables

  • SECRET_KEY_BASE: Rails secret key base. See config/secrets.yml
  • RACK_ENV and RAILS_ENV: Rack and Rails environment
  • TLD_LENGTH: TLD length setting for the session storage. See config/initializers/session_store.rb
  • HOST and PORT: application host and port
  • BASE_HOST: the application main host. It might be different from host, for example: hosted.gobierto.es vs gobierto.es
  • RAILS_MAX_THREADS: Puma setting
  • TEST_LOG_LEVEL: logger level in test environment. Set it to fatal to don't log anything.
  • INTEGRATION_INSPECTOR and INTEGRATION_DEBUG: Poltergeist settings to enable the inspector and the debugger. See https://github.com/teampoltergeist/poltergeist#remote-debugging-experimental
  • MAILER_DELIVERY_METHOD
  • MAILER_SMTP_ADDRESS
  • MAILER_SMTP_USER_NAME
  • MAILER_SMTP_PASSWORD
  • MAIL_WEBSERVICE_ADDRESS

Populate Data variables

Populate Data is a tool developed by Populate that stores many of the open date used by Gobierto. Gobierto needs Populate Data to run. If you need access just write us to: [email protected]

  • POPULATE_DATA_ENDPOINT: The endpoint of the Populate Data account
  • MAX_DATASET_SIZE_FOR_QUERIES: The maximum size in MB of dataset exported to CSV to not apply a default LIMIT to queries. If not set the default is 2. This value can be overridden in the module settings from admin. When this value is set to 0 the default LIMIT is never applied
  • MUNICIPALITIES_SUGGESTIONS_ENDPOINT: The endpoint from Populate data with the places autosuggestion

NoSQL databases

Gobierto uses ElasticSearch and Redis.

  • ELASTICSEARCH_URL: ElasticSearch endpoint
  • REDIS_SIDEKIQ_URL: Redis url for sidekiq
  • REDIS_SIDEKIQ_PASSWORD: Redis password for sidekiq (leave empty if none)
  • REDIS_SIDEKIQ_CA_FILE: Redis cert for sidekiq (leave empty if none)
  • REDIS_CACHE_URL: Redis url for caching
  • REDIS_CACHE_PASSWORD: Redis password for caching (leave empty if none)
  • REDIS_CACHE_CA_FILE: Redis cert for caching (leave empty if none)

External services

  • ROLLBAR_ACCESS_TOKEN: Rollbar access token
  • AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION and S3_BUCKET_NAME: Amazon S3 credentials, region and bucket name
  • GOOGLE_PLACES_API_KEY: Google Places API key
  • GOOGLE_MAPS_GEOCODING_API_KEY: Google Maps Geocoding API key
  • CLOUDINARY_CLOUD_NAME, CLOUDINARY_API_KEY, CLOUDINARY_API_SECRET: Cloudinary API keys. Sign up for a free account to cropping the user's avatar
  • APPSIGNAL_PUSH_API_KEY: AppSinal API key (used for performance monitoring)

Asymmetric encryption

The AsymmetricEncryptor defined in lib/ looks for a RSA public key defined in config/secrets.yml.
The instances of AsymmetricEncryptor must be initialized with the name of the key in secrets.yml.
To create a valid key use, for example: OpenSSL::PKey::RSA.new(2048).public_key.to_pem

  • ASYMMETRIC_ENCRYPTION_KEY

SSL requirement

  • GOBIERTO_FORCE_SSL: if defined forces the application to run under SSL.

Cache storage configuration

Gobierto supports Memcached in staging and production environments.

  • set GOBIERTO_CACHE_TYPE to mem_cache_store if you want to enable memcached
  • set GOBIERTO_CACHE_MEMCACHE_HOST to a valid host if your memcached is in a different server

Gobierto settings

  • set GOBIERTO_PUBLIC_PATH= to public if your public folder is /public (the default)
  • set GOBIERTO_FILE_UPLOADS_ADAPTER= to filesystem or s3, depending on where the application generated files are stored
  • set ENABLE_LOG_RAGE= to convert the output format of the log to LogRage, otherwise it uses debug level in the normal Rails log

Webpack plugins

webpack-bundle-analyzer and speed-measure-webpack-plugin are enabled but they must be invoked through:

  • WEBPACK_ANALYZE=true bin/webpack-dev-server will open http://localhost:8888/ with the analysis results.
  • WEBPACK_SPEED=true bin/webpack-dev-server will estimate the compilation time of every asset

What’s Next

Login using the demo accounts