Pericles was designed to make API specification easier.
To run the project locally, you have the choice between using containers or setup your own machine.
Create your own
docker-compose.yml based on the sample, then run:
docker build -t pericles:ruby-2.6 . docker-compose up
Pericles is a Ruby on Rails project. To get the project up and running, proceed as follows (within the app's directory):
Install the version of Ruby specified at the top of the Gemfile along with the bundler gem.
Install the required gems and dependencies:
This project uses PostgreSQL. Create the local databases for the different environments (development and test):
createdb Pericles_GW_dev createdb Pericles_GW_test
Run the migrations:
bundle exec rake db:migrate
Pericles uses Node.js, and Yarn to manage packages. We use json-schema-faker to generate JSON instances based on JSON Schemas, because we could not find a Ruby equivalent. To install the required packages, run:
You should now be able to run the project smoothly on your machine:
bundle exec rails s
SECRET_KEY_BASEYou can use
bundle exec rake secretin the app's directory to generate this key. n/a
GOOGLE_APP_IDClient ID of your OAuth client ID in the Google Developers Console. Check Google OAuth2. n/a
GOOGLE_APP_SECRETClient secret of your OAuth client ID in the Google Developers Console. Google OAuth2. n/a
INTERNAL_EMAIL_DOMAINEmail domain used for authentication purposes. Google OAuth2.
MAIL_DEFAULT_URLURL used to generate absolute links in emails
MAIL_SMTP_DOMAINDomain of the from field in your email
MAIL_SMTP_PASSWORDPassword to connect to your SMTP server n/a
MAIL_SMTP_USERNAMEUsername to connect to your SMTP server n/a
ANDROID_COMPANY_DOMAIN_NAMEPericles allows to generate code in Kotlin. The environment variable corresponds to what you would enter under 'Company Domain' when creating a project in Android Studio. It is then used to generate package names. Defaults to
RAILS_ENVRails environment. Defauls to
PORTPort on which the web server will listen. Defaults to 3000.
DATABASE_URLThe URL of your PostgreSQL database. Defaults to database.yml.
RAILS_SERVE_STATIC_FILESIn case your reverse proxy do not serve static files. Defaults to false.
RAILS_DISABLE_FORCE_SSLIn case your reverse proxy do not handle SSL. Defaults to false.
PROXY_HOSTThe host of your Elixir proxy
SLACK_CLIENT_IDClient ID of your Slack app. Check Slack integration.
SLACK_CLIENT_SECRETClient secret of your Slack app. Check Slack integration.
Pericles uses Devise to manage authentication. More specifically, it lets users log in using their Google account via OAuth2. To make this work, you need to:
http://localhost:3000(the URI of the application when run locally). In "Authorized redirect URIs", add
http://localhost:3000/users/auth/google_oauth2/callback(the URI, when the application is run locally, which users are redirected to after being authenticated with Google). You can then click on "Save".
GOOGLE_APP_IDshould be your OAuth client ID's "Client ID", and the value for
GOOGLE_APP_SECRETshould be your OAuth client ID's "Client secret".
If you want to post recent news on Slack, you can create a Slack app. Then:
To automate this posting, use the
audits:slack_post rake task in a cron/scheduler.
To make sure that your newly deployed instance of Pericles works correctly, you should set up the environment variables. Do not forget to replace
http://localhost:3000 by the URI (using https) of your newly deployed application when reading the instructions.
Heroku automatically set RAILS_ENV, PORT, DATABASE_URL and RAILS_SERVE_STATIC_FILES for you.
The Dockerfile defines a container with a web server listening on the PORT environment variable.
To run tests, simply run (in the project's directory):
bundle exec rails test