1
0
Fork 0
mirror of https://codeberg.org/demostf/api.git synced 2026-06-03 18:04:08 +02:00
REST api for demos.tf
  • PHP 87.4%
  • Nix 8.3%
  • JavaScript 3.4%
  • Makefile 0.5%
  • Dockerfile 0.4%
Find a file
2019-03-05 23:04:30 +01:00
.phan add phan 2017-07-30 15:57:14 +02:00
src use parser binary 2019-03-05 23:04:30 +01:00
test use parser binary 2019-03-05 23:04:30 +01:00
.dockerignore run as nobody 2017-09-07 13:28:21 +02:00
.gitignore Add php-cs-fixer 2017-07-30 14:51:54 +02:00
.php_cs.dist stricter cs 2017-07-30 15:07:18 +02:00
.travis.yml set db port for travis 2019-01-23 18:44:29 +01:00
composer.json bumb dependencies 2019-01-26 21:17:15 +01:00
composer.lock bumb dependencies 2019-01-26 21:17:15 +01:00
Dockerfile use parser binary 2019-03-05 23:04:30 +01:00
LICENCE Create LICENCE 2017-04-13 14:37:52 +02:00
Makefile use parser binary 2019-03-05 23:04:30 +01:00
package-lock.json bumb dependencies 2019-01-26 21:17:15 +01:00
package.json bumb dependencies 2019-01-26 21:17:15 +01:00
README.md update readme 2017-04-13 00:38:20 +02:00
travis.php.ini add basic api tests 2017-07-16 01:35:46 +02:00

demos.tf api

Build Status codecov

Backend code for demos.tf

Database

The api requires a PostgreSQL database to function, the database schema required can be found in demostf/db/demos_schema.sql.

Note that the pg_trgrm extension in required.

Docker image

A prebuild docker image exists in the docker hub which contains nginx, php and this code.

A seperate PostgreSQL database is required to run the image, the database details need to be configured with the following environment variables:

  • DB_TYPE=pgsql
  • DB_HOST=$database_host
  • DB_DATABASE=$database_name
  • DB_USERNAME=$database_user
  • DB_PASSWORD=$database_password
  • BASE_HOST=$host // the domain the frontend site will be running on
  • PARSER_URL=$parser_host // the full url for the demo parser's upload endpoint
  • DEMO_ROOT=/demos // the folder uploaded demos will be stored in
  • DEMO_HOST=static.$HOST // the hostname from which the uploaded demos will be served
  • APP_ROOT=api.$HOST // the domain the api will be running on

Installing

To install the project composer is required.

composer install

Deploying

Deploying the api requires php7.1 or later, the webserver needs to be configured to server all requests to public/index.php execept for request to /upload which needs to be handled by public/upload.php.

The database details need to be configured with the same environment variables as are described for the docker image above.

More information for hosting and a pre-configured docker based setup can be found at demostf/setup