See roots/bedrock readme for notes about the stack.
- PHP 8.0 - Installation
- Composer - Installation
- DDEV - Installation
- Prettier - Installation
- EditorConfig - Installation
You will need an authentication token, we have a shared one added to LastPass/1Password.
npm config set "//npm.fontawesome.com/:_authToken" <API-KEY>
- EditorConfig for VS Code
- Prettier - Code formatter
- PHP Intelephense
- PHP Debug
- laravel-blade
- Laravel Pint
If you are on Windows you should read the latest DDEV documentation and recommendations for getting things running. You'll need to run all composer, npm, robo and dep commands from within the DDEV container. Remember to send your SSH keys to container using ddev auth ssh
# Clone the repository and install the development dependencies.
git clone --recursive [email protected]:generoi/bedrock.git gdsbedrock
cd gdsbedrock
# Install composer dependencies and development tools (vendor folder)
composer install:development
# The repo uses `npm` workspaces so you you should run commands from root of
# project.
npm run install
npm run build:production
# Start the container
ddev start
# Fetch the remote database
./vendor/bin/robo db:pull @production
# Login as admin
ddev wp login create <user>
wp @production login create <user>
Additional useful tasks
# Fetch the remote files (we also use a nginx fallback redirect for missing
# files)
./vendor/bin/robo files:pull @production
# Importing database from a sql dump
ddev import-db < dump.sql
# Create a database dump and import it
./vendor/bin/robo db:export @ddev
./vendor/bin/robo db:import @ddev
# Run tests which also prompts attempt to fix lint errors automatically.
./vendor/bin/robo test
# To see all tasks available
./vendor/bin/robo
./vendor/bin/dep
./vendor/bin/wp
# The root `package.json` delegates all scripts with a `--workspaces` flag
# so no flags is the same as
npm run build:production -ws
npm run build:production -w gds
# To install/remove a package you need to explicitly add the flag
npm install postcss-preset-env --save-dev -ws
Go to GitHub Actions deploy_production.yml workflow and trigger a deploy.
You can also trigger the workflows from the command line.
./vendor/bin/robo deploy:production
./vendor/bin/robo deploy:staging --branch=patch-1
./vendor/bin/robo deploy:staging --log_level='-vvv'
# You can still use `dep` directly like described in the section below
./vendor/bin/dep cache:clear production
See deployer-genero and run ./vendor/bin/dep
to see all available commands.
# Deploy to staging/production
./vendor/bin/dep deploy staging
./vendor/bin/dep deploy production
# Clear all caches on production
./vendor/bin/dep cache:clear production
# Clear only WP Super Cache cache
./vendor/bin/dep cache:clear:wpsc production
# Open a shell on production server
./vendor/bin/dep ssh production
# Rollback a failed deploy
./vendor/bin/dep rollback production
Tests require a database so they need to run either in ddev
, using wp serve
or with a local database available.
ddev composer phpunit
# Install dependencies
npm run e2e:install
# Run against ddev environment
npm run e2e:test
# Run it against production
URL=https://gdsbedrock.kinsta.cloudd npm run e2e:test
NOTE: If possible set the project name and repo name to use the domain name of the website. Example: www.my-site.fi
=> my-site
. This will help with configuring all the different environments in the future.
-
Create a new project in a new folder for your project
# Prompt, create and enter directory echo 'Project directory:'; read project; composer create-project --keep-vcs --repository-url="https://packagist.minasithil.genero.fi" generoi/bedrock:dev-master $project; cd $project; # Just create composer create-project --keep-vcs --repository-url="https://packagist.minasithil.genero.fi" generoi/bedrock:dev-master <project-dir> # If you cloned the repo rather than used `create-project` you'll need to: # 1. You need to first install robo. composer install:development # 2. replace the placeholder names with a project machine name. ./vendor/bin/robo search:replace
-
Setup the DDEV container
ddev start
-
Setup the staging/production environment
# Configure the environment vim wp-cli.yml vim robo.yml # Prep the remote environment ./vendor/bin/dep setup staging # Make a first deployment (this will fail due to there not being any database) ./vendor/bin/dep setup staging # Deploy your code, files and database ./vendor/bin/robo db:push @staging ./vendor/bin/robo files:push @staging # Deploy once more with database available ./vendor/bin/dep deploy staging
-
Setup the GitHub actions, E2E tests etc.