https://github.com/triglav-dataflow/triglav
Triglav is a Data Driven Job Workflow Tool
https://github.com/triglav-dataflow/triglav
rails ruby workflow
Last synced: 7 months ago
JSON representation
Triglav is a Data Driven Job Workflow Tool
- Host: GitHub
- URL: https://github.com/triglav-dataflow/triglav
- Owner: triglav-dataflow
- License: mit
- Created: 2016-12-22T04:49:27.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-09-27T08:23:29.000Z (over 7 years ago)
- Last Synced: 2025-04-14T21:11:16.954Z (about 1 year ago)
- Topics: rails, ruby, workflow
- Language: Ruby
- Homepage:
- Size: 125 KB
- Stars: 10
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Triglav
================
Core API and message queue server of Triglav.
# API Spec
[./doc](./doc)
# Requirements
* Ruby >= 2.3.0
* MySQL >= 5.6
# Development
## Prepare
Copy config files and modify them if you want.
```
cp config/database.yml{.development,}
cp config/settings.yml{.development,}
cp config/secrets.yml{.development,}
cp db/seeds.rb{.development,}
```
## Migrate
```
./bin/rails db:create
./bin/rails db:apply # using ridgepole
./bin/rails db:seed
```
## Start
```
bundle exec foreman start
```
## Try
```
$ curl -H "Content-type: application/json" http://localhost:3000/api/v1/auth/token -X POST -d '{"username":"triglav_test", "password": "triglav_test", "authenticator":"local"}'
{"access_token":"xxxxxxxxxxxxxxxxxx","expires_at":1430458696}
```
```
$ curl -H "Content-type: application/json" -H "Authorization: xxxxxxxxxxxxxxxxxx" http://localhost:7800/api/v1/auth/me -X GET
```
# Test
Do migration with `RAILS_ENV=test bundle exec rails db:create db:apply`, then
```
bundle exec rspec
```
You may generate API doc from requests spec as
```
AUTODOC=1 bundle exec rspec
```
You may run your tests with [spring](https://github.com/rails/spring) to make it faster to finish:
```
bundle exec spring binstubs rspec
bin/rspec
```
# Swagger
We use [swagger](http://swagger.io/) to describe API specification. Write API doc on rails controllers, and serializers referring [Swagger Documentation Specification v2.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md).
## Trying with Swaggeer UI
[swagger-ui](https://github.com/swagger-api/swagger-ui) is already bundled. You can start swagger-ui as
```
bundle exec rails s
```
and access to [http://localhost:7800/apidocs](http://localhost:7800/apidocs). By the way, swagger-ui is a full javascript application, so serving this with nginx is also fine.
Authenticate with `POST /auth/token`.

Click `Try it out!` button, you will get an access token

Go to top bar of Swagger UI, and click `Authorize` button.

Paste your access token to the `value` field, then click Authorize.

Now, you should be able to hit any APIs.
## Generating Swagger API Specification
To generate a static swagger.json, run
```
bundle exec rake swagger:generate
```
## Generating Swagger API Clients
```
wget http://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.2.0/swagger-codegen-cli-2.2.0.jar -O bin/swagger-codegen-cli.jar
```
Generate `../triglav-client-ruby`
```
bundle exec rails swagger:codegen-ruby
```
Generate `../triglav-client-java`
```
bundle exec rails swagger:codegen-java
```
Generate both
```
bundle exec rails swagger:codegen
```
## Release
Edit [VERSION](./VERSION)
Release `../triglav-client-ruby`
```
bundle exec rails release:client-ruby
```
Release `../triglav-client-java`
```
bundle exec rails release:client-java
```
Release `triglav` itself (tagging version)
```
bundle exec rails release:core
```
Release all
```
bundle exec rails release:all
```