Coder Social home page Coder Social logo

sf5-multi-tenancy-app's Introduction

Symfony 5.2 multi-tenancy configuration

The application generates a dynamic and secure MYSQL user with rights only on its own database which is created at the same time.

The application does not have a front template. There are only entities, listener, and a tenant build service.

Installation with Docker

See .env file, there are environment variables for the tenants build service (TENANT_DATABASE_HOST, etc...)

Run console commands for Docker & Symfony install

docker-compose up -d
docker exec -i sf5multitenancy_phpfpm bash -c "composer install"

Run console commands for Main DataBase

docker exec -i sf5multitenancy_phpfpm bash -c "php bin/console doctrine:schema:update --force"

Run console commands for create a Tenant

docker exec -i sf5multitenancy_phpfpm bash -c "php bin/console app:create-tenant TENANT_NAME_HERE"
docker exec -i sf5multitenancy_phpfpm bash -c "php bin/console messenger:consume async_priority_high -vv"

FYI : Tenant Name is Unique

FYI2 : If you don't wan't Symfony Messenger for async creation, in config/packages/messenger.yaml, comment on line 13

Command For play with Tenant DataBase

exemple:

docker exec -i sf5multitenancy_phpfpm bash -c "php bin/console doctrine:schema:update --force tenant=TENANT_ID_HERE"

Check DataBases with Adminer

You can look databases here : http://localhost:9002/?server=mariadb&username=root

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.