Giter VIP home page Giter VIP logo

keyscom_be's Introduction

Keyscom API

About

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.

Installation

Files configuration

Run cp .env .env.local and change the configuration settings in .env.local.

If you use MacOS system:

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

Docker Network

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

After that:

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.

Configurations

PHPStorm

PHP Interpreter

  1. Access to PHP Settings (File > Settings > PHP)
  2. Select PHP language level (PHP 8.1)
  3. Add new interpreter (From Docker)
    1. New server (Docker) - Unix socket defaut
    2. Configuration File ./docker-compose.yml
    3. Service php
    4. Automatic path mapping

Debugger

  1. PhpStorm - Open Settings and access to PHP > Debug
    1. Only available the port 9003.
  2. PhpStorm - Open Settings, access to PHP > Servers
    1. Create a new server, IMPORTANT with the name localhost. This is important cause of docker-compose.yml config:
    environment:
    PHP_IDE_CONFIG: "serverName=localhost"
    
    1. Fill the host with localhost too
    2. Create a new Path Mapping to /var/www/html

Tests

Create configuration file cp ./phpunit.xml.dist ./phpunit.xml

  1. PHPStorm - Add new Test Frameworks (File > Settings > PHP > Test Framework)
  2. PHPStorm - Add new
    1. Not modify path mapping
    2. Still mark Use Composer Autoload
    3. Fill path with /var/www/html/vendor/autoload.php
    4. 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

Database

  1. Access to Database (right menu)
  2. Click on New > Datasource > PostgreSQL
  3. Config the connection by .env.local file params
  4. Download drivers on the same window if you haven't

Util Commands

Generate Migration

bin/console doctrine:migrations:diff

Execute Migrations

bin/console doctrine:migrations:migrate

Clear Database schema

bin/console doctrine:database:drop
bin/console doctrine:database:create

Fill Database

bin/console doctrine:fixtures:load --env=dev

keyscom_be's People

Contributors

techhoruser avatar dependabot[bot] avatar

Stargazers

 avatar Fco de Borja Sánchez avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.