Skip to content

Installing and managing modules from admin panel #847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 55 commits into from
Oct 19, 2020

Conversation

YashGovekar
Copy link
Contributor

Modules Manager for installing and managing modules through admin panel.

@nabeelio
Copy link
Member

Hi, I have an open issue for this here: #466

I'm gonna look through this PR and pull it down, might take me a bit, though. I just need to make sure this is compatible with how the modules should primarily work - so downloading them from the composer package manager/making sure that the packages are compatible with composer.

Thanks for the PR! I will look through it and put some notes in soon.

@nabeelio nabeelio added this to the 7.0.0 milestone Sep 29, 2020
@nabeelio
Copy link
Member

StyleCI is also showing some formatting errors.

@nabeelio
Copy link
Member

Aside from the review changes, a few more things are needed - I want to store the module statuses in the database. So the database table/model structure will need to change a bit. A new Activator needs to be written and wired up:

https://github.com/nWidart/laravel-modules/blob/master/config/config.php#L203

A new DatabaseActivator: https://github.com/nWidart/laravel-modules/blob/master/src/FileRepository.php

@nabeelio
Copy link
Member

But before you start doing those changes, let's discuss them over in #466, there's a lot of thinking through, especially for a project like this. Thanks!!

@nabeelio
Copy link
Member

Also, thinking about it, this shouldn't be a module, it should be a part of the core system. Meaning it'll need to be more tightly integrated, including a ModuleService encapsulating a lot of the functionality that's in the admin controller.

@YashGovekar
Copy link
Contributor Author

Alright, will do the above mentioned things. So that it can be used for further development

@YashGovekar
Copy link
Contributor Author

Aside from the review changes, a few more things are needed - I want to store the module statuses in the database. So the database table/model structure will need to change a bit. A new Activator needs to be written and wired up:

https://github.com/nWidart/laravel-modules/blob/master/config/config.php#L203

A new DatabaseActivator: https://github.com/nWidart/laravel-modules/blob/master/src/FileRepository.php

Umm, I am not much aware about Activator
Are there any docs from where I can refer to?
Thanks!

@YashGovekar
Copy link
Contributor Author

But before you start doing those changes, let's discuss them over in #466, there's a lot of thinking through, especially for a project like this. Thanks!!

Yeah sure!

@YashGovekar
Copy link
Contributor Author

Also, thinking about it, this shouldn't be a module, it should be a part of the core system. Meaning it'll need to be more tightly integrated, including a ModuleService encapsulating a lot of the functionality that's in the admin controller.

Sure, can do that. I will integrate it directly inside App\ .
Let's see how it goes

@YashGovekar
Copy link
Contributor Author

Also see my comments about the writeDB method in the DatabaseActivator - that needs to be change so the callers are using the models directly.

Okay, I'll check..

@YashGovekar
Copy link
Contributor Author

Just testing this out now, there's an error when trying to import:

image

https://flareapp.io/share/OmV8bNR7

Oh, didn't try that. Will fix it.

@YashGovekar
Copy link
Contributor Author

Yeah, fixed the files.
Tried Import as well. Works fine.
Also updated the DatabaseActivator.

@nabeelio nabeelio merged commit 5803487 into phpvms:dev Oct 19, 2020
@nabeelio
Copy link
Member

I've merged this into dev, please try the importer from fresh and a fresh install and make sure it's working.

@YashGovekar
Copy link
Contributor Author

I've merged this into dev, please try the importer from fresh and a fresh install and make sure it's working.

Yeah, I tried it that day itself with the new commit. It worked.

@nabeelio
Copy link
Member

There is an error with migrations from modules not running - get this on the demo account. And some people are getting loops with the updater. I'm looking at it but you should too, add a migration in a module and it doesn't appear to run

@YashGovekar
Copy link
Contributor Author

There is an error with migrations from modules not running - get this on the demo account. And some people are getting loops with the updater. I'm looking at it but you should too, add a migration in a module and it doesn't appear to run

Umm so basically, when migrations are added to an exisiting module, they dont run through the updater?
Also, regarding the loops with the updater. I didn;t understand that?

@nabeelio
Copy link
Member

Ok, here's the problem, I'm trying to solve it now. If there's a module with migrations (for example, vmsacars), the migrations run first, then the module is enabled, then a seed tries to run. However, since a module isn't enabled when migrations run, the migrations for that module don't run. It's an issue of the sequencing. I'm trying to figure out how to solve it

@YashGovekar
Copy link
Contributor Author

he migrations run

Alright, I'll try this too.
Thanks

@nabeelio
Copy link
Member

Someone else is stuck in an update loop and can't get to the admin panel:

