Follow these instructions to set up a development environment, build and deploy this project on your machine.
git clone https://github.com/3scale/porta.gitThe database needs to be created and initialized. To do so run:
bundle exec rake db:setupThis command will seed the application with multi-tenant, buyer and developer accounts which will be accessible at: http://master-account.3scale.localhost:3000/, http://provider-admin.3scale.localhost:3000/, http://provider.3scale.localhost:3000/ respectively. Take note of the credentials generated at this moment in order to log in to each of the portals above.
It's also possible to have a custom setup by means of environment variables. These can be found at db/seed.rb although here are the most often used ones:
MASTER_PASSWORD=p # Multi-tenant account password
USER_PASSWORD=p # Buyer account password
ADMIN_ACCESS_TOKEN=secret # Admin access token
APICAST_ACCESS_TOKEN=secret # Apicast access tokenTo set the database up from scratch again, use
db:resetto drop and create it:bundle exec rake db:reset
Install all dependencies:
bundle && yarn
Start the rails server by running the following command:
rails server -b 0.0.0.0 # Runs the server, available at localhost:3000Some models are indexed by Sphinx (see app/indices). The search server needs to be running in the background to enable searching through these models. Start it in a separate terminal by running:
bundle exec rake ts:configure ts:startBefore running the application, all assets need to be compiled and a manifest generated. To do that run:
bundle exec rails assets:precompileThis will include both the rails assets pipeline and webpack and it's intended for production and tests. For development, if you're gonna change anything under app/javascript or app/assets/stylesheets, it's more convenient to use live code reloading:
yarn devThis will re-compile webpack and CSS after changes are saved and reload the browser.
Customize your server with the following environment variables:
| Env var | Description | Example |
|---|---|---|
| APICAST_REGISTRY_URL | An endpoint to get Apicast policies | https://apicast.example.com/policies |
| PROMETHEUS_EXPORTER_PORT | Prometheus port | 9398 |
| CONFIG_INTERNAL_API_USER | Queried in config/core.yml, must match APIsonator configuration | system_app |
| CONFIG_INTERNAL_API_PASSWORD | Queried in config/core.yml, must match APIsonator configuration | token |
| ZYNC_AUTHENTICATION_TOKEN | Queried in config/zync.yml | token |
| ZYNC_ENDPOINT | Queried in config/zync.yml | http://127.0.0.1:5000 |