This project was build, to test and demonstrate the use of Webpack Encore with TYPO3-CMS.
- Docker installed and running
- DDEV installed
- Node.js installed
- Make a new project directory and change into it
mkdir myProject
cd myProject
- Clone this repository
git clone --single-branch --branch main [email protected]:Starraider/devNewProject.git .
git submodule update --init --recursive
- Disconnect your project from original github and git
git remote rm origin
rm -rf .git
rm .gitmodules
- Initialize your own git repository
git init
- Push your git repository to Github
Usually VS Code asks you to generate a new Github repository when you make your first git commit.
- Change project name from devNewProject to your own project name
Replace "devNewProject" with your own project name in these files:
- .ddev/config.yaml
- composer.json
- public/typo3conf/LocalConfiguration.php
- Build/package.json
- Change repository URL
Replace the repository URL "https://github.com/Starraider/devNewProject.git" with your own repository URL in these files:
- composer.json
- Build/package.json
- Install node dependencies
cd Build
yarn install
- Start DDEV and install dependencies
ddev start
ddev composer install
- Change settings in .env
Open file .env
in your editor.
Change SITE_BASE=
to the generated URL, which is shown after ddev start
.
Change TYPO3__DB__Connections__Default__host=
to the generated db container name, which is shown during ddev start
.
Restart ddev restart
.
- Restore database and files
ddev db-restore
ddev fileadmin-restore
- Generate webpack files
cd Build/
yarn encore dev
If you get an error message, maybe you have to change your node.js version with nvm use system
.
- Launch local website
ddev restart
ddev launch typo3
- Login
Username: Passwort:
- If you see the error message "zuncompress(): need dictionary ..."
This is currently a bug in DDEV.
Open file public/typo3conf/AdditionalConfiguration.php
in your editor.
Remove the comment "#ddev-generated" on the top of the file (otherwise it will be overwriten on every start).
Change 'driver' => 'pdo_mysql',
into 'driver' => 'mysqli',
.
Restore DB again with ddev db-restore
.
Restart with ddev restart
.
Now the error message should be gone.
- Change local development URL
Replace the development URL "https://devnewproject.ddev.site" with the generated URL, which is shown after ddev start
, in these files:
- Build/js/app.js
- Build/cypress.json
- Change deployment credentials
Change all credentials in deploy.php to your own deployment data.
- Setup GitHub Action for automated deployment
a. Generate ssh keys for cloning of your private repository to your server
Generate ssh keys on your server with:
ssh-keygen -t rsa -b 4096
Leave password empty! Use the public key on GitHub for "Settings -> Deployment Keys -> Add deploy key" (name doesn't matter). Make a test connection to GitHub to update the known_hosts file, with:
ssh -T [email protected]
b. Generate ssh keys for the deployment from GitHub to your server
Generate ssh keys on your local machine:
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_github -C "[email protected]"
Leave password empty and use the email address, which you used for your GitHub account. If you alreade have a local ssh keys without password, you can use this instead.
Upload the public key to your server with:
ssh-copy-id -f -i ~/.ssh/id_github [email protected]
Make a test connection to your server to update the known_hosts file, with:
ssh -i ~/.ssh/id_github [email protected]
Open the private key and use it on GitHub for generating "Settings -> Secrets -> Actions -> New repository secret" with Name "PRIVATE_KEY".
Get your entry from known_hosts on your local machine, with:
ssh-keyscan pxxxxxx.mittwaldserver.info
Copy the line which looks like "pxxxxxx.mittwaldserver.info ssh-rsa AAA..." and use it on GitHub for generating "Settings -> Secrets -> Actions -> New repository secret" with Name "KNOWN_HOSTS". (Without it ssh would ask if you want to add your server to the known_hosts).
ddev start
ddev composer update
ddev stop
ddev describe
ddev launch
or go to https://devnewproject.ddev.site
Be aware: Webpack Encore needs Node.js Version 16.8! You can switch Node.js Version with:
nvm use system
yarn encore dev
yarn encore dev --watch
yarn encore production
ddev export-db --file=/Quellen/backup/db.sql.gz
ddev db-backup
ddev db-restore
ddev fileadmin-backup
ddev fileadmin-restore
//ddev export-db >./Quellen/backup/2021-11-27_db.sql.gz
Attention: The typo3-console runs only inside the container!
ddev typo3cms cache:flush
ddev typo3cms database:updateschema
ddev typo3 --help
ddev typo3 list (lists all commands)
ddev typo3 language:update
You can change the TYPO3_CONTEXT in the file .ddev/config.yaml
To see error messages in the frontend put in Setup:
- TYPO3_CONTEXT=Development
Run all static linters at once:
ddev composer ci:static
Prettier will auto format all JavaScript files.
Right click on file and chose "Dokument formatieren" oder "php-cs-fixer: diff" oder "php-cs-fixer: fix"
Right click on file or folder and chose "PHPStan: Scan for Errors"
ddev composer ci:ts:lint
ddev composer ci:composer:normalize
You must have installed Cypress.
Inside the Build
folder run:
yarn run cypress open
GPL-2.0 or later