[2020-10-21 13:04:13] prod.INFO: Upgrade is pending  
[2020-10-21 13:05:06] prod.INFO: Upgrade is pending  
[2020-10-21 13:06:09] prod.INFO: Update: run_migrations {"_token":"DAuCgibeuppGMU3Pc6rVKuse7wHJzIZloKiUi6hI"} 
[2020-10-21 13:06:09] prod.INFO: Running seeder  
[2020-10-21 13:06:09] prod.INFO: Seeding ./home/skyvirtual/public_html/crew/app/Database/seeds/prod/ranks.yml  
[2020-10-21 13:06:33] prod.INFO: Upgrade is pending  
[2020-10-21 13:06:34] prod.INFO: Update: run_migrations {"_token":"6n5r8hwrRgrQv3cHjdicsAZZwiO5fInWfbdU9Oh6"} 
[2020-10-21 13:06:34] prod.INFO: Running seeder  
[2020-10-21 13:06:34] prod.INFO: Seeding ./home/skyvirtual/public_html/crew/app/Database/seeds/prod/ranks.yml  
[2020-10-21 13:06:38] prod.INFO: Upgrade is pending  
[2020-10-21 13:06:42] prod.INFO: Upgrade is pending  
[2020-10-21 13:07:55] prod.INFO: Upgrade is pending  
[2020-10-21 13:07:57] prod.INFO: Upgrade is pending  
[2020-10-21 13:08:08] prod.INFO: Upgrade is pending  
[2020-10-21 13:09:45] prod.INFO: Upgrade is pending  
[2020-10-21 13:09:48] prod.INFO: Update: run_migrations {"_token":"DAuCgibeuppGMU3Pc6rVKuse7wHJzIZloKiUi6hI"} 
[2020-10-21 13:09:48] prod.INFO: Running seeder  
[2020-10-21 13:09:48] prod.INFO: Seeding ./home/skyvirtual/public_html/crew/app/Database/seeds/prod/ranks.yml  
[2020-10-21 13:10:14] prod.INFO: Upgrade is pending  
[2020-10-21 13:10:47] prod.INFO: Upgrade is pending  
[2020-10-21 13:11:34] prod.INFO: Upgrade is pending  
[2020-10-21 13:12:24] prod.INFO: Upgrade is pending  
[2020-10-21 13:13:13] prod.INFO: Upgrade is pending  
[2020-10-21 13:16:43] prod.WARNING: Error logging in, pilot_id not found, id=VSA36  
[2020-10-21 13:16:43] prod.WARNING: Error logging in, pilot_id not found, id=VSA36  
[2020-10-21 13:16:58] prod.INFO: Upgrade is pending  
[2020-10-21 13:17:00] prod.INFO: Update: run_migrations {"_token":"WYA0vT6Dg0d7OQ8VL4DA5JqleIdSiyv4DxF03gBY"} 
[2020-10-21 13:17:00] prod.INFO: Running seeder  
[2020-10-21 13:17:00] prod.INFO: Seeding ./home/skyvirtual/public_html/crew/app/Database/seeds/prod/ranks.yml  
[2020-10-21 13:17:03] prod.INFO: Upgrade is pending  
[2020-10-21 13:17:05] prod.INFO: Upgrade is pending  
[2020-10-21 13:17:12] prod.INFO: Upgrade is pending  
[2020-10-21 13:19:40] prod.INFO: Upgrade is pending  
[2020-10-21 13:22:27] prod.INFO: Upgrade is pending  
[2020-10-21 13:28:20] prod.INFO: Upgrade is pending  
[2020-10-21 13:34:00] prod.INFO: Upgrade is pending  
[2020-10-21 13:34:01] prod.INFO: Update: run_migrations {"_token":"I5mNBMQYJV7fQIoOuFPylqd23oqj7sTfCxJYs9pv"} 
[2020-10-21 13:34:01] prod.INFO: Running seeder  
[2020-10-21 13:34:01] prod.INFO: Seeding ./home/skyvirtual/public_html/crew/app/Database/seeds/prod/ranks.yml  

@nabeelio
Copy link
Member

This is on a fresh install

@YashGovekar
Copy link
Contributor Author

This is on a fresh install

So, when fresh installed and a new update is pushed, the upgrade gets looped?

@nabeelio
Copy link
Member

No updates, just on a fresh install.

@YashGovekar
Copy link
Contributor Author

No updates, just on a fresh install.

Let me try and see what it logs again.

@YashGovekar
Copy link
Contributor Author

Please check the new PR for Module Migration error.

@YashGovekar
Copy link
Contributor Author

This is on a fresh install

Did a fresh install using git clone.
Everything works fine for me.

@nabeelio
Copy link
Member

Try the dev tar file

@YashGovekar
Copy link
Contributor Author

Okay

Try the dev tar file

@YashGovekar
Copy link
Contributor Author

Alright, trying this one : https://codeload.github.com/nabeelio/phpvms/tar.gz/dev

@nabeelio
Copy link
Member

@YashGovekar
Copy link
Contributor Author

Okay

@YashGovekar
Copy link
Contributor Author

