Intake API
Clone or download
wmitchell-cambria Merge pull request #239 from ca-cwds/legal-readme-update
Added contact information for FOSS@osi.ca.gov
Latest commit 1e86b91 Oct 4, 2018
Permalink
Failed to load latest commit information.
.github Update the PULL_REQUEST_TEMPLATE for Jira Nov 22, 2017
app changed the addressType mapping so that it accepts value Jun 7, 2018
bin Run gradle update in bin/ci Feb 6, 2018
config use eager loading in development so that we can get work done Apr 16, 2018
db Ignore files in db/ Feb 6, 2018
docker/test Use blank postgres image in docker-compose Feb 6, 2018
gradle/wrapper Initialize gradle and add build.gradle Feb 6, 2018
legal Modified licenses.txt extension to csv Oct 23, 2017
lib/tasks Change db:test:prepare to create and load schema Feb 5, 2018
log Rails 5 generated files with --api and --database=postgresql options Jul 26, 2016
public Disable Swagger validation. Swagger validator doesn't have access to … Aug 4, 2017
spec fixed rspec test cases Jun 7, 2018
tmp Rails 5 generated files with --api and --database=postgresql options Jul 26, 2016
.dockerignore Prevent reports from being tracked in GitHub or DockerHub Oct 26, 2016
.gitignore Ignore files in db/ Feb 6, 2018
.pairs Add Vinh to git pairs Nov 17, 2017
.rspec Set up rspec Jul 26, 2016
.rubocop.yml Rubocop upgraded the DSL and Layout is now Style Jun 4, 2018
.rubocop_todo.yml Change Rubocop class length Jul 25, 2017
.ruby-version Upgrade ruby to 2.4.0 Mar 15, 2017
Dockerfile Add gradle v3.3 to Dockerfile Feb 6, 2018
Dockerfile.production Use docker_start in Dockerfile.production Feb 7, 2018
Gemfile Upgrading rails-htm-sanitizer to a secure version. Github displayed a Jun 4, 2018
Gemfile.lock Upgrading rails-htm-sanitizer to a secure version. Github displayed a Jun 4, 2018
Jenkinsfile Move catch statement next to try Mar 16, 2018
Jenkinsfile.swaggercheck Move swagger check to Jenkinsfile.swaggercheck Dec 8, 2016
Makefile Remove ES container from Makefile Jul 25, 2017
README.md Added contact information for FOSS@osi.ca.gov Oct 3, 2018
Rakefile Updated Rubocop linting rules May 11, 2017
build.gradle Remove single quotes from DATABASE_NAME Env variable Feb 22, 2018
config.ru Updated Rubocop linting rules May 11, 2017
docker-compose.common.yml Use blank postgres image in docker-compose Feb 6, 2018
docker-compose.yml Removed unused volume declaration Jan 19, 2018
gradlew Initialize gradle and add build.gradle Feb 6, 2018
gradlew.bat Initialize gradle and add build.gradle Feb 6, 2018
settings.gradle Initialize gradle and add build.gradle Feb 6, 2018

README.md

Maintainability Build Status

README

  • Ruby version: check the .ruby-version file
  • Postgres Version: 9.5.3

For Local Workstation setup, please follow these steps:

  • After cloning the repo make sure you have ruby, bundler and postgres set up.
  • Run bundle install
  • Run bundle exec rails db:create db:migrate

For Docker based development setup, please follow these steps: You will need to

  • install the docker-toolbelt
  • create a docker-machine: docker-machine create <name> --driver=virtualbox
  • Run docker-compose up from the root directory
  • Configuration
  • Check docker-compose.yml for system level configuration
  • This a rails api app created with rails new --api, so all rails configurations apply
  • Database creation and initialization

    • run docker-compose exec api rails db:create db:migrate
  • How to run the test suite

  • Run docker-compose run --rm api rspec spec
  • Deployment instructions - TBD

Note: You can run any command from within the container by starting a shell session.

  • If you want to start a shell session in a running container, run docker-compose exec -it api /bin/bash
  • If you want to start a new container with shell session, run docker-compose run api /bin/bash

Writing migrations

The intake api data model migrations are written with liquibase scripts and located in the cwds-data-model repository in the intake-cws-data-model folder. Inside the intake-cwds-data-model folder are the following xml files

  • intake_ns_data.xml (contains seed data)
  • intake_ns_database_master.xml
  • intake_ns_schema.xml (sets the schema/catalog for the application intakens)
  • intake_ns_structure.xml (contains the data model structure)

Looking inside the intake_ns_structure.xml file we can see a series of changeSets. Below is a changeSet responsible for creating the addresses table and uses the liquibase DSL.

<changeSet author="nate (generated)" id="1516991390299-1">
        <createTable tableName="addresses">
            <column name="id" type="VARCHAR">
...

Change sets can also execute raw SQL like the example below:

<changeSet author="nate (generated)" id="1516991390299-51">
        <sql dbms="postgresql" endDelimiter=";">
            CREATE SEQUENCE addresses_id_seq
            START WITH 1
...

To find out more about writing liquibase migrations check out the liquibase documentation

Updating the gradle script

Once the data model changes have been made and merged into the cwds-data-model repository, they will be published to the cwds artifactory as part of the CI jobs which run for cwds-data-model. The artifactory currently being used by intake is located http://pr.dev.cwds.io/artifactory/repo.

The published data model library will be released with a new version number. This version number must be updated in the build.gradle file located in root directory of the intake-api repository.

dependencies {
  compile group: 'gov.ca.cwds.cals', name: 'intake-ns-data-model', version: <new-version>, changing: true
}

The next time the intake-api docker starts the versioned migrations will be pulled down from the artifactory and executed against the database. This occurs in the bin/docker_start file by calling gradle update.

Questions

If you have any questions regarding the contents of this repository, please email the Office of Systems Integration at FOSS@osi.ca.gov.