Skip to content
Snippets Groups Projects
Commit 045b67e7 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

wip

parent 87c58317
No related branches found
No related tags found
No related merge requests found
Showing
with 1144 additions and 0 deletions
.env 0 → 100644
# In all environments, the following files are loaded if they exist,
# the later taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
APP_ENV=dev
# LDAP
LDAP_HOST=directory.tugraz.at
LDAP_USER=cn=ldap_middleware,o=tug
LDAP_BASE_DN=o=tug
LDAP_PASS=
# KEYCLOAK
KEYCLOAK_SERVER_URL=https://auth-dev.tugraz.at/auth
KEYCLOAK_REALM=tugraz
KEYCLOAK_CLIENT_ID=auth-dev-mw-dev
KEYCLOAK_FRONTEND_CLIENT_ID=auth-dev-mw-frontend-local
KEYCLOAK_CLIENT_SECRET=
# If not empty gets used to check if the access token got issued
# for this audience ('api-gw' for example)
KEYCLOAK_AUDIENCE=api-gw
# Set to true to enable local access token validation
KEYCLOAK_LOCAL_VALIDATION=true
# Deployment related
APP_BUILDINFO=unknown # a git hash or something identifying the build
APP_BUILDINFO_URL='#'
# Disable the webserver bundle (avoids deprecation warnings). Use docker instead.
DISABLE_DEV_SERVER=true
\ No newline at end of file
###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###
###> symfony/web-server-bundle ###
/.web-server-pid
###< symfony/web-server-bundle ###
.idea
/npm-debug.log
.phpunit.result.cache
###> symfony/phpunit-bridge ###
.phpunit
/phpunit.xml
###< symfony/phpunit-bridge ###
/_coverage
/public/docs
###> friendsofphp/php-cs-fixer ###
/.php_cs
/.php_cs.cache
###< friendsofphp/php-cs-fixer ###
image: registry.gitlab.tugraz.at/dbp/middleware/api/main:v9
variables:
COMPOSER_CACHE_DIR: "$CI_PROJECT_DIR/_composer_cache"
cache:
key: ${CI_PROJECT_PATH}
paths:
- _composer_cache
stages:
- test
- deploy
.test_defaults: &test_defaults
script:
- sudo update-alternatives --set php "/usr/bin/${PHP}"
- composer install
- composer symfony:dump-env test
- ./bin/phpunit -v
- mkdocs build -f docs/mkdocs.yml
- ./composer-foreach install
- ./composer-foreach test
test-php7.3:
stage: test
variables:
PHP: "php7.3"
<<: *test_defaults
test-php7.4:
stage: test
variables:
PHP: "php7.4"
<<: *test_defaults
psalm:
stage: test
allow_failure: true
script:
- sudo update-alternatives --set php /usr/bin/php7.3
- ./composer-foreach install
- ./composer-foreach run psalm
phpstan:
stage: test
allow_failure: true
script:
- sudo update-alternatives --set php /usr/bin/php7.3
- ./composer-foreach install
- ./composer-foreach run phpstan
cs-fixer:
stage: test
allow_failure: true
script:
- sudo update-alternatives --set php /usr/bin/php7.3
- ./composer-foreach install
- ./composer-foreach run cs
.deploy_defaults: &deploy_defaults
except:
- schedules
stage: deploy
script:
- sudo update-alternatives --set php /usr/bin/php7.3
# Add ssh key
- mkdir -p ~/.ssh
- echo "${DEPLOY_KEY}" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -t rsa "${DEPLOY_HOST}" >> ~/.ssh/known_hosts
# Deploy
- dep deploy "${CI_ENVIRONMENT_NAME}"
- echo "Deployed to ${CI_ENVIRONMENT_URL}"
# Simple health check
- curl --max-time 10 --retry 3 --output /dev/null --silent --show-error --fail --location "${CI_ENVIRONMENT_URL}"
deploy_development:
only:
refs:
- master
environment:
name: development
url: https://mw-dev.tugraz.at
variables:
DEPLOY_HOST: mw01-dev.tugraz.at
DEPLOY_KEY: "$DEPLOY_SSH_KEY"
<<: *deploy_defaults
deploy_demo:
only:
refs:
- demo
environment:
name: demo
url: https://api-demo.tugraz.at
variables:
DEPLOY_HOST: mw01-dev.tugraz.at
DEPLOY_KEY: "$DEPLOY_SSH_KEY"
<<: *deploy_defaults
deploy_production:
only:
refs:
- production
environment:
name: production
url: https://api.tugraz.at
variables:
DEPLOY_HOST: mw01-prod.tugraz.at
DEPLOY_KEY: "$DEPLOY_SSH_KEY"
<<: *deploy_defaults
<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude('var')
->exclude('bundles')
;
return PhpCsFixer\Config::create()
->setRules([
'@Symfony' => true,
'@PHP70Migration' => true,
'@PHP71Migration' => true,
'@PHP73Migration' => true,
'array_syntax' => ['syntax' => 'short'],
'yoda_style' => false,
'strict_comparison' => true,
'strict_param' => true,
'declare_strict_types' => true,
])
->setRiskyAllowed(true)
->setFinder($finder)
;
\ No newline at end of file
LICENSE 0 → 100644
This diff is collapsed.
#!/usr/bin/env php
<?php
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
set_time_limit(0);
require dirname(__DIR__).'/vendor/autoload.php';
if (!class_exists(Application::class)) {
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
}
$input = new ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}
if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}
require dirname(__DIR__).'/config/bootstrap.php';
if ($_SERVER['APP_DEBUG']) {
umask(0000);
if (class_exists(Debug::class)) {
Debug::enable();
}
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$application = new Application($kernel);
$application->run($input);
#!/usr/bin/env php
<?php
if (!file_exists(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}
if (false === getenv('SYMFONY_PHPUNIT_DIR')) {
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
}
require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
{
"type": "project",
"license": "AGPL-3.0-or-later",
"require": {
"dbp/api-alma-bundle": "@dev",
"dbp/api-core-bundle": "@dev",
"dbp/api-authentic-document-bundle": "@dev",
"dbp/api-esign-bundle": "@dev",
"dbp/api-knowledgebase-bundle": "@dev",
"dbp/api-nextcloud-bundle": "@dev",
"dbp/api-location-check-in-bundle": "@dev",
"symfony/apache-pack": "^1.0",
"symfony/console": "^4.4",
"symfony/dotenv": "^4.4",
"symfony/flex": "^1.1",
"symfony/framework-bundle": "^4.4",
"symfony/monolog-bundle": "^3.5",
"symfony/yaml": "^4.4",
"ext-fileinfo": "*",
"ext-json": "*"
},
"repositories": [
{
"type": "path",
"url": "./bundles/*"
}
],
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true,
"platform": {
"php": "7.3"
}
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
],
"test": [
"@php bin/phpunit"
],
"coverage": [
"@php bin/phpunit --coverage-html _coverage"
],
"phpstan": [
"@php bin/phpunit --atleast-version 0",
"@php vendor/bin/phpstan analyze --ansi"
],
"psalm": [
"@php bin/phpunit --atleast-version 0",
"@php vendor/bin/psalm"
],
"lint": [
"@composer run cs",
"@composer run phpstan",
"@composer run psalm"
],
"cs-fix": [
"@php vendor/bin/php-cs-fixer --ansi fix"
],
"cs": [
"@php vendor/bin/php-cs-fixer --ansi fix --dry-run --diff --diff-format=udiff"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "^4.4"
},
"metasyntactical/composer-plugin-license-check": {
"whitelist": [],
"blacklist": []
}
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16",
"metasyntactical/composer-plugin-license-check": "^0.5.0",
"phpstan/phpstan": "^0.12.7",
"phpstan/phpstan-phpunit": "^0.12.6",
"symfony/debug-bundle": "^4.4",
"symfony/phpunit-bridge": "^4.4",
"symfony/profiler-pack": "^1.0",
"symfony/var-dumper": "^4.4",
"symfony/web-server-bundle": "^4.4",
"vimeo/psalm": "^3.10",
"deployer/deployer": "^6.4",
"deployer/recipes": "^6.2"
}
}
<?php
declare(strict_types=1);
use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__).'/vendor/autoload.php';
// Load cached env vars if the .env.local.php file exists
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) {
foreach ($env as $k => $v) {
$_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && 0 !== strpos($k, 'HTTP_') ? $_SERVER[$k] : $v);
}
} elseif (!class_exists(Dotenv::class)) {
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
} else {
// load all the .env files
(new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env');
}
$_SERVER += $_ENV;
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
<?php
declare(strict_types=1);
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['dev' => ($_ENV['DISABLE_DEV_SERVER'] ?? 'true') !== 'true'],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
DBP\API\CoreBundle\DbpCoreBundle::class => ['all' => true],
];
dbp_core:
keycloak:
server_url: '%env(KEYCLOAK_SERVER_URL)%'
realm: '%env(KEYCLOAK_REALM)%'
client_id: '%env(KEYCLOAK_CLIENT_ID)%'
client_secret: '%env(KEYCLOAK_CLIENT_SECRET)%'
audience: '%env(KEYCLOAK_AUDIENCE)%'
local_validation: '%env(bool:KEYCLOAK_LOCAL_VALIDATION)%'
ldap:
host: '%env(LDAP_HOST)%'
base_dn: '%env(LDAP_BASE_DN)%'
username: '%env(LDAP_USER)%'
password: '%env(LDAP_PASS)%'
campus_online:
api_url_organization: '%env(TU_ONLINE_ORGANIZATION_API_URL)%'
api_token: '%env(KNOWLEDGE_BASE_API_TOKEN)%'
api_docs:
keycloak_client_id: '%env(KEYCLOAK_FRONTEND_CLIENT_ID)%'
build_info: '%env(APP_BUILDINFO)%'
build_info_url: '%env(APP_BUILDINFO_URL)%'
\ No newline at end of file
debug:
dump_destination: "php://stderr"
framework:
profiler:
\ No newline at end of file
monolog:
handlers:
file-log:
type: rotating_file
level: debug
path: '%kernel.logs_dir%/%kernel.environment%.log'
max_files: 10
stdout-debug:
type: stream
path: 'php://stdout'
level: debug
channels: ['!event', "!request", "!security"]
bubble: false
stdout-warn:
type: stream
path: 'php://stdout'
level: warning
include_stacktraces: true
\ No newline at end of file
web_profiler:
toolbar: true
intercept_redirects: false
\ No newline at end of file
monolog:
handlers:
file-log:
type: rotating_file
level: info
path: '%kernel.logs_dir%/%kernel.environment%.log'
max_files: 10
\ No newline at end of file
DbpCoreBundle:
resource: "@DbpCoreBundle/Resources/config/routing.yaml"
\ No newline at end of file
_errors:
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
prefix: /_error
_errors:
resource: '@TwigBundle/Resources/config/routing/errors.xml'
prefix: /_error
web_profiler_wdt:
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
prefix: /_wdt
web_profiler_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
prefix: /_profiler
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment