This project is the backend app for the Keyscom. This application implements and easy method to add and remove users access by ssh to servers.
Run cp .env .env.local
and change the configuration settings in .env.local
.
You need replace the next line on .docker/Dockerfile-php
:
&& echo "xdebug.client_host=172.17.0.1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
To
&& echo "xdebug.client_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
For use the aplication in local environment with users machines and server emulation, you can use de keyscom_cluster repository. For that reason, if you want to use that repository in the future, you need to create a docker network with the following command:
docker network create -o "com.docker.network.bridge.name=keyscom-network" keyscom-network
Run docker-compose up -d
to run app.
Run docker-compose exec php composer install
to install the vendors.
Run docker-compose exec php php bin/console assets:install
to install the assets.
Run docker-compose exec php php bin/console lexik:jwt:generate-keypair
for generate pair of keys for JWT library.
Run docker-compose exec php ./.docker/utils/recreate_db.sh dev
for create a populate database
The application is running in http://localhost:8080. You can see OpenAPI documentation on http://localhost:8080/doc.
- Access to PHP Settings (
File > Settings > PHP
) - Select PHP language level (
PHP 8.1
) - Add new interpreter (
From Docker
)- New server (
Docker
) - Unix socket defaut - Configuration File
./docker-compose.yml
- Service
php
- Automatic path mapping
- New server (
- PhpStorm - Open Settings and access to
PHP > Debug
- Only available the port 9003.
- PhpStorm - Open Settings, access to
PHP > Servers
- Create a new server, IMPORTANT with the name
localhost
. This is important cause ofdocker-compose.yml
config:
environment: PHP_IDE_CONFIG: "serverName=localhost"
- Fill the host with localhost too
- Create a new Path Mapping to
/var/www/html
- Create a new server, IMPORTANT with the name
Create configuration file cp ./phpunit.xml.dist ./phpunit.xml
- PHPStorm - Add new Test Frameworks (
File > Settings > PHP > Test Framework
) - PHPStorm - Add new
- Not modify path mapping
- Still mark
Use Composer Autoload
- Fill path with
/var/www/html/vendor/autoload.php
- Mark
Default configuration file
and fill in with/var/www/html/phpunit.xml
Execute them with docker-compose exec php ./vendor/bin/phpunit tests
Or generating html-coverage folder with
docker-compose exec -e XDEBUG_MODE=coverage php ./vendor/bin/phpunit tests
- Access to Database (right menu)
- Click on
New > Datasource > PostgreSQL
- Config the connection by
.env.local
file params - Download drivers on the same window if you haven't
bin/console doctrine:migrations:diff
bin/console doctrine:migrations:migrate
bin/console doctrine:database:drop
bin/console doctrine:database:create
bin/console doctrine:fixtures:load --env=dev