Skip to content
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

[#20] include project config, Mailpit setup #22

Merged
merged 9 commits into from
May 31, 2024

Conversation

joshuapease
Copy link
Contributor

@joshuapease joshuapease commented May 24, 2024

Overview

I think we could unlock some cool super-powers by committing baseline project config YAML in our starter.

  • Running ddev craft install will also auto-install all of the plugins (instead of that being a separate step after installing Craft.
  • We can pre-configure mail to use STMP and route all messages through mailpit locally (prevents accidental emails to users)
    • Included in this PR
  • We can configure default Volumes and S3 configs.
  • We can include a starter page builder and blocks rather than rely on a plugin to import/export JSON versions of blocks.

What this PR does

  • Include the default project config generated when running craft install
  • Configures mail settings to use SMTP and Mailpit for local development
  • Updates composer-scripts/post-create-project.php to replace any "starter" related text with the project specific text that the user is prompted with.

Testing steps

# Make an empty directory for the starter project
mkdir test-craft-starter

cd test-craft-starter

# composer create-project
docker run --rm -it -v "$PWD":/app -v ${COMPOSER_HOME:-$HOME/.composer}:/tmp composer create-project viget/craft-site-starter=dev-jp/20-include-project-config ./ --ignore-platform-reqs

# After the project has been scaffolded

ddev craft/install

ddev launch

@joshuapease joshuapease force-pushed the jp/20-include-project-config branch 2 times, most recently from 2685dc5 to ac9a86d Compare May 24, 2024 17:56
Base automatically changed from jp/14-install-plugins to 5.x May 24, 2024 19:55
@joshuapease joshuapease force-pushed the jp/20-include-project-config branch from ac9a86d to c7bc861 Compare May 28, 2024 18:55
@joshuapease joshuapease force-pushed the jp/20-include-project-config branch from 039dc26 to 81d715f Compare May 28, 2024 21:36
- SYSTEM_EMAIL_HOSTNAME=localhost
- SYSTEM_EMAIL_PORT=1025
- SYSTEM_EMAIL_USERNAME=abc
- SYSTEM_EMAIL_PASSWORD=123
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard coding these values into the DDEV config makes it harder to accidentally override these with production credentials.

Comment on lines +10 to +12
# BEGIN-STARTER-ONLY
config/license.key
# END-STARTER-ONLY
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is relatively simple to Regex replace everything within the tags

Comment on lines +3 to +4
use craft\helpers\Console;
use craft\helpers\StringHelper;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Realized I could use these Craft helpers, which makes ScriptHelpers super minimal (only need it for file text replacements).

Comment on lines +3 to +13
fromEmail: $SYSTEM_EMAIL_FROM
fromName: 'Viget Craft Starter'
replyToEmail: null
template: null
transportSettings:
host: $SYSTEM_EMAIL_HOSTNAME
password: $SYSTEM_EMAIL_PASSWORD
port: $SYSTEM_EMAIL_PORT
useAuthentication: '1'
username: $SYSTEM_EMAIL_USERNAME
transportType: craft\mail\transportadapters\Smtp
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assumes we'll use some kind of SMTP service on our projects.

I've found it to be necessary to get password reset emails to work, even for small clients.

It's super affordable: https://aws.amazon.com/ses/pricing/

imager-x:
edition: lite
enabled: true
licenseKey: REPLACE
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We remove these licenseKey lines. They auto-regenerate with new numbers when you create a new project and visit the Craft admin for the first time.

Comment on lines +16 to +18
35b563a0-4662-40b9-b885-a8450a2868d9: 'Viget Craft Starter' # Viget Craft Starter
805d8826-faed-4186-9b88-f509eb9b07e6: 'Viget Craft Starter' # Viget Craft Starter
b7e66782-af96-4012-9e17-914134073ced: Simple # Simple
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels a little funny that these UUIDs will be repeated across projects... but it would be impossible for two Craft projects to be installed using the exact same DB tables, so it's not really an issue.

@joshuapease joshuapease marked this pull request as ready for review May 28, 2024 21:53
@joshuapease joshuapease merged commit a349449 into 5.x May 31, 2024
@joshuapease joshuapease deleted the jp/20-include-project-config branch May 31, 2024 18:50
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.

5 participants