-
-
Notifications
You must be signed in to change notification settings - Fork 127
Add Symfony CLI support for bootstrapping Sulu projects #645
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
Add Symfony CLI support for bootstrapping Sulu projects #645
Conversation
|
@nicolas-grekas one question just to make sure I understood the code correctly that handles template selection for the cloud configuration: I need to contribute a new Sulu template to https://github.com/symfonycorp/cloud-templates in the |
|
Because this might open the possibility to use others skeletons I would instead go with a string flag to specify the skeleton repository to use. This would let the user specify any repo and we could add some shortcut as WDYT? |
Correct but only if you need specifics. If you don't the generic Symfony template might be sufficient
If you are ok with building the CLI locally, you can edit |
1cdab05 to
032ba36
Compare
@tucksaun thanks for your feedback! I’ve refactored the code according to your suggestions. In the meantime, I’ve figured out how to test the upsun templates and forked the template repository (https://github.com/chirimoya/cloud-templates/tree/feature/sulu-upsun-template/upsun). So far it looks good, but I’m running into some challenges with the template definition and could use some input:
Any suggestions on how to solve these issues? /cc @nicolas-grekas |
032ba36 to
8e1eaf0
Compare
You might need to debug what
IIRC on SymfonyCloud one trick that was working was to use a "public" URL but protected with credentials. |
@tucksaun ... do you have any suggestions on how to solve this issue? By “predefined services,” I am referring to Varnish. Most projects I know don’t use Varnish for local development, but we highly recommend it for production. |
|
@chirimoya I'm not sure to understand your question because if I got it correctly by “predefined services” you are mostly referring to Varnish in production, but in such case the CLI is out of its scope here and won't be in use, so no interaction with “predefined services” whatsoever 🤔 |
|
@tucksaun ... by “predefined services” I’m referring to the |
33df8dc to
e563228
Compare
fabpot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me.
I'd like to better understand Oracle MySQL support here though.
| } else if strings.Contains(strings.ToLower(service.Image), "mysql") { | ||
| dbType = "oracle-mysql" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this part. Can you explain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous implementation was not able to distinguish between MariaDB and MySQL because only the port was taken into consideration. And it’s connected to how Upsun handles MariaDB/MySQL: https://docs.upsun.com/add-services/mysql.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may also need to mention this to make the changes clearer: handling service types like oracle-mysql and redis-persistent in upsun required adding the Endpoint property to the CloudService struct, since the endpoint does not match the service type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be else if strings.Contains(strings.ToLower(service.Image), "oracle-mysql") { then here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think so. This method is about parsing the Docker compose.yaml file and finding the matching upsun services. The Docker image name for Oracle MySQL is mysql. The matching service name on upsun is oracle-mysql. I know it's quite confusing. See https://docs.upsun.com/add-services/mysql.html
Until now, only the port was taken into consideration. So everything matching port 3306 was defined as upsun service mysql. But mysql within upsun actually refers to mariadb. Especially with the version section, things got a bit messy. In our case, it tried to interpret the service as MariaDB with version 8.0 of MySQL. I hope my fix will improve the mapping from Docker to upsun.
ae27471 to
ca330fa
Compare
Nothing you can do, it's a BC break upstream: platformsh/platformsh-docs#5067 (comment) |
|
PR unlocked by merging symfonycorp/cloud-templates#43 |
ca330fa to
61f7d22
Compare
|
Thank you @chirimoya. |
|
@fabpot Thanks! |
This pull request introduces initial support for creating new Sulu projects using the Symfony CLI.
e.g.
symfony new my-project --sulusymfony new my-project --skeleton=sulu