Added .env.example file to simplify getting started with docker compose#22247
Conversation
WalkthroughThe pull request introduces a new Possibly Related PRs
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.github/scripts/dev.js (1)
51-68: Consider consolidating announcement bar flag variations.The
availableAppFlagsobject includes three variations of the announcement bar flag: 'announcementBar', 'announcementbar', and 'announcement-bar'. This could lead to maintenance issues and confusion.Consider standardizing on a single flag name, preferably 'announcement-bar' to match the kebab-case pattern used in other flags like 'show-flags' and 'browser-tests'. Update the corresponding check at line 200 accordingly.
const availableAppFlags = { 'show-flags': 'Show available app flags, then exit', stripe: 'Run `stripe listen` to forward Stripe webhooks to the Ghost instance', all: 'Run all apps', ghost: 'Run only Ghost', admin: 'Run only Admin', 'browser-tests': 'Run browser tests', - announcementBar: 'Run Announcement Bar', - announcementbar: 'Run Announcement Bar', 'announcement-bar': 'Run Announcement Bar', portal: 'Run Portal', signup: 'Run Signup Form', search: 'Run Sodo Search', lexical: 'Use your local instance of the Lexical editor running in a separate process', comments: 'Run Comments UI', https: 'Serve apps using HTTPS', offline: 'Run in offline mode (no Stripe webhooks will be forwarded)' }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between cee2b99 and 89f214420f07d9ce79c862a2985e15b9238024a6.
📒 Files selected for processing (2)
.env.example(1 hunks).github/scripts/dev.js(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- .env.example
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: Regression tests (Node 20.11.1, mysql8)
- GitHub Check: Database tests (Node 20.11.1, sqlite3)
- GitHub Check: Database tests (Node 22.13.1, mysql8)
- GitHub Check: Database tests (Node 20.11.1, mysql8)
- GitHub Check: Ghost-CLI tests
- GitHub Check: Database tests (Node 18.12.1, mysql8)
- GitHub Check: Admin-X Settings tests
- GitHub Check: Admin tests - Chrome
🔇 Additional comments (2)
.github/scripts/dev.js (2)
73-97: LGTM! Well-implemented flag validation and help display.The implementation includes:
- Clear and informative help text with proper formatting
- Robust flag validation against available flags
- Consistent debug logging
- Appropriate error handling and process exit
71-71: LGTM! Improved flag handling robustness.The addition of
.filter(flag => flag.trim().length > 0)prevents issues with empty flags that could arise from trailing commas in the environment variable.
89f2144 to
dd2b766
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
.github/scripts/dev.js (2)
51-68: Standardize flag naming convention.The
availableAppFlagsobject contains inconsistent naming patterns and multiple aliases for the same functionality:
- Mixed usage of camelCase (
announcementBar), kebab-case (announcement-bar), and lowercase (announcementbar)- Multiple aliases increase maintenance overhead and may confuse users
Consider standardizing on kebab-case for all flags and deprecating aliases:
const availableAppFlags = { 'show-flags': 'Show available app flags, then exit', stripe: 'Run `stripe listen` to forward Stripe webhooks to the Ghost instance', all: 'Run all apps', ghost: 'Run only Ghost', admin: 'Run only Admin', 'browser-tests': 'Run browser tests', - announcementBar: 'Run Announcement Bar', - announcementbar: 'Run Announcement Bar', 'announcement-bar': 'Run Announcement Bar (preferred)', portal: 'Run Portal', signup: 'Run Signup Form', search: 'Run Sodo Search', lexical: 'Use your local instance of the Lexical editor running in a separate process', comments: 'Run Comments UI', https: 'Serve apps using HTTPS', offline: 'Run in offline mode (no Stripe webhooks will be forwarded)' }
83-96: Consider enhancing flag validation.The current validation is good but could be more robust by:
- Checking for mutually exclusive flags (e.g., 'all' with individual app flags)
- Validating flag combinations (e.g., 'https' requires at least one app flag)
Example implementation:
if (GHOST_APP_FLAGS.includes('show-flags')) { showAvailableAppFlags(); process.exit(0); } +// Check for mutually exclusive flags +if (GHOST_APP_FLAGS.includes('all') && + (GHOST_APP_FLAGS.includes('ghost') || + GHOST_APP_FLAGS.includes('admin') || + GHOST_APP_FLAGS.includes('portal'))) { + console.error(chalk.red('Error: The "all" flag cannot be used with individual app flags')); + showAvailableAppFlags(); + process.exit(1); +} + +// Check for required flag combinations +if (GHOST_APP_FLAGS.includes('https') && + !GHOST_APP_FLAGS.some(flag => ['all', 'portal', 'comments'].includes(flag))) { + console.error(chalk.red('Error: The "https" flag requires at least one app flag')); + showAvailableAppFlags(); + process.exit(1); +} // Check for invalid flags debug('checking for invalid flags', GHOST_APP_FLAGS);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 89f214420f07d9ce79c862a2985e15b9238024a6 and dd2b766.
📒 Files selected for processing (2)
.env.example(1 hunks).github/scripts/dev.js(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- .env.example
🔇 Additional comments (2)
.github/scripts/dev.js (2)
73-81: LGTM! Clear and helpful flag documentation.The
showAvailableAppFlagsfunction provides excellent user guidance by:
- Explaining both environment variable and command-line flag usage
- Clarifying Docker-specific limitations
- Listing all available flags with descriptions
156-258: LGTM! Well-structured flag handling with clear documentation.The implementation demonstrates:
- Consistent flag usage pattern
- Clear documentation of HTTPS configurations with Caddyfile examples
- Proper environment variable handling for each feature
…cker compose (TryGhost#22247)" This reverts commit 5547c0b.
no issue
ghostprofile by settingCOMPOSE_PROFILES=ghost.yarn docker:*commands, but if you run any otherdocker compose ...commands manually, theghostprofile won't be enabled by default.COMPOSE_PROFILESis with a.envfile in the root of the repo. This.env.examplefile is a template than can be easily copied to.envby runningcp .env.example .env, which will in turn enable theghostprofile.DEBUGmodes.This commit also includes some minor changes to the
dev.jsscript:availableFlags, including all the app flags that it will acceptshow-flagsflag, which will print all the available flags, along with a description, then immediately exit.Ultimately this makes getting started with docker compose more straight forward:
cp .env.example .envto enable theghostprofiledocker compose up