This Sulu CMS skeleton is the perfect way to decrease your initial setup time drastically! It integrates the Docker setup of dunglas/symfony-docker together with Sulu 2.6 & Symfony 7.2
- Docker >= v20
- NVM.sh (If you don't have it, just run
make install-nvm
in your project root) - Gas Mask
- PHP 8.3
- MySQL 8
- Symfony 7.2
- Sulu 2.6
- Node 22
- Webpack Encore
- Typescript
- Bootstrap 5
- Bazinga Translator
- LuxonJS
- Axios
- Vanilla Cookieconsent
- Ansible Deploy Playbook Template
- In your project root, open the
.env
file and set all parameters to your liking. - If you change the database name or password, you'll have to change that in
application/.env
as well. See parameterDATABASE_URL
. - Go to
application/config/webspaces/default.xml
and make a few changes:- Rename the file to customize the webspace name. (e.g. mycompany.xml)
- Open the file and change
<name>
to some label and set<key>
to the same value as the file name. (Marked with TODO) - Scroll down and look for "portals". You'll see one domain for each environment. Set the local domain to the same as you set in your .env file before.
- Run
make setup
to initialize the database, build the backend and the frontend. - Open your browser and go to e.g. https://www.somedomain.local/admin & login with admin / admin
For more info on the docker setup, see the documentation of dunglas/symfony-docker
This skeleton already contains an Ansible Playbook for deployment. You'll have to customize a few things to use it:
- Under
ansible/hosts
, set your server name, ssh user and key path. - In
ansible/deploy-prod.yml
make the following changes (marked with TODO):- Set the base_dir and sulu_storage according to your server setup (sulu_storage should match the path in your .env.prod).
- Set your user:group & your httpd / Apache / Nginx etc. user in the permissions section
- All the way at the bottom, you see the opcache reset tool. It is recommended to use it on deploy, as the Opcache can be quite stubborn to clear. If you'd like to use it, get it from here: https://github.com/gordalina/cachetool
If your project is set up, and you'd like to continue your work, simply run make up
to start the containers.
This project template comes with a package which helps you to configure CSP headers with ease. See config/packages/opctim_csp_bundle.yaml
For more documentation on this, see docs from opctim/symfony-csp-bundle
The Makefile
comes with all kinds of useful commands. Run make
in the project root to see this help:
help - Show help for this make file
up - Builds and starts the containers
down - Stops & removes the containers
logs - Shows logs continuously
restart - Downs & starts the containers
bash - Opens a shell inside the php container
setup - Initial project setup
init - Initializes the database and builds the frontend
init-db - Initializes the database and adds an admin user (User: admin Password: admin)
init-frontend - Builds the frontend for development use.
composer-install - Performs a composer install inside the php container
install-nvm - Installs NVM.sh
deploy - Invokes the ansible playbook to deploy your application to a remote host
The frontend lives in application/assets/website
. Folder explanations:
fonts
Font files (woff / ttf / etc.)images
SVGs / static images to be included by SCSS / Inline SVGmodules
If your Sulu module needs JS, it should go here. Styles that only concern this specific module belong here too.scss
Styles go here.bootstrap
Configuration & Customizationfonts
Font-Face style definitions for the font files mentioned abovemixins
SCSS mixinspartials
Repetitive SCSS goes here to be included elsewhereapp.scss
Entry point. You should not put styles here.variables.scss
Contains SCSS variables to be globally available in all SCSS filesinject.scss
As the name implies, this file is injected into every SCSS file while building to make SCSS variables and mixins publicly available. WARNING Do not put anything in here that produces CSS output (anything but mixins & variables). This will increase your frontend size significantly!
utils
Contains helper scripts / libraries / methods, e.g. translate(), which can be used to retrieve translations from the backendapp.ts
The entrypoint, you'll need to include your scripts / modules here to be loaded.
nvm install
This can be used as well asnvm use
. The difference: It installs the version if missing.npm install
npm run watch
ornpm run dev
(single-time dev build) ornpm run build
(prod build)
The frontend comes with a svg-inline plugin. Use it to include SVGs into your stylesheets, as data urls:
@include svg-load(my-icon-black, 'website/images/icon-black.svg');
@include svg-load(my-icon-white, 'website/images/icon-black.svg') {
path {
fill: $color-white /* You can change colors on the fly! */
}
};
.icon-black {
background-image: svg-inline(my-icon-black);
}
.icon-white {
background-image: svg-inline(my-icon-white);
}