Umm it's giving me Internal Server Error on xampp.

@YashGovekar
Copy link
Contributor Author

Hey Nabeel, the installation went perfectly for me using the .tar file you provided.
Here's the log :

[2020-10-21 15:21:51] dev.INFO: Testing Connection: mysql::root:<hidden>@127.0.0.1:3306;phpvms_new [2020-10-21 15:21:51] dev.INFO: Connection string: mysql:host=127.0.0.1;port=3306;dbname=phpvms_new [2020-10-21 15:22:15] dev.INFO: ENV setup {"_token":"87VidAmJV3WpNV46tyxLleKAXfET5c9JUBJQvreu","site_name":"phpvms","site_url":"http://phpvms.test","db_conn":"mysql","db_host":"127.0.0.1","db_port":"3306","db_name":"phpvms_new","db_user":"root","db_pass":"","db_prefix":null} [2020-10-21 15:22:15] dev.INFO: Testing Connection: mysql::root:<hidden>@127.0.0.1:3306;phpvms_new [2020-10-21 15:22:15] dev.INFO: Connection string: mysql:host=127.0.0.1;port=3306;dbname=phpvms_new [2020-10-21 15:22:15] dev.INFO: Connection string: mysql:host=127.0.0.1;port=3306; [2020-10-21 15:22:15] dev.INFO: Detected DB Version: 5.5.5-10.4.14-mariadb [2020-10-21 15:22:15] dev.INFO: Detected MariaDB, setting DB_EMULATE_PREPARES to true [2020-10-21 15:22:15] dev.INFO: No extension detected, using file cache [2020-10-21 15:22:15] dev.INFO: Redirecting to database setup [2020-10-21 15:23:07] prod.INFO: Running seeder [2020-10-21 15:23:07] prod.INFO: Seeding .E:\xampp\htdocs\phpVMS7\phpvms_new\phpvms/app/Database\seeds/prod/ranks.yml [2020-10-21 15:23:34] prod.INFO: Set pilot ID for user 1 to 1 [2020-10-21 15:23:35] prod.INFO: NotificationEvents::onUserRegister: VTI0001 is Active, sending active email [2020-10-21 15:23:38] prod.EMERGENCY: Error emailing admins, malformed email=Process could not be started [The system cannot find the path specified. ] [2020-10-21 15:23:39] prod.EMERGENCY: Error emailing admins, malformed email=Process could not be started [The system cannot find the path specified. ] [2020-10-21 15:23:39] prod.INFO: User registered: {"id":1,"pilot_id":1,"name":"Yash Govekar","email":"yash.govekar55@gmail.com","airline_id":1,"rank_id":1,"country":null,"home_airport_id":null,"curr_airport_id":null,"last_pirep_id":null,"flights":0,"flight_time":0,"transfer_time":0,"avatar":null,"timezone":null,"status":0,"state":1,"toc_accepted":null,"opt_in":null,"active":null,"last_ip":null,"created_at":"2020-10-21T15:23:34.000000Z","updated_at":"2020-10-21T15:23:34.000000Z","deleted_at":null,"journal":{"id":3,"ledger_id":null,"type":1,"balance":{"App\\Support\\Money":"$0.00"},"currency":"USD","morphed_type":"App\\Models\\User","morphed_id":1,"created_at":"2020-10-21T15:23:34.000000Z","updated_at":"2020-10-21T15:23:34.000000Z"},"rank":{"id":1,"name":"New Pilot","image_url":null,"hours":0,"acars_base_pay_rate":"50.00","manual_base_pay_rate":"25.00","auto_approve_acars":false,"auto_approve_manual":false,"auto_promote":true,"auto_approve_above_score":0,"auto_approve_score":null,"created_at":null,"updated_at":null},"airline":{"id":1,"icao":"VTI","iata":null,"name":"Vistara Virtual","country":"in","logo":null,"active":true,"total_flights":0,"total_time":0,"created_at":"2020-10-21T15:23:33.000000Z","updated_at":"2020-10-21T15:23:33.000000Z"}} [2020-10-21 15:26:11] prod.INFO: Upgrade is pending [2020-10-21 15:26:16] prod.INFO: Update: run_migrations {"_token":"rl0pxCLEv3xaCmElVBvrQ15TEmJcoiU1HumdJ9Fm"} [2020-10-21 15:26:16] prod.INFO: Running seeder [2020-10-21 15:26:16] prod.INFO: Seeding .E:\xampp\htdocs\phpVMS7\phpvms_new\phpvms/app/Database\seeds/prod/ranks.yml

@nabeelio
Copy link
Member

Ok, so then there's an issue with modules and migrations

@YashGovekar
Copy link
Contributor Author

Yeah,
So I think the issue arises when the module is copied directly into modules folder.

@YashGovekar
Copy link
Contributor Author

@nabeelio Check this nWidart/laravel-modules#1039

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create module enable/disable panel
2 participants