Using API platform Docker Compose deployment.
On IDS servers we recommend using the restart_api_platform.sh bash script
git clone --recursive https://github.com/MaastrichtU-IDS/grid-api.git
./restart_api_platform.sh
# Start build manually
docker-compose -f docker-compose-prod/docker-compose.build.yml pull --ignore-pull-failures
docker-compose -f docker-compose-prod/docker-compose.build.yml build --pull
docker-compose -f docker-compose-prod/docker-compose.yml up -d
Should we push to container registry?
docker-compose -f docker-compose-prod/docker-compose.build.yml push
See API-platform documentation.
- Install
# Just install schema-generator from composer.json
composer install
# Install PHP Composer and dependencies if needed
sudo apt install curl php-cli php-mbstring git unzip php-xml
composer require --dev api-platform/schema-generator
- Generate types from api/config/schema.yaml.
vendor/bin/schema generate-types api/src/ api/config/schema.yaml
The PHP types for this schema has now been generated in
api/src/Entity
# In grid-api
docker-compose up -d
docker-compose down
Navigate to
- http://localhost:8080 for the API
- http://localhost:8085 for the admin
Warning: to deploy in production we might need to customize secrets and password in the .env
file.
See example of .env file here.
-
Create repository by using template from https://github.com/api-platform/api-platform/
-
In this repository, get the submodule to compile the Docker Compose production
git submodule add https://github.com/MaastrichtU-IDS/docker-compose-prod.git
- Change the main docker-compose.yml
- To remove h2-proxy
- Change API and UI port to 8084 and 8085
- Change the .env file to provide your own parameters and URL
- Define schema in api/config/schema.yaml
- Update API platform configuration (e.g. enable GraphQL)
API Platform is a next-generation web framework designed to easily create API-first projects without compromising extensibility and flexibility:
- Design your own data model as plain old PHP classes or import an existing one from the Schema.org vocabulary.
- Expose in minutes a hypermedia REST or a GraphQL API with pagination, data validation, access control, relation embedding, filters and error handling...
- Benefit from Content Negotiation: GraphQL, JSON-LD, Hydra, HAL, JSONAPI, YAML, JSON, XML and CSV are supported out of the box.
- Enjoy the beautiful automatically generated API documentation (Swagger/OpenAPI).
- Add a convenient Material Design administration interface built with React without writing a line of code.
- Scaffold fully functional Progressive-Web-Apps and mobile apps built with React, Vue.js or React Native thanks to the client generator (a Vue.js generator is also available).
- Install a development environment and deploy your project in production using Docker and Kubernetes.
- Easily add JSON Web Token or OAuth authentication.
- Create specs and tests with a developer friendly API testing tool on top of Behat.
The official project documentation is available on the API Platform website.
API Platform embraces open web standards (OpenAPI, JSON-LD, GraphQL, Hydra, HAL, JSONAPI, JWT, OAuth, HTTP...) and the Linked Data movement. Your API will automatically expose structured data in Schema.org / JSON-LD. It means that your API Platform application is usable out of the box with technologies of the semantic web.
It also means that your SEO will be improved because Google leverages these formats.
Last but not least, the server component of API Platform is built on top of the Symfony framework, while client components leverage React (a Vue.js flavor is also available). It means that you can:
- Use thousands of Symfony bundles and React components with API Platform.
- Integrate API Platform in any existing Symfony or React application.
- Reuse all your Symfony and React skills, benefit of the incredible amount of documentation available.
- Enjoy the popular Doctrine ORM (used by default, but fully optional: you can use the data provider you want, including but not limited to MongoDB and Elasticsearch)
Read the official "Getting Started" guide.
Created by Kévin Dunglas. Commercial support available at Les-Tilleuls.coop.