Create a project

This explains how to setup a new project with Gentics Portal | essentials.

Create a new project

There are two different project types that can be used. Both of them are usable at the same time, but a project can only have one mode.

Folder mode In this mode projects are accessible from subfolders. For example: http://my-projects.com/project1/ and http://my-projects.com/project2/

The domain used here does not take into account the terms of configuration (so any domain can point to a project in folder mode, which does not point to any project in domain mode).

In that case, the top level folder is served from the __default__ project folder.

Domain mode In this mode projects are accessible from domains. Eg.: http://my-project1.com/ and http://my-project2.com/

All files are served from the project’s public folder. To activate the domain mode the included vhost.conf.example must be renamed to vhost.conf

On VirtualHost file changes, the portal needs to be restarted with docker-compose restart portal

Folder mode

  1. Copy the demo project as a new folder in the projects/ folder, e.g.: as newproject

    Screenshot

    Copy project

  2. Adapt the config/portal.php inside this project see: Configuration

    Screenshots

    Adapt the config/portal.php

    Adapt the config/portal.php

  3. Create a new node in the CMS (easiest way is to copy the Demo Project)

    Screenshots

    Copy the node

    Copy settings

  4. Change publish path and preview url.

    Screenshot

    Node settings title="Node settings"

    Info: name should be the same as in portal.php 'projectName' (spaces are converted to _ automatically)

  5. Change your views / graphql files

  6. Enable publishing by unchecking Aktualisierung deaktivieren

    Screenshot

    Node settings

  7. Publish the new node

    Screenshots

    Republish

    Right click > "Frame neu laden" > to see progress of publishing

    Republish

  8. Brief check if project is online and working

    • Modify homepage and look at it in the Live URL Preview – if you are redirected to the login page, you need to change permissions

      • In the CMS rightclick on the node and select object properties

      • In field roles you can set which user group can see the folder’s contents (anonymous: guests, reference_role: logged in users)

        Screenshots

        Object Properties

        Mesh Roles

      • Alternatively you can set permissions temporarily in the Mesh UI:

        • Open: http://localhost:8081/

        • Login as user: admin, password: admin

        • Change to admin view (right top corner)

          Screenshot

          Mesh Project

        • Go to permissions and check the Nodes of the roles reference_role (logged in users) and anonymous (guests):

          Screenshot

          Mesh Permissions

        • reference_role (the view for logged in users)

          Screenshot

          Mesh reference_role

        • anonymous (the view for guests)

          Screenshot

          Mesh anonymous title="Mesh anonymous"

Domain mode

  1. Copy the demo project as a new folder in the projects/ folder, e.g.: as newproject

  2. Adapt the config/portal.php inside this project see: Configuration

    Screenshots

    Adapt the config/portal.php

    Adapt the config/portal.php

  3. Create a new node in the CMS (easiest way is to copy the Demo Project)

  4. Change publish path to / and remove project name from preview url and add domain name and remove "demo" prefix from Mesh preview url and replace portal with your domain (e.g.: demo.localhost.gentics.com)

    Screenshot

    Node settings for domains title="Node settings for domains"

    Info: name should be the same as in portal.php 'projectName' (spaces are converted to _ automatically)

  5. Change your views / graphql files

  6. Enable publishing by unchecking Aktualisierung deaktivieren

    Screenshot

    Node settings for domains

  7. Publish the new node

  8. Copy vhost.conf.example to vhost.conf and adapt if needed (project name must be the same name as the folder of the project, ServerName must be your domain)

  9. Add your alias for the domain to the docker-compose.override.yaml file (demo.localhost.gentics.com)

  10. Restart portal: docker-compose up -d
    Info: If you are trying our demo.localhost.gentics.com example, you need to docker-compose restart portal

  11. Brief check if project is online and working

    • Modify homepage and look at it in the Live URL Preview – if you are redirected to the login page, you need to change permissions

      • In the CMS rightclick on the node and select object properties

      • In field roles you can set which user group can see the folder’s contents (anonymous: guests, reference_role: logged in users)

        Screenshots

        Object Properties

        Mesh Roles

      • Alternatively you can set permissions temporarily in the Mesh UI (description above in the folder mode example)

Troubleshooting

If you run into issues, please check the Troubleshooting page.

Access CMS, Mesh and portal

.htaccess

POST requests from the Gentics CMS to the CmsController do not work by default because the stock Laravel .htaccess redirects all requests that have a trailing slash in order to remove it. However due do the RFC standard which disallows POST redirects without user interaction, this means that the POST data is lost.

We can fix this easily, in portal/public/.htaccess find this line (line 12):

# Redirect Trailing Slashes If Not A Folder...

Add this after:

RewriteCond %{REQUEST_METHOD} =GET

Custom Apache configurations for folder mode

Create a file named as folders.*.conf - where * can be any string - in the projects/ folder, and the configuration will be loaded for all folder mode projects, so seperating between the projects need to be done in this configuration.

You can use however the environment variables to detect the current project, with mod_setenvif.

Available environment variables:

  • GPPHP_BLADE_MODE - It can be domain or folder

  • GPPHP_BLADE_PROJECT - The name of the project coming from the folder name

  • GPPHP_REQUEST_URI - The url relative to the project folder

Authentication example

  • Create a .htpasswd file in the projects/ folder and add user credentials to it. Tip: You can use online tools to create your .htpasswd file.

  • Create a folders.auth.conf in the projects/ folder and add the following content:

<Location />
	# Require authentication in demo project for /example sub-path
	SetEnvIfExpr "env('GPPHP_BLADE_PROJECT') == 'demo' && tolower(env('GPPHP_REQUEST_URI')) =~ m#^/example(/|$)#" require_auth=true

	AuthUserFile /portal/projects/.htpasswd
	AuthName "Authorized Users Only."
	AuthType Basic

	Order Deny,Allow
	Deny from all
	Satisfy any
	Require valid-user
	Allow from env=!require_auth
</Location>

Using this, in the demo project, the /example sub-path will require authentication, and accepts credentials from the .htpasswd file. If you want to protect your whole campaign remove && tolower(env('GPPHP_REQUEST_URI') from the example above. In this case, you have to additionally change your node properties in the CMS: add user:password@ after https:// to your Mesh Preview URL. Example: https://user:password@site.wko.at/campaign/api/preview/

if you have multiple projects in folder mode and you would like to protect some of them, add the following content to your folders.auth.conf in the projects/ folder

<Location ~ "(project1|project2)">
	# Require authentication in project
	SetEnvIfExpr "env('GPPHP_BLADE_PROJECT') == 'project1'" require_auth=true
	SetEnvIfExpr "env('GPPHP_BLADE_PROJECT') == 'project2'" require_auth=true

	# use common username/password
	AuthUserFile /portal/projects/.htpasswd
	AuthName "Authorized Users Only."
	AuthType Basic

	Order Deny,Allow
	Deny from all
	Satisfy any
	Require valid-user
	Allow from env=!require_auth
</Location>

Custom Apache configurations for domain mode

Create a file named as project.*.conf - where * can be any string - in the projects' folder, eg.: projects/myproject folder, and the configuration will be loaded for that domain mode project.

Authentication example

  • Create a .htpasswd file in the projects/ folder and add user credentials to it.

  • Create a project.auth.conf in the projects/myproject folder and add the following content:

# Require authentication for /example sub-path
<Location "/example">
	AuthName "Authorized Users Only."
	AuthType Basic
	AuthUserFile /portal/projects/.htpasswd
	Require valid-user
</Location>

Using this, in a domain mode project, the /example sub-path will require authentication, and accepts credentials from the .htpasswd file. If you want to protect your whole campaign remove the subfolder name in the Location tag in the example above, like so: <Location "/"> In this case, you have to additionally change your node properties in the CMS: add user:password@ after https:// to your Mesh Preview URL. Example: https://user:password@yourdomain.com/api/preview/

An important note: If you have no freely accessible campaigns to check, add a dummy project for the kubernetes healthpoint check.

Docker service configuration

Copy the file docker-compose.override.yml.example to docker-compose.override.yml You can configure passwords, ports, environment variables and other settings in docker-compose.override.yml The license key for the cms has to be changed.

Running the application