@codigodoleo/wp-kit 2.0.4 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/.cspell.json +5 -25
  2. package/README.md +127 -2
  3. package/lib/cli.js +1 -0
  4. package/lib/commands/init.js +32 -10
  5. package/lib/config/versions.js +163 -0
  6. package/lib/core/generator.js +63 -46
  7. package/lib/core/hook-manager.js +2 -2
  8. package/lib/core/infer-ci-capabilities.js +13 -24
  9. package/lib/prompts/index.js +31 -19
  10. package/lib/prompts/loadModulePrompts.js +4 -2
  11. package/lib/utils/generate-from-template.js +1 -0
  12. package/modules/deploy/index.js +34 -7
  13. package/modules/deploy/prompts.js +5 -5
  14. package/modules/deploy/templates/.github/workflows/ci.yml.hbs +49 -103
  15. package/modules/deploy/templates/.gitlab/gitlab-ci.yml.hbs +45 -145
  16. package/modules/deploy/templates/bitbucket-pipelines.yml.hbs +46 -97
  17. package/modules/docs/prompts.js +2 -2
  18. package/modules/docs/templates/README.md.hbs +67 -160
  19. package/modules/docs/templates/docs/Arquitetura.md +113 -92
  20. package/modules/docs/templates/docs/Deploy-Pipeline.md +22 -8
  21. package/modules/docs/templates/docs/Desenvolvimento.md +187 -164
  22. package/modules/docs/templates/docs/Getting-Started.md +37 -7
  23. package/modules/docs/templates/docs/Infraestrutura.md +41 -12
  24. package/modules/docs/templates/docs/Monitoramento.md +83 -45
  25. package/modules/docs/templates/docs/Sync-the-Production-DB-with-the-Staging-DB.md +6 -7
  26. package/modules/docs/templates/docs/Troubleshooting.md +1 -1
  27. package/modules/git/.github/PULL_REQUEST_TEMPLATE.md +1 -0
  28. package/modules/git/.gitlab/merge_request_templates/default.md +1 -0
  29. package/modules/git/.vscode/commit-instructions.md +7 -0
  30. package/modules/git/.vscode/conventional-commits.code-snippets +13 -43
  31. package/modules/git/docs/CONVENTIONAL-COMMITS.md +14 -14
  32. package/modules/git/index.js +39 -34
  33. package/modules/git/prompts.js +4 -4
  34. package/modules/git/templates/.lando.yml.hbs +5 -13
  35. package/modules/git/templates/package.json.hbs +4 -15
  36. package/modules/git/templates/workspace.json.hbs +28 -114
  37. package/modules/lint/eslint.config.mjs +36 -0
  38. package/modules/lint/index.js +1 -2
  39. package/modules/lint/prompts.js +3 -3
  40. package/modules/lint/templates/.lando.yml.hbs +2 -10
  41. package/modules/lint/templates/package.json.hbs +4 -16
  42. package/modules/lint/templates/workspace.json.hbs +15 -56
  43. package/modules/php/prompts.js +2 -2
  44. package/modules/php/templates/.lando.yml.hbs +2 -11
  45. package/modules/php/templates/composer.json.hbs +1 -6
  46. package/modules/php/templates/workspace.json.hbs +15 -74
  47. package/modules/redis/prompts.js +2 -2
  48. package/modules/redis/templates/.lando.yml.hbs +1 -8
  49. package/modules/sage/index.js +115 -7
  50. package/modules/sage/prompts.js +3 -3
  51. package/modules/sage/templates/.lando.yml.hbs +20 -64
  52. package/modules/sage/templates/theme/composer.json.hbs +3 -18
  53. package/modules/sage/templates/theme/package.json.hbs +3 -11
  54. package/modules/sage/templates/theme/style.css.hbs +20 -13
  55. package/modules/sage/templates/theme/vite.config.js.hbs +13 -53
  56. package/modules/sage/templates/workspace.json.hbs +12 -67
  57. package/modules/test-directory/prompts.js +2 -2
  58. package/package.json +20 -1
  59. package/templates/.editorconfig.hbs +5 -39
  60. package/templates/.env.hbs +14 -35
  61. package/templates/.gitignore.hbs +13 -86
  62. package/templates/.lando.yml.hbs +11 -44
  63. package/templates/README.md.hbs +7 -8
  64. package/templates/composer.json.hbs +12 -60
  65. package/templates/server/cmd/install-wp.sh.hbs +43 -58
  66. package/templates/server/www/vhosts.conf.hbs +21 -71
  67. package/templates/workspace.json.hbs +40 -177
@@ -1,39 +1,5 @@
1
- root = true
2
-
3
- [*]
4
- charset = utf-8
5
- indent_style = space
6
- indent_size = 2
7
- end_of_line = lf
8
- insert_final_newline = true
9
- trim_trailing_whitespace = true
10
-
11
- [*.php]
12
- indent_size = 4
13
- max_line_length = 120
14
-
15
- [*.blade.php]
16
- indent_size = 4
17
- insert_final_newline = true
18
- trim_trailing_whitespace = true
19
-
20
- [*.js]
21
- indent_size = 2
22
-
23
- [*.json]
24
- indent_size = 2
25
-
26
- [*.css]
27
- indent_size = 2
28
-
29
- [*.scss]
30
- indent_size = 2
31
-
32
- [*.md]
33
- trim_trailing_whitespace = false
34
-
35
- [*.yml]
36
- indent_size = 2
37
-
38
- [*.yaml]
39
- indent_size = 2
1
+ root = true [*] charset = utf-8 indent_style = space indent_size = 2 end_of_line = lf
2
+ insert_final_newline = true trim_trailing_whitespace = true [*.php] indent_size = 4 max_line_length
3
+ = 120 [*.blade.php] indent_size = 4 insert_final_newline = true trim_trailing_whitespace = true
4
+ [*.js] indent_size = 2 [*.json] indent_size = 2 [*.css] indent_size = 2 [*.scss] indent_size = 2
5
+ [*.md] trim_trailing_whitespace = false [*.yml] indent_size = 2 [*.yaml] indent_size = 2
@@ -1,48 +1,27 @@
1
- PROJECT_NAME="{{projectName}}"
2
- PROJECT_VERSION="{{projectVersion}}"
3
- PROJECT_DOMAIN="{{projectDomain}}"
4
- APP_URL="https://{{projectDomain}}"
5
- AUTHOR="{{author}}"
6
- PHP_VERSION="{{phpVersion}}"
7
- NODE_VERSION="{{nodeVersion}}"
1
+ PROJECT_NAME="{{projectName}}" PROJECT_VERSION="{{projectVersion}}" PROJECT_DOMAIN="{{projectDomain}}"
2
+ APP_URL="https://{{projectDomain}}" AUTHOR="{{author}}" PHP_VERSION="{{phpVersion}}" NODE_VERSION="{{nodeVersion}}"
8
3
  WP_CORE_VERSION="{{wpCoreVersion}}"{{#if enable_sage}}
9
- SAGE_VERSION="{{sageVersion}}"{{/if}}
10
- GIT_REPOSITORY="{{gitRepository}}"
11
-
12
- WORDPRESS_SITE_URL="https://{{projectDomain}}"
13
- WORDPRESS_DB_NAME="wordpress"
14
- WORDPRESS_DB_USER="wordpress"
15
- WORDPRESS_DB_PASSWORD="wordpress"
16
- WORDPRESS_DB_HOST="database"
17
- WORDPRESS_DB_CHARSET="utf8"
18
- WORDPRESS_DB_COLLATE=""
19
- WORDPRESS_TABLE_PREFIX="wp_"
20
- WORDPRESS_DEBUG={{enableDebug}}
4
+ SAGE_VERSION="{{sageVersion}}"{{/if}}
5
+ GIT_REPOSITORY="{{gitRepository}}" WORDPRESS_SITE_URL="https://{{projectDomain}}"
6
+ WORDPRESS_DB_NAME="wordpress" WORDPRESS_DB_USER="wordpress" WORDPRESS_DB_PASSWORD="wordpress"
7
+ WORDPRESS_DB_HOST="database" WORDPRESS_DB_CHARSET="utf8" WORDPRESS_DB_COLLATE=""
8
+ WORDPRESS_TABLE_PREFIX="wp_" WORDPRESS_DEBUG={{enableDebug}}
21
9
  WORDPRESS_DEBUG_DISPLAY={{enableDebug}}
22
10
  WORDPRESS_DEBUG_LOG={{enableDebug}}
23
11
  WORDPRESS_SCRIPT_DEBUG={{enableDebug}}
24
- WORDPRESS_DISABLE_UPDATE=true
25
- WORDPRESS_DISABLE_CRON=true
26
- WORDPRESS_AUTOSAVE_INTERVAL="600"
27
- WORDPRESS_POST_REVISIONS="2"
28
- WORDPRESS_WP_ENVIRONMENT_TYPE="local"
29
- WORDPRESS_DISALLOW_FILE_MODS=true
30
- WORDPRESS_FORCE_SSL_ADMIN=true
31
- WORDPRESS_AUTOMATIC_UPDATER_DISABLED=true
32
- WORDPRESS_WP_AUTO_UPDATE_CORE=false
33
-
34
- ### Redis ###
12
+ WORDPRESS_DISABLE_UPDATE=true WORDPRESS_DISABLE_CRON=true WORDPRESS_AUTOSAVE_INTERVAL="600"
13
+ WORDPRESS_POST_REVISIONS="2" WORDPRESS_WP_ENVIRONMENT_TYPE="local" WORDPRESS_DISALLOW_FILE_MODS=true
14
+ WORDPRESS_FORCE_SSL_ADMIN=true WORDPRESS_AUTOMATIC_UPDATER_DISABLED=true
15
+ WORDPRESS_WP_AUTO_UPDATE_CORE=false ### Redis ###
35
16
  {{#if enable_redis}}
36
- WORDPRESS_REDIS_HOST=redis
37
- WORDPRESS_REDIS_PORT=6379
17
+ WORDPRESS_REDIS_HOST=redis WORDPRESS_REDIS_PORT=6379
38
18
  {{/if}}
39
19
 
40
- ### WordPress salts ###
41
- WORDPRESS_AUTH_KEY={{{salts.AUTH_KEY}}}
20
+ ### WordPress salts ### WORDPRESS_AUTH_KEY={{{salts.AUTH_KEY}}}
42
21
  WORDPRESS_SECURE_AUTH_KEY={{{salts.SECURE_AUTH_KEY}}}
43
22
  WORDPRESS_LOGGED_IN_KEY={{{salts.LOGGED_IN_KEY}}}
44
23
  WORDPRESS_NONCE_KEY={{{salts.NONCE_KEY}}}
45
24
  WORDPRESS_AUTH_SALT={{{salts.AUTH_SALT}}}
46
25
  WORDPRESS_SECURE_AUTH_SALT={{{salts.SECURE_AUTH_SALT}}}
47
26
  WORDPRESS_LOGGED_IN_SALT={{{salts.LOGGED_IN_SALT}}}
48
- WORDPRESS_NONCE_SALT={{{salts.NONCE_SALT}}}
27
+ WORDPRESS_NONCE_SALT={{{salts.NONCE_SALT}}}
@@ -1,86 +1,13 @@
1
- # WordPress
2
- wp/
3
- content/uploads/*
4
- !content/uploads/.gitkeep
5
- content/upgrade/*
6
- content/backup-db/*
7
- content/backups/*
8
- content/blogs.dir/*
9
- content/cache/*
10
- content/advanced-cache.php
11
- content/wp-cache-config.php
12
- content/plugins/*
13
- !content/plugins/.gitkeep
14
- content/themes/*
15
- content/languages/*
16
- !content/languages/.gitkeep
17
- content/mu-plugins/*
18
- !content/mu-plugins/.gitkeep
19
-
20
- # Theme{{#if enable_sage}}
21
- !content/themes/{{projectName}}{{/if}}
22
-
23
-
24
- # Composer
25
- vendor/
26
- composer.phar
27
- composer.lock
28
- wp-translation-downloader.lock
29
-
30
- # Node.js
31
- node_modules/
32
- npm-debug.log*
33
- yarn-debug.log*
34
- yarn-error.log*
35
- .npm
36
- .yarn-integrity
37
-
38
-
39
- # IDE/Editor
40
- *.swp
41
- *.swo
42
- *~
43
-
44
- # OS
45
- .DS_Store
46
- .DS_Store?
47
- ._*
48
- .Spotlight-V100
49
- .Trashes
50
- ehthumbs.db
51
- Thumbs.db
52
-
53
- # Logs
54
- *.log
55
- logs/
56
-
57
- # Temporary files
58
- *.tmp
59
- *.temp
60
- .cache/
61
-
62
- # Build artifacts
63
- dist/
64
- build/
65
- public/build/
66
-
67
- # Database
68
- *.sql
69
- *.sqlite
70
-
71
- # Backup files
72
- *.bak
73
- *.backup
74
- *.old
75
-
76
- # Lando
77
- .lando.local.yml
78
-
79
- # PHP
80
- *.php~
81
- *.php.bak
82
- php_errors.log
83
-
84
- # Testing
85
- coverage/
86
- .phpunit.result.cache
1
+ # WordPress wp/ content/uploads/* !content/uploads/.gitkeep content/upgrade/* content/backup-db/*
2
+ content/backups/* content/blogs.dir/* content/cache/* content/advanced-cache.php
3
+ content/wp-cache-config.php content/plugins/* !content/plugins/.gitkeep content/themes/*
4
+ content/languages/* !content/languages/.gitkeep content/mu-plugins/* !content/mu-plugins/.gitkeep #
5
+ Theme{{#if enable_sage}}
6
+ !content/themes/{{projectName}}{{/if}}
7
+
8
+ # Composer vendor/ composer.phar composer.lock wp-translation-downloader.lock # Node.js
9
+ node_modules/ npm-debug.log* yarn-debug.log* yarn-error.log* .npm .yarn-integrity # IDE/Editor *.swp
10
+ *.swo *~ # OS .DS_Store .DS_Store? ._* .Spotlight-V100 .Trashes ehthumbs.db Thumbs.db # Logs *.log
11
+ logs/ # Temporary files *.tmp *.temp .cache/ # Build artifacts dist/ build/ public/build/ # Database
12
+ *.sql *.sqlite # Backup files *.bak *.backup *.old # Lando .lando.local.yml # PHP *.php~ *.php.bak
13
+ php_errors.log # Testing coverage/ .phpunit.result.cache
@@ -1,44 +1,11 @@
1
- name: {{projectName}}
2
- recipe: wordpress
3
- config:
4
- webroot: ./
5
- via: nginx
6
- php: "{{phpVersion}}"
7
- xdebug: true
8
- extra_php_extensions:
9
- - bcmath
10
- - exif
11
- - gd
12
- - mysqli
13
- - zip
14
- - imagick
15
- - redis
16
- config:
17
- php: ./server/php/php.ini
18
- vhosts: ./server/www/vhosts.conf
19
- env_file:
20
- - .env
21
- services:
22
- appserver:
23
- build_as_root:
24
- - apt-get update
25
- - apt-get install -y curl gnupg
26
- - curl -fsSL https://deb.nodesource.com/setup_23.x | bash -
27
- - apt-get install -y nodejs
28
- - npm install -g npm@latest
29
- - npm install -g yarn@1.22
30
- build:
31
- - composer install --no-interaction --no-progress --optimize-autoloader
32
- run:
33
- - ./server/cmd/install-wp.sh
34
- tooling:
35
- yarn:
36
- service: appserver
37
- yarn-upgrade:
38
- service: appserver
39
- cmd: yarn upgrade --latest
40
- yarn-clean-install:
41
- service: appserver
42
- cmd:
43
- - rm -rf node_modules
44
- - yarn install
1
+ name:
2
+ {{projectName}}
3
+ recipe: wordpress config: webroot: ./ via: nginx php: "{{phpVersion}}" xdebug: true
4
+ extra_php_extensions: - bcmath - exif - gd - mysqli - zip - imagick - redis config: php:
5
+ ./server/php/php.ini vhosts: ./server/www/vhosts.conf env_file: - .env services: appserver:
6
+ build_as_root: - apt-get update - apt-get install -y curl gnupg - curl -fsSL
7
+ https://deb.nodesource.com/setup_23.x | bash - - apt-get install -y nodejs - npm install -g
8
+ npm@latest - npm install -g yarn@1.22 cache: type: redis:6 events: post-start: - bash
9
+ ./server/cmd/install-wp.sh - composer install --no-interaction --no-progress --optimize-autoloader
10
+ tooling: yarn: service: appserver yarn-upgrade: service: appserver cmd: yarn upgrade --latest
11
+ yarn-clean-install: service: appserver cmd: - rm -rf node_modules - yarn install
@@ -1,12 +1,11 @@
1
- # {{projectName}}
1
+ #
2
+ {{projectName}}
2
3
 
3
- Scaffolded by wp-devops.
4
-
5
- ## 🧱 Stack
6
-
7
- - PHP {{phpVersion}}
8
- - Node.js {{nodeVersion}}
4
+ Scaffolded by wp-devops. ## 🧱 Stack - PHP
5
+ {{phpVersion}}
6
+ - Node.js
7
+ {{nodeVersion}}
9
8
 
10
9
  ## 👤 Author
11
10
 
12
- {{author}}
11
+ {{author}}
@@ -1,60 +1,12 @@
1
- {
2
- "name": "{{projectName}}/wordpress",
3
- "type": "project",
4
- "description": "{{projectDescription}}",
5
- "authors": [
6
- {
7
- "name": "{{author}}",
8
- "email": "{{authorEmail}}"
9
- }
10
- ],
11
- "repositories": {
12
- "wpackagist": {
13
- "type": "composer",
14
- "url": "https://wpackagist.org"
15
- }
16
- },
17
- "license": "MIT",
18
- "require": {
19
- "php": ">={{phpVersion}}",
20
- "roots/wordpress": "{{wpCoreVersion}}",
21
- "inpsyde/wp-translation-downloader": "^2.5",
22
- "vlucas/phpdotenv": "^5.5"
23
- },
24
- "config": {
25
- "allow-plugins": {
26
- "roots/wordpress-core-installer": true,
27
- "inpsyde/wp-translation-downloader": true,
28
- "composer/installers": true
29
- }
30
- },
31
- "extra": {
32
- "wordpress-install-dir": "wp",
33
- "installer-paths": {
34
- "content/plugins/{$name}/": [
35
- "type:wordpress-plugin"
36
- ],
37
- "content/themes/{$name}/": [
38
- "type:wordpress-theme"
39
- ],
40
- "content/mu-plugins/{$name}/": [
41
- "type:wordpress-muplugin"
42
- ]
43
- },
44
- "wp-translation-downloader": {
45
- "languages": [
46
- "pt_BR",
47
- "en_US",
48
- "es_ES"
49
- ],
50
- "languageRootDir": "content/languages",
51
- "virtual-packages": [
52
- {
53
- "name": "wordpress/wordpress",
54
- "type": "wordpress-core",
55
- "version": "{{wpCoreVersion}}"
56
- }
57
- ]
58
- }
59
- }
60
- }
1
+ { "name": "{{projectName}}/wordpress", "type": "project", "description": "{{projectDescription}}",
2
+ "authors": [ { "name": "{{author}}", "email": "{{authorEmail}}" } ], "repositories": { "wpackagist":
3
+ { "type": "composer", "url": "https://wpackagist.org" } }, "license": "MIT", "require": { "php": ">={{phpVersion}}",
4
+ "roots/wordpress": "{{wpCoreVersion}}", "inpsyde/wp-translation-downloader": "^2.5",
5
+ "vlucas/phpdotenv": "^5.5" }, "config": { "allow-plugins": { "roots/wordpress-core-installer": true,
6
+ "inpsyde/wp-translation-downloader": true, "composer/installers": true } }, "extra": {
7
+ "wordpress-install-dir": "wp", "installer-paths": { "content/plugins/{$name}/": [
8
+ "type:wordpress-plugin" ], "content/themes/{$name}/": [ "type:wordpress-theme" ],
9
+ "content/mu-plugins/{$name}/": [ "type:wordpress-muplugin" ] }, "wp-translation-downloader": {
10
+ "languages": [ "pt_BR", "en_US", "es_ES" ], "languageRootDir": "content/languages",
11
+ "virtual-packages": [ { "name": "wordpress/wordpress", "type": "wordpress-core", "version": "{{wpCoreVersion}}"
12
+ } ] } } }
@@ -1,58 +1,43 @@
1
- #!/bin/bash
2
-
3
- # Colors for output
4
- RED='\033[0;31m'
5
- GREEN='\033[0;32m'
6
- YELLOW='\033[1;33m'
7
- BLUE='\033[0;34m'
8
- NC='\033[0m' # No Color
9
-
10
- echo -e "${BLUE}🔍 Checking WordPress installation status...${NC}"
11
-
12
- # Wait for database to be ready
13
- echo -e "${YELLOW}⏳ Waiting for database connection...${NC}"
14
- while ! wp db check --quiet 2>/dev/null; do
15
- echo -e "${YELLOW}⌛ Database not ready yet, waiting...${NC}"
16
- sleep 2
17
- done
18
-
19
- echo -e "${GREEN} Database connection established${NC}"
20
-
21
- # Check if WordPress is already installed
22
- if wp core is-installed 2>/dev/null; then
23
- echo -e "${GREEN} WordPress is already installed${NC}"
24
- echo -e "${BLUE}📊 Current site info:${NC}"
25
- wp option get siteurl
26
- wp option get admin_email
27
- exit 0
28
- fi
29
-
30
- echo -e "${YELLOW}🚀 WordPress not installed. Starting installation...${NC}"
31
-
32
- # Download WordPress core if not present
33
- if [ ! -d wp-admin ]; then
34
- echo -e "${BLUE}📥 Downloading WordPress core...${NC}"
35
- wp core download --force --path=/wp --skip-content
36
- fi
37
-
38
- # Install WordPress
39
- echo -e "${BLUE}🏗️ Installing WordPress...${NC}"
40
- wp core install \
41
- --url="${PROJECT_DOMAIN}" \
42
- --title="${PROJECT_NAME:-WordPress Development}" \
43
- --admin_user="${WORDPRESS_ADMIN_USER:-admin}" \
44
- --admin_password="${WORDPRESS_ADMIN_PASSWORD:-admin}" \
45
- --admin_email="${WORDPRESS_ADMIN_EMAIL:-admin@example.com}" \
46
- --skip-email
47
-
48
- echo -e "${GREEN}✅ WordPress installed successfully!${NC}"
49
-
50
- # Update permalinks
51
- wp rewrite structure '/%postname%/' --hard
52
-
53
- echo -e "${GREEN}🎉 WordPress setup completed successfully!${NC}"
54
- echo -e "${BLUE}📋 Access Details:${NC}"
55
- echo -e "${YELLOW}URL:${NC} ${APP_URL}"
56
- echo -e "${YELLOW}Admin User:${NC} ${WORDPRESS_ADMIN_USER:-admin}"
57
- echo -e "${YELLOW}Admin Password:${NC} ${WORDPRESS_ADMIN_PASSWORD:-admin}"
58
- echo -e "${YELLOW}Admin Email:${NC} ${WORDPRESS_ADMIN_EMAIL:-admin@example.com}"
1
+ #!/bin/bash # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m'
2
+ BLUE='\033[0;34m' NC='\033[0m' # No Color echo -e "${BLUE}🔍 Checking WordPress installation
3
+ status...${NC}" # Wait for database to be ready (connectivity only) echo -e "${YELLOW}⏳ Waiting for
4
+ database connection...${NC}" echo -e "${BLUE}🔧 Debug: DB_HOST=${WORDPRESS_DB_HOST:-database}
5
+ DB_NAME=${WORDPRESS_DB_NAME:-wordpress} DB_USER=${WORDPRESS_DB_USER:-wordpress}${NC}" # Show what
6
+ WP-CLI reads from wp-config.php wp config get DB_HOST --path=/app/wp 2>/dev/null || true wp config
7
+ get DB_NAME --path=/app/wp 2>/dev/null || true wp config get DB_USER --path=/app/wp 2>/dev/null ||
8
+ true # Force-disable SSL/TLS for MySQL client connections in environments where server uses
9
+ self-signed certs export MYSQL_SSL_MODE=DISABLED export MYSQLI_OPT_SSL_VERIFY_SERVER_CERT=0
10
+ MAX_ATTEMPTS=60 ATTEMPT=0 # PHP/mysqli-based readiness check to bypass mysql CLI TLS verification
11
+ issues db_ready() { php -d display_errors=1 -r ' $host = getenv("WORDPRESS_DB_HOST") ?: "database";
12
+ $user = getenv("WORDPRESS_DB_USER") ?: "wordpress"; $pass = getenv("WORDPRESS_DB_PASSWORD") ?:
13
+ "wordpress"; $name = getenv("WORDPRESS_DB_NAME") ?: "wordpress"; $port = getenv("WORDPRESS_DB_PORT")
14
+ ?: 3306; $mysqli = mysqli_init(); if (defined("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT")) {
15
+ mysqli_options($mysqli, MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, false); } $flags =
16
+ defined("MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT") ? MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT :
17
+ 0; if (!@mysqli_real_connect($mysqli, $host, $user, $pass, null, (int)$port, null, $flags)) {
18
+ fwrite(STDERR, "connect_error: ".mysqli_connect_error().PHP_EOL); exit(1); } @mysqli_query($mysqli,
19
+ "CREATE DATABASE IF NOT EXISTS `{$name}`"); $ok = @mysqli_query($mysqli, "SELECT 1"); if (!$ok) {
20
+ fwrite(STDERR, "query_error: ".mysqli_error($mysqli).PHP_EOL); exit(1); } exit(0); ' } until
21
+ db_ready >/dev/null 2>&1; do ATTEMPT=$((ATTEMPT+1)) if [ "$ATTEMPT" -eq 1 ] || [ $((ATTEMPT % 5))
22
+ -eq 0 ]; then echo -e "${BLUE}🔧 Debug: attempting connection (#${ATTEMPT})...${NC}" getent hosts
23
+ "${WORDPRESS_DB_HOST:-database}" 2>/dev/null || true # Also surface last error from PHP checker
24
+ db_ready 2>&1 >/dev/null | tail -n1 || true fi echo -e "${YELLOW} Database not ready yet,
25
+ waiting...${NC}" sleep 2 if [ "$ATTEMPT" -ge "$MAX_ATTEMPTS" ]; then echo -e "${RED}❌ Timeout
26
+ waiting for database connectivity. Aborting.${NC}" exit 1 fi done echo -e "${GREEN}✅ Database
27
+ connection established${NC}" # Check if WordPress is already installed if wp core is-installed
28
+ --path=/app/wp 2>/dev/null; then echo -e "${GREEN}✅ WordPress is already installed${NC}" echo -e
29
+ "${BLUE}📊 Current site info:${NC}" wp option get siteurl --path=/app/wp wp option get admin_email
30
+ --path=/app/wp exit 0 fi echo -e "${YELLOW}🚀 WordPress not installed. Starting
31
+ installation...${NC}" # Download WordPress core if not present if [ ! -d wp-admin ]; then echo -e
32
+ "${BLUE}📥 Downloading WordPress core...${NC}" wp core download --force --path=/app/wp
33
+ --skip-content fi # Install WordPress echo -e "${BLUE}🏗️ Installing WordPress...${NC}" wp core
34
+ install \ --url="${PROJECT_DOMAIN}" \ --title="${PROJECT_NAME:-WordPress Development}" \
35
+ --admin_user="${WORDPRESS_ADMIN_USER:-admin}" \
36
+ --admin_password="${WORDPRESS_ADMIN_PASSWORD:-admin}" \
37
+ --admin_email="${WORDPRESS_ADMIN_EMAIL:-admin@example.com}" \ --skip-email \ --path=/app/wp echo -e
38
+ "${GREEN}✅ WordPress installed successfully!${NC}" # Update permalinks wp rewrite structure
39
+ '/%postname%/' --hard --path=/app/wp echo -e "${GREEN}🎉 WordPress setup completed
40
+ successfully!${NC}" echo -e "${BLUE}📋 Access Details:${NC}" echo -e "${YELLOW}URL:${NC} ${APP_URL}"
41
+ echo -e "${YELLOW}Admin User:${NC} ${WORDPRESS_ADMIN_USER:-admin}" echo -e "${YELLOW}Admin
42
+ Password:${NC} ${WORDPRESS_ADMIN_PASSWORD:-admin}" echo -e "${YELLOW}Admin Email:${NC}
43
+ ${WORDPRESS_ADMIN_EMAIL:-admin@example.com}"
@@ -1,71 +1,21 @@
1
- upstream php {
2
- server fpm:9000;
3
- }
4
-
5
- server {
6
-
7
- listen 80 default_server;
8
- listen 443 ssl;
9
-
10
- server_name localhost;
11
-
12
- ssl_certificate /certs/cert.crt;
13
- ssl_certificate_key /certs/cert.key;
14
- ssl_verify_client off;
15
-
16
- ssl_session_cache shared:SSL:1m;
17
- ssl_session_timeout 5m;
18
-
19
- ssl_ciphers HIGH:!aNULL:!MD5;
20
- ssl_prefer_server_ciphers on;
21
-
22
- port_in_redirect off;
23
- client_max_body_size 100M;
24
-
25
- ## Your only path reference.
26
- root "/app";
27
-
28
- ## This should be in your http block and if it is, it's not needed here.
29
- index index.php;
30
-
31
- location = /favicon.ico {
32
- log_not_found off;
33
- access_log off;
34
- }
35
-
36
- location = /robots.txt {
37
- allow all;
38
- log_not_found off;
39
- access_log off;
40
- }
41
-
42
- # Add Server-Timing header to track request time and database response time
43
- add_header Server-Timing 'php=$request_time; db=$upstream_response_time';
44
-
45
- {{#if useRocket}}
46
- # Include Rocket Nginx configuration
47
- include /app/server/www/rocket.conf;
48
- {{/if}}
49
-
50
- location / {
51
- # This is cool because no php is touched for static content.
52
- # include the "?$args" part so non-default permalinks doesn't break when using query string
53
- try_files $uri $uri/ /index.php?$args;
54
- }
55
-
56
- location ~ \.php$ {
57
- #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
58
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
59
- fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
60
- include fastcgi_params;
61
- fastcgi_intercept_errors on;
62
- fastcgi_pass php;
63
- fastcgi_buffers 16 16k;
64
- fastcgi_buffer_size 32k;
65
- }
66
-
67
- location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
68
- expires max;
69
- log_not_found off;
70
- }
71
- }
1
+ upstream php { server fpm:9000; } server { listen 80 default_server; listen 443 ssl; server_name
2
+ localhost; ssl_certificate /certs/cert.crt; ssl_certificate_key /certs/cert.key; ssl_verify_client
3
+ off; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5;
4
+ ssl_prefer_server_ciphers on; port_in_redirect off; client_max_body_size 100M; ## Your only path
5
+ reference. root "/app"; ## This should be in your http block and if it is, it's not needed here.
6
+ index index.php; location = /favicon.ico { log_not_found off; access_log off; } location =
7
+ /robots.txt { allow all; log_not_found off; access_log off; } # Add Server-Timing header to track
8
+ request time and database response time add_header Server-Timing 'php=$request_time;
9
+ db=$upstream_response_time';
10
+
11
+ {{#if useRocket}}
12
+ # Include Rocket Nginx configuration include /app/server/www/rocket.conf;
13
+ {{/if}}
14
+
15
+ location / { # This is cool because no php is touched for static content. # include the "?$args"
16
+ part so non-default permalinks doesn't break when using query string try_files $uri $uri/
17
+ /index.php?$args; } location ~ \.php$ { #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
18
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_TRANSLATED
19
+ $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_intercept_errors on;
20
+ fastcgi_pass php; fastcgi_buffers 16 16k; fastcgi_buffer_size 32k; } location ~*
21
+ \.(js|css|png|jpg|jpeg|gif|ico)$ { expires max; log_not_found off; } }