phundament / app

Dockerized Yii2 web application base
http://phundament.com
Other
310 stars 129 forks source link

Phundament with postgres db. #195

Closed StalkAlex closed 8 years ago

StalkAlex commented 8 years ago

Is there any opportunity to have another version based on postgres image instead of mariadb? In no case I am not so proficient in Docker, so I could use a little help to make it by myself.

schmunk42 commented 8 years ago

It's on my list since a while, but I never had the time to work on it.

Basically you need to replace the MySQL image with a Postgres and adjust the driver in the config. There may also smaller glitches ahead with the DB and user setup and migrations, but the template is prepared to handle that.

Here's just a quick-shot: https://github.com/phundament/app/tree/feature/postgres

We need to fix yii2-pages, as a workaround disable it's migrations https://github.com/dmstr/yii2-pages-module/blob/master/Bootstrap.php#L30

StalkAlex commented 8 years ago

Thanks, It's working quite smoothly with postgres db. But I rewrote migration you've mentioned. Here's my version, not sure if it's super correct. https://gist.github.com/akaSStalkALEX/b4c19869e974de226bfc

schmunk42 commented 8 years ago

Nice! Thank you, will try to merge this ASAP.

One more thing, ... currently there's a MySQL CLI controller registered in the application, see

I don't know if you need to create a Postgres version for it. If the image supports user setup and you're fine with it - perfect.

It's in use here: https://github.com/phundament/app/blob/master/src/setup.sh#L9 - maybe you also have to remove it. But it's definitely a goal to make the template database agnostic.

Would also be great if you could give https://github.com/schmunk42/yii2-giiant a try with Postgres ;)

StalkAlex commented 8 years ago

Yes, forgot to mentioned it :) I turned off db creating too and created db manually. Giiant is working quite alright too. We are using it from backend for creating models and haven't seen any serious problems yet. One thing - show difference is not working, when model, for example, was being recreated.

schmunk42 commented 8 years ago

One thing - show difference is not working, when model, for example, was being recreated.

CLI or Web UI? Did you enable --crudTidyOutput?

PS: Thanks for the feedback, good to hear.

StalkAlex commented 8 years ago

I used Web UI. After "diff" button clicked, another page is shown with error message "File has not been found someHashHere". I could make screenshot later if you need.

schmunk42 commented 8 years ago

Would be really helpful, maybe it's the best just to create an issue at giiant's repo.

schmunk42 commented 8 years ago

@akaSStalkALEX Just FYI, I refactored yii2-pages migrations: https://github.com/dmstr/yii2-pages-module/commit/2c987afa2e54c0e1850932d5617dae393fe11676

Not released yet.

StalkAlex commented 8 years ago

@schmunk42 Hey) Thank you very much!

schmunk42 commented 8 years ago

Current status

On top of https://github.com/phundament/app/tree/feature/postgres - you need to uncomment this line in src/setup.sh

#./yii db/create

I think about removing that line and adding it to a manual setup setup step, but I am not fully decided yet.

Moreover you need these aliases in composer.json

"dektrium/yii2-user": "dev-master as 0.9.5.99",
"dmstr/yii2-pages-module": "dev-feature/compose-v2 as 0.12.0",

I think we can release 0.12.0 for pages, but we'll need to wait for dektrium for a new yii2-user release.

I'll keep this issue open until then.

schmunk42 commented 8 years ago

I've added this here: https://github.com/phundament/docs/blob/master/6-tutorials/database.md#using-a-postgresql-database