Sulu CMS

Sulu CMS is a content management platform based on Symfony made for businesses. It’s a flexible CMS to create and manage enterprise multi-sites and a reliable development environment for high-performance apps. With powerful features for developers and a simple UI for editors it’s the ideal engine for state-of-the-art business websites and web-based software.


Note

For this guide you should be familiar with the basic concepts of

License

Sulu CMS is released under the MIT License. All relevant information can be found in the LICENSE file in the repository of the project.

Prerequisites

We’re using PHP in the stable version 7.4:

[isabell@stardust ~]$ uberspace tools version show php
Using 'PHP' version: '7.4'
[isabell@stardust ~]$

You’ll need your MySQL credentials. Get them with my_print_defaults:

[isabell@stardust ~]$ my_print_defaults client
--default-character-set=utf8mb4
--user=isabell
--password=MySuperSecretPassword
[isabell@stardust ~]$

Your domain needs to be set up:

[isabell@stardust ~]$ uberspace web domain list
isabell.uber.space
[isabell@stardust ~]$

Installation

Since Sulu CMS uses the subdirectory public/ as document root of your website you should not install Sulu in your default Uberspace DocumentRoot. Instead, we install it next to that and then use a symlink to make it accessible to the web.

cd to one level above your DocumentRoot, then use the PHP Dependency Manager Composer to create a new project based on the Sulu Skeleton.

Note

Replace sulucms in the examples with your desired name for the directory/database.

[isabell@stardust ~]$ cd /var/www/virtual/$USER/
[isabell@stardust isabell]$ composer create-project sulu/skeleton sulucms
Creating a "sulu/skeleton" project at "./sulucms"
Installing sulu/skeleton (2.0.7)
  - Installing sulu/skeleton (2.0.7): Loading from cache
Created project in /var/www/virtual/ckrack/sulucms
[…]
[isabell@stardust isabell]$

Remove your empty DocumentRoot and create a new symbolic link to the sulucms/public directory.

Warning

Make sure html is empty before deleting it. If there are any files you want to keep in html, you can also rename the folder instead of deleting it.

[isabell@stardust isabell]$ rmdir html
[isabell@stardust isabell]$ ln -s /var/www/virtual/$USER/sulucms/public html
[isabell@stardust isabell]$ cd ~
[isabell@stardust ~]$

Configuration

During the setup process you need to configure an .env.local file with database credentials. We suggest you use an additional database for Sulu CMS to save your data. You have to create this database first using the following command.

[isabell@stardust ~]$ mysql -e "CREATE DATABASE ${USER}_sulucms"
[isabell@stardust ~]$

Note

As uberspace uses MariaDb, you need to find the version and prefix the serverVersion with mariadb.

[isabell@stardust ~]$ mysql -e "SELECT VERSION()"
 +-----------------+
 | VERSION()       |
 +-----------------+
 | 10.3.22-MariaDB |
 +-----------------+
[isabell@stardust ~]$

Review the sample configuration file .../sulucms/.env. Then edit the .env.local file and change the values of APP_ENV and DATABASE_URL, to reflect your MySQL credentials and save the file.

APP_ENV=prod
DATABASE_URL=mysql://isabell:MySuperSecretPassword@localhost/isabell_sulucms?serverVersion=mariadb-10.3.22

Note

You can optionally configure Sulu to send emails in the same place.

When you’re done with the configuration, populate the database with Sulu’s default data by following the build walkthrough.

[isabell@stardust ~]$ cd /var/www/virtual/$USER/sulucms
[isabell@stardust sulucms]$ ./bin/adminconsole sulu:build prod
Build Targets
=============

+---+--------------------+-----------------------------------------------------------------+
| # | Builder            | Deps                                                            |
+---+--------------------+-----------------------------------------------------------------+
| 0 | database           |                                                                 |
| 1 | phpcr              | database                                                        |
| 2 | fixtures           | database, phpcr                                                 |
| 3 | phpcr_migrations   | phpcr                                                           |
| 4 | system_collections | database, fixtures                                              |
| 5 | prod               | database, phpcr, fixtures, phpcr_migrations, system_collections |
+---+--------------------+-----------------------------------------------------------------+

Options:

  - nodeps: false
  - destroy: false
  - help: false
  - quiet: false
  - verbose: false
  - version: false
  - ansi: false
  - no-ansi: false
  - no-interaction: false
  - env: 'prod'
  - no-debug: false

Look good? (y)y
[…]
[isabell@stardust ~]$

Sulu will create the database schema and populate it with sample data for the skeleton.

Finishing installation

Before we can login, we must create a security role and a first user.

[isabell@stardust ~]$ cd /var/www/virtual/$USER/sulucms
[isabell@stardust sulucms]$ ./bin/adminconsole sulu:security:role:create
Please choose a rolename: admin
Please choose a system:
[0] Sulu
> 0
Created role "admin" in system "Sulu".
[isabell@stardust sulucms]$ ./bin/adminconsole sulu:security:user:create
Please choose a username: isabell
Please choose a FirstName: Isabell
Please choose a LastName: Stardust
Please choose a Email: isabell@stardust.uberspace.de
Please choose a locale
  [0] de
  [1] en
 > 1
Please choose a role:
  [0] admin
 > 0
Please choose a Password:
Created user "isabell" in role "admin"
[isabell@stardust sulucms]$

To finish the installation you need to point your browser to the sulu administration on your domain (e.g. https://isabell.uber.space/admin/) and login.

Best practices

To develop your website, you need to setup a webspace and templates for the pages - Sulu CMS comes as a bare system without any theming. Find out more about the concepts in the Sulu documentation.

You probably want to develop your templates locally on your machine. It’s recommended to initialize a git repository, add a remote and clone from the remote to your machine.

Updates

Note

Check the Releases on Github regularly to stay informed about the newest version.

Warning

Follow the upgrade guidelines before updating the code via composer..

To update Sulu CMS you can run the following command in the root directory of the application.

[isabell@stardust ~]$ cd /var/www/virtual/$USER/sulucms
[isabell@stardust sulucms]$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
[…]
[isabell@stardust ~]$

Tested with Sulu CMS v2.0.7, Uberspace 7.6.1.2

Written by: Clemens Krack <info@clemenskrack.com>