Project

General

Profile

Actions

Idea #9053

open

Port API server to Go

Added by Tom Clegg over 8 years ago. Updated 9 months ago.

Status:
New
Priority:
Normal
Assigned To:
-
Target version:
Start date:
Due date:
Story points:
-
Release:
Release relationship:
Auto

Description

Background

We want to replace our Rails server with a Go server. However:
  • Porting the entire code base to Go, and cutting over everything at once, seems unlikely to go smoothly.
  • In the time it takes to port, the Rails functionality will change. Keeping them in sync will be challenging.
  • Porting the functionality and the corresponding tests at once is likely to result in unnoticed errors and omissions.

Development approach

The first version of the Go service is just an HTTP proxy: it forwards each request to a configured upstream Rails API server. Nginx configs in the install docs (and existing deployments) are updated to send API requests to this new server. #13497

Next, port some functional/integration tests from the Rails server code base to the Go code base. These tests will pass because Go server is already proxying the relevant requests to the Rails server. (Mocking won't be portable, though!)

Each test that has been ported to Go can be skipped in the Rails code base.

When enough Rails tests are skipped to remove an API from Rails without making the remaining tests fail, that API can be ported to Go. The relevant tests are already in place in the Go code base, so they should be a reasonable way to confirm that the new Go port is correct.

Repeat until all tests are ported to Go, and they pass even with the proxy-to-Rails feature removed.

Caveats / TBD

Rails tests are fast (at least faster than Workbench tests, for example) because they use transaction rollback to reset database state. This option won't be available when tests run in a different (Go) process. Practically, this means the Go tests will need to use the "database reset" API, and they will run slowly.
  • Perhaps we can start by implementing "database reset" in Go? It will have direct access to the Postgres database, and it could take a snapshot of the database at startup instead of reading the Rails YAML fixtures.
  • Is there a better way around this?

Related issues

Related to Arvados - Idea #9502: [API] Update permissions cache as needed after select writesResolved06/28/2016Actions
Related to Arvados - Feature #13493: Federated record retrievalResolvedPeter Amstutz06/28/2018Actions
Related to Arvados - Idea #13995: [Controller] Port "collection update" functional tests from Rails API to controller test suiteNewActions
Related to Arvados - Idea #13997: [Controller] Port "collection update" API from RailsNewActions
Related to Arvados - Feature #17014: Add Container Requests endpoint to controllerResolvedNico César11/10/2020Actions
Blocked by Arvados - Idea #13497: [API] Initial "arvados-controller" server that proxies API endpoints to Rails serverResolvedTom Clegg06/15/2018Actions
Actions

Also available in: Atom PDF