By: tonyh
Building on the release of the open source runtime, which provides the code required to run a version of the API on your own server using an Ergast database image, the runtime code repository has been updated to include a configuration script that can be used to launch the runtime and a database server using Docker containers linked by docker-compose
.
The configuration builds two containers locally:
- a MySQL database container seeded with the most recent Ergast database image;
- a web server container running Apache and PHP 5 that serves the Ergast API using the same API paths as ergast.com.
In its current configuration, the database server can also be used to serve database requests to other linked containers. For example, the docker-compose.yaml
includes a commented out example of how to connect a containing running RStudio, and how to connect to the database from an R script. To make the database API available outside the docker container, an additional --ports
setting is required to expose the server port (3306).
The original runtime code is still available for use, either inside or outside Docker as part of your own API server, in the ./webroot
directory.
https://github.com/jcnewell/ergast-f1-api
About Docker: Docker is a virtualisation platform that allows applications to run in lightweight virtual containers on remote hosts or locally.
If you use Docker on your own desktop, you can serve the ergast API locally on your own computer, and access it via localhost
using the normal API paths, such as http://localhost:8000/api/f1/2017.json
.
Leave a Reply