-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into ft/versioning
- Loading branch information
Showing
1,202 changed files
with
64,522 additions
and
68,248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Check Docs | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
prettier: | ||
name: Lint prettier | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/iron | ||
|
||
- name: Run Prettier on Docs | ||
working-directory: docs | ||
run: npx prettier . --check | ||
|
||
check-build: | ||
name: Check Docs build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/iron | ||
|
||
- name: Install tooling | ||
working-directory: docs | ||
run: npm install | ||
|
||
- name: Build docs with VitePress | ||
working-directory: docs | ||
run: npm run docs:build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
micropowermanager.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,12 @@ | |
|
||
# MicroPowerManager | ||
|
||
--- | ||
MicroPowerManager (MPM) is a decentralized utility and customer management tool. | ||
Manage customers, revenues and assets with this all-in one Open Source platform. | ||
|
||
## Documentation | ||
|
||
MPM's documentation is hosted on [micropowermanager.io](https://micropowermanager.io/). | ||
|
||
## This project | ||
|
||
|
@@ -41,245 +46,14 @@ | |
- It uses Node 16.10 | ||
- It uses MariaDB 10.3 which is compatible with MySQL 5.7 | ||
|
||
## Setup | ||
|
||
--- | ||
|
||
### Docker installation | ||
|
||
**Windows and Mac:** | ||
|
||
- [Docker Desktop](https://www.docker.com/products/docker-desktop). | ||
|
||
**Linux:** | ||
|
||
- Docker provides installation instructions for various Linux distributions. You can find them on | ||
the [Docker installation page for Linux.](https://docs.docker.com/engine/install/). | ||
|
||
### Docker Compose | ||
|
||
Docker Compose is often included with the Docker Desktop installations for Windows and Mac. For Linux, you might need to | ||
install it separately. | ||
|
||
**Windows and Mac:** | ||
|
||
- Included with Docker Desktop. | ||
|
||
**Linux:** | ||
|
||
- Docker Compose on GitHub <https://github.com/docker/compose/releases> | ||
- On the GitHub page, you can find instructions for downloading and installing Docker Compose on Linux. Be sure to check | ||
for the latest release. | ||
|
||
### Repository setup | ||
|
||
1. Clone or download the repository | ||
2. Build the docker containers with `docker-compose up` | ||
|
||
## Development | ||
|
||
--- | ||
|
||
The development environment is served under <http://localhost:8000> | ||
|
||
## Frontend | ||
|
||
The frontend is served under <http://localhost:8001>. You can find frontend files under `Website/ui`. | ||
The frontend is built with Vue.js. After first run with `docker-compose up` dependencies will be installed | ||
automatically. | ||
If you want to install dependencies manually, you can run `npm install` under `Website/ui` folder. | ||
|
||
### Folder Structure | ||
|
||
When adding new files to the project, please adhere to the following folder structure: | ||
|
||
- **Creating New Modules:** | ||
Modules are the components used in pages. For example, the Client module holds components related to clients. Every | ||
component associated with clients should be placed under the Client module. | ||
|
||
```sh | ||
Website/ui | ||
├── src | ||
│ ├── modules | ||
│ │ ├── newModule | ||
``` | ||
|
||
- **Creating New Pages:** | ||
Pages are the components used in routes. We follow the nuxt.js folder structure for pages. The `index.vue` file under | ||
a page folder represents the listing page of the page, while the `_id.vue` file represents the detail page. Since we | ||
are not using nuxt.js, routes need to be defined manually. You can find the routes in | ||
the `Website/ui/src/ExportedRoutes.js` file. | ||
|
||
```sh | ||
Website/ui | ||
├── src | ||
│ ├── pages | ||
│ │ ├── newPage | ||
| | | ├── index.vue | ||
| | | ├── _id.vue | ||
``` | ||
|
||
#### Plugins | ||
|
||
Plugins are additional components developed as separate packages to enhance our product. This separation helps keep the | ||
main codebase clean. Each plugin should reside in its own folder under the `Website/ui/src/plugins` directory. | ||
Additionally, each plugin should have its own backend code, which will be explained in the backend section. | ||
|
||
```sh | ||
Website/ui | ||
├── src | ||
│ ├── plugins | ||
│ │ ├── newPlugin | ||
``` | ||
|
||
In the backend section, you'll find instructions on how to create a plugin. | ||
|
||
## Backend | ||
|
||
The backend is built with Laravel. The backend is served under <http://localhost:8000/api>. You can find backend | ||
files under `Website/htdocs/mpmanager`. After the first run with `docker-compose up`, dependencies will be installed | ||
automatically. If you prefer to install dependencies manually or need to add additional packages, follow these steps: | ||
|
||
1. Enter the Docker container named "laravel" by navigating to the "mpmanager" directory: | ||
|
||
```bash | ||
docker exec -it laravel bash | ||
cd mpmanager | ||
``` | ||
|
||
2. Run the following command to install dependencies, replacing {package-name} with the actual name of the package: | ||
|
||
```bash | ||
./composer.phar install {package-name} | ||
``` | ||
|
||
These steps ensure that you can manage dependencies either automatically during the initial docker-compose up or | ||
manually when needed. | ||
Make sure to replace `{package-name}` with the actual name of the package you want to install. | ||
|
||
We followed the laravel folder structure for the backend. If you want to learn more about the folder structure, you can | ||
check the [Laravel documentation](https://laravel.com/docs/9.x/structure). | ||
|
||
### Sharding in Micropower Manager | ||
|
||
Sharding is a technique employed to partition a large database into smaller, more agile, and easily manageable segments | ||
known as data shards. In the context of Micropower Manager, sharding is integral to the implementation of Software as a | ||
Service (SaaS) functionality. | ||
|
||
#### Shard Representation | ||
|
||
Each shard in Micropower Manager represents an individual company leveraging the platform for their Customer | ||
Relationship Management (CRM) needs. | ||
|
||
#### Central Database - "micro_power_manager" | ||
|
||
To facilitate this, a central database named "micro_power_manager" is established. This central database houses | ||
company-specific information and common data such as installable plugins. | ||
|
||
#### New Company Registration Process | ||
|
||
When a new company registers an account, a dedicated database is dynamically created for that specific company. This new | ||
database incorporates Micropower Manager's core migration files located at `Website/htdocs/mpmanager/database/migrations/micropowermanager` | ||
|
||
#### User Session Interaction | ||
|
||
Upon successful registration, when a user associated with a particular company logs into Micropower Manager, the | ||
database connection for their session is dynamically altered. This ensures that the user gains access to and interacts | ||
with data exclusive to their company, providing a personalized and secure experience within the application. | ||
|
||
### Migration on First run | ||
|
||
When you run the application for the first time, you need to run the following command to migrate the database: | ||
|
||
```bash | ||
docker exec -it laravel bash | ||
cd mpmanager | ||
php artisan sharding:initialize | ||
``` | ||
|
||
This command will create the central database which is required for MPM to function. | ||
|
||
If you want to load sample (dummy) data for testing run: | ||
|
||
```bash | ||
docker exec -it laravel bash | ||
cd mpmanager | ||
php artisan dummy:create-company-with-dummy-data | ||
php artisan migrator:copy | ||
php artisan migrator:migrate | ||
``` | ||
|
||
This commands will create the first company database with dummy data from a snapshot. | ||
It will then apply any migrations that have been added to the application after the snapshot has been taken. | ||
|
||
You can use the following credentials to login to the application: | ||
|
||
```sh | ||
username: [email protected] | ||
password: 123123 | ||
``` | ||
|
||
The dummy protected page password of this company is 123123. | ||
|
||
### Sharding Specific Migration Commands | ||
|
||
- **Creating Migration File:** | ||
When creating a migration file, you need to use the following command: | ||
|
||
```bash | ||
docker exec -it laravel bash | ||
cd mpmanager | ||
php artisan migrator:create {migration-name} | ||
``` | ||
|
||
This command creates a migration file in Micropower Manager's core migration files location: `Website/htdocs/mpmanager/database/migrations/micropowermanager` | ||
|
||
After creating the migration file, you can shift it to other company databases using the following command: | ||
|
||
```bash | ||
docker exec -it laravel bash | ||
cd mpmanager | ||
php artisan migrator:copy | ||
``` | ||
|
||
This command syncs the migration files in the core migration folder for other company migrations. | ||
|
||
To migrate the database, use the following command: | ||
|
||
```bash | ||
docker exec -it laravel bash | ||
cd mpmanager | ||
php artisan migrator:migrate | ||
``` | ||
|
||
Alternatively, you can migrate the database for a specific company using the following command: | ||
|
||
```bash | ||
docker exec -it laravel bash | ||
cd mpmanager | ||
php shard:migrate {company_id} {--force} | ||
``` | ||
|
||
### Install Plugins | ||
|
||
We have a custom plugin creator command that generates a template. Use the following command to create a new plugin: | ||
|
||
```bash | ||
docker exec -it laravel bash | ||
cd mpmanager | ||
php artisan micropowermanager:new-package {package-name} | ||
``` | ||
|
||
This command creates a plugin template in the Website/htdocs/mpmanager/packages/inensus folder. Upon creation, you can proceed with plugin development. You can check other plugins for reference. | ||
Additionally, this command will create UI folders for the newly created plugin. Move the created UI folder to the Website/ui/src/plugins folder. | ||
## Getting Started | ||
|
||
### phpMyAdmin | ||
Explore MPM's capabilities by | ||
|
||
To project also includes phpMyAdmin which enables quick database operations without installing third-party software or writing any single line into the terminal. | ||
- logging into the [Demo Version](https://demo.micropowermanager.io/) | ||
- setting up a local installation following this [guide](https://micropowermanager.io/development/development-environment.html) | ||
|
||
The default credentials for the database are: | ||
## Support | ||
|
||
```sh | ||
username: root | ||
password: wF9zLp2qRxaS2e | ||
``` | ||
- [OSEA Discord](https://discord.osea-community.org/) (`#micropowermanager` channel) | ||
- [EnAccess](https://enaccess.org/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.