Coder Social home page Coder Social logo

dreamingechoes / multi_tenancex Goto Github PK

View Code? Open in Web Editor NEW
31.0 4.0 5.0 2.22 MB

Example of Phoenix application with database multi-tenancy.

Home Page: http://dreamingecho.es/blog/a-dive-into-database-multi-tenancy-in-elixir-with-ecto

License: MIT License

JavaScript 4.18% CSS 1.54% Elixir 75.02% HTML 17.98% Dockerfile 1.27%
elixir elixir-lang elixir-phoenix phoenix-framework multitenant-applications example-app

multi_tenancex's Introduction

MultiTenancex

CircleCI

Example of Phoenix application with database multi-tenancy. A practical way to see the concepts tackled in this post from my website.

Images

Home Home.

Login Login.

Admin Dashboard Admin Dashboard.

Admin Product Index Admin Product Index.

Admin Product New Admin Product New.

Company Home Company Home.

Example data

There's a user in the seeds to use for testing purposes:

Special database multi-tenant mix tasks

If you want to create some migration for every tenant:

> docker-compose run multi_tenancex mix multi_tenancex.gen.tenant_migration create_some_table

If you want to migrate the migrations for every tenant:

> docker-compose run multi_tenancex mix multi_tenancex.ecto.migrate_tenants

If you want to rollback the migrations for every tenant:

> docker-compose run multi_tenancex mix multi_tenancex.ecto.rollback_tenants

Setup development environment with Docker

This project is Docker friendly from day one. To start working on it:

  • Setup the multi_tenancex container with docker-compose build multi_tenancex.
  • Install dependencies with docker-compose run multi_tenancex mix deps.get.
  • Create your database with docker-compose run multi_tenancex mix ecto.create.
  • Migrate your database with docker-compose run multi_tenancex mix ecto.migrate.
  • Run seeds for default data with docker-compose run multi_tenancex mix run priv/repo/seeds.exs.
  • Install Node.js dependencies with docker-compose run multi_tenancex bash -c "cd assets; npm install".
  • Start the application with docker-compose up

Setup testing environment with Docker

This step assumes you already followed instructions from previous paragraph.

  • Create your testing database with docker-compose run multi_tenancex env MIX_ENV=test mix ecto.create.
  • Migrate your testing database with docker-compose run multi_tenancex env MIX_ENV=test mix ecto.migrate.
  • Run the test suite with docker-compose run multi_tenancex env MIX_ENV=test mix test.
  • Run the test suite with coverage report on cover folder with: docker-compose run multi_tenancex env MIX_ENV=test mix coveralls.html.

This project was developed by dreamingechoes. It adheres to its code of conduct and contributing guidelines, and uses an equivalent license.

multi_tenancex's People

Contributors

dreamingechoes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.