mirror of
https://codeberg.org/demostf/api.git
synced 2026-08-02 12:24:52 +02:00
flake updates
This commit is contained in:
parent
6889c726f9
commit
380243d743
3 changed files with 26 additions and 19 deletions
25
README.md
25
README.md
|
|
@ -6,15 +6,19 @@ Backend code for [demos.tf](https://demos.tf)
|
||||||
|
|
||||||
## Database
|
## Database
|
||||||
|
|
||||||
The api requires a PostgreSQL database to function, the database schema required can be found in [demostf/db](https://github.com/demostf/api)/`demos_schema.sql`.
|
The api requires a PostgreSQL database to function, the database schema required
|
||||||
|
can be found in [demostf/db](https://github.com/demostf/api)/`demos_schema.sql`.
|
||||||
|
|
||||||
Note that the `pg_trgrm` extension in required.
|
Note that the `pg_trgrm` extension in required.
|
||||||
|
|
||||||
## Docker image
|
## Docker image
|
||||||
|
|
||||||
A prebuild docker image exists in the [docker hub](https://hub.docker.com/r/demostf/api/) which contains nginx, php and this code.
|
A prebuild docker image exists in the
|
||||||
|
[docker hub](https://hub.docker.com/r/demostf/api/) which contains nginx, php
|
||||||
|
and this code.
|
||||||
|
|
||||||
A separate PostgreSQL database is required to run the image, the database details need to be configured with the following environment variables:
|
A separate PostgreSQL database is required to run the image, the database
|
||||||
|
details need to be configured with the following environment variables:
|
||||||
|
|
||||||
- DB_TYPE=pgsql
|
- DB_TYPE=pgsql
|
||||||
- DB_HOST=$database_host
|
- DB_HOST=$database_host
|
||||||
|
|
@ -24,7 +28,8 @@ A separate PostgreSQL database is required to run the image, the database detail
|
||||||
- BASE_HOST=$host // the domain the frontend site will be running on
|
- 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
|
- 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_ROOT=/demos // the folder uploaded demos will be stored in
|
||||||
- DEMO_HOST=static.$HOST // the hostname from which the uploaded demos will be served
|
- 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
|
- APP_ROOT=api.$HOST // the domain the api will be running on
|
||||||
|
|
||||||
## Installing
|
## Installing
|
||||||
|
|
@ -37,10 +42,12 @@ composer install
|
||||||
|
|
||||||
## Deploying
|
## Deploying
|
||||||
|
|
||||||
Deploying the api requires php7.1 or later,
|
Deploying the api requires php7.1 or later, the webserver needs to be configured
|
||||||
the webserver needs to be configured to server all requests to `public/index.php` execept
|
to server all requests to `public/index.php` execept for request to `/upload`
|
||||||
for request to `/upload` which needs to be handled by `public/upload.php`.
|
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.
|
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](https://github.com/demostf/setup)
|
More information for hosting and a pre-configured docker based setup can be
|
||||||
|
found at [demostf/setup](https://github.com/demostf/setup)
|
||||||
|
|
|
||||||
14
flake.lock
generated
14
flake.lock
generated
|
|
@ -7,11 +7,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1735562399,
|
"lastModified": 1779722240,
|
||||||
"narHash": "sha256-CxgG+lj8QrPMukLuYGRVYqS63AngqhWFdoMoPIVMxQs=",
|
"narHash": "sha256-cX1d9V5JHTytsSdH8RrgyU4fFdm4oooRuKBcJuiyI4U=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "flakelight",
|
"repo": "flakelight",
|
||||||
"rev": "ee9170f71465e6d893a8eda0a6062546dc73a5da",
|
"rev": "6908ac68dd682d1cb22fdb9391b890798f083a48",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -22,16 +22,16 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1748302896,
|
"lastModified": 1780453794,
|
||||||
"narHash": "sha256-ixMT0a8mM091vSswlTORZj93WQAJsRNmEvqLL+qwTFM=",
|
"narHash": "sha256-bXMRa9VTsHSPXL4Cw8R6JJLQeY3Y/IP4+YJCYVmQ7FY=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "7848cd8c982f7740edf76ddb3b43d234cb80fc4d",
|
"rev": "6b316287bae2ee04c9b93c8c858d930fd07d7338",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "nixpkgs",
|
"id": "nixpkgs",
|
||||||
"ref": "nixos-25.05",
|
"ref": "nixos-26.05",
|
||||||
"type": "indirect"
|
"type": "indirect"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "nixpkgs/nixos-25.05";
|
nixpkgs.url = "nixpkgs/nixos-26.05";
|
||||||
flakelight = {
|
flakelight = {
|
||||||
url = "github:nix-community/flakelight";
|
url = "github:nix-community/flakelight";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
@ -17,8 +17,8 @@
|
||||||
parser = pkgs: pkgs.demostf-parser;
|
parser = pkgs: pkgs.demostf-parser;
|
||||||
};
|
};
|
||||||
checks = {
|
checks = {
|
||||||
integration-tests = pkgs: pkgs.nixosTest (import ./nix/integration-tests.nix);
|
integration-tests = pkgs: pkgs.testers.nixosTest (import ./nix/integration-tests.nix);
|
||||||
unit-tests = pkgs: pkgs.nixosTest (import ./nix/unit-tests.nix);
|
unit-tests = pkgs: pkgs.testers.nixosTest (import ./nix/unit-tests.nix);
|
||||||
};
|
};
|
||||||
formatters = pkgs: {
|
formatters = pkgs: {
|
||||||
"*.nix" = pkgs.lib.getExe pkgs.alejandra;
|
"*.nix" = pkgs.lib.getExe pkgs.alejandra;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue