Creating a test environment

We recommend setting up a test environment after the initial setup is live. Especially when updating between main versions, this is a good way of trying out the features of the new version. Please refer to the Release Notes section for information about new features or versions.

A test environment is included in the Portrait license.

Preparation

  • Before setting up an additional environment, please make sure you have enough system resources in the target system, as specified in Requirements. This might include increasing your VM’s memory allocation.

  • Stop the source container by going to the environment’s project directory and running docker-compose down. Check if all containers are down: docker-compose ps .

Setting up a test server

To create a test environment, you have to copy the folder in which your production environment is located. The easiest way would be to copy it to a new server. A Portrait app is usually installed in /opt/$BASE-URL.

After copying, please run the script changeBaseUrl.sh which guides you through stopping, renaming the variables and restarting the container.

Alternatively, you have to manually update the following variables:

app/config/frontend/.env

NEXT_PUBLIC_PUBLIC_URL and NEXT_PUBLIC_API_URL

app/config/application-prod.yml

application:url:

/.env

COMPOSE_PROJECT_NAME

If your test environment should just be accessible in your network, you can also set these to localhost and access the environment over the IP and proxy port on which the instance is running on.

Setting up a test environment on the production server

An alternative would be to copy the folder and keeping it on the server. Using this way, you have to change the port on which Portrait is running on. This can be done in the .env file (accompanying docker-compose.yml).

You can set the public port in the configuration for the proxy container under PROXY_PORT. Please ensure this port number is not in conflict with another service, ideally choose a port from the ephemeral port range (49152-65535), and set up your firewall accordingly. In the following example, port 50001 would be the active port Portrait is running on:

BACKEND_TAG=stable-6.3.0 FRONTEND_TAG=stable-6.3.0 PYTHON_RUNTIME_TAG=stable-6.3.0 BACKEND_JAVA_OPTS=-XX:MaxRAMPercentage=50 CODE_SERVER_PW=XXXXXX PROXY_PORT=50001

Detailed Logging

There are two options to get more detailed logging behaviour.

Setting the env property to dev

This can be directly changed in the app

app/config/application-prod.yml

env: dev

see General settings

Custom Logback Config

Use a custom logback.xml with and set the at.treskon logger to INFO/DEBUG/TRACE

<logger name="at.treskon" level="DEBUG" additivity="false"> <appender-ref ref="FILE-ROLLING"/> <appender-ref ref="CONSOLE"/> </logger>

Details see Logging

 

Restarting the environment

After all updates run docker-compose up -d to restart your app!

Reduce the reindex intervals in test environments to lower the load created by the instance.