4 - Prepare Docker host
The docker-compose.yml expects some special files to exist (mainly with certificates) and several environment variables to be set. They are usually passed via an .env file, which is – for your convenience – created by a special script prepare-env.sh.
Important note for Windows OS: this script is a unix shell script and it must be run via WSL!
If you don't have it yet, please install following the Microsoft documentation
Open the command line, cd into
/deployment/standaloneand typewsl.
This script is run as ./prepare-env.sh or bash prepare-env.sh and takes several arguments.
Mandatory arguments
All arguments and the whole configuration is validated; please pay attention to any error messages and fix all problems.
The most important and required options are:
-s,-iand-kcorrespond to the three necessary variables required by the HeadlessCMS container for the censhare server connection and authorization:-sis the server URL that you – or your admin – used for registering the HCMS instance and preparing censhare server-iis the satellite id that was generated as part of the HCMS instance registration (see aforementioned instructions)-kis the satellite key (see aforementioned instructions)
-omust be the correct output channel used by the configured HCMS instance (see aforementioned instructions)Warning: using incorrect values will lead to strange errors, because newly created assets (including the system ones) will be automatically hidden by the server.
The domain (=the URL) comes at the very end without any argument. The domain must conform to all rules of the DNS domain names and it should be recognized so by a browser, but that's the only requirement. In particular, it is not necessary that the domain exists in any DNS server (and it might be better to actually use one that isn't, to avoid confusion). It is recommended that it actually uses a valid top-level domain; at the same time, the domain should NOT actually exist in any DNS server, to avoid confusion. For example,
myname.company.comorlocal.hcms-client.dev. Single-word (without dot) and non-ascii characters are not recommended.
Technically optional, but usually needed
-Iis the name (full tag) of thehcms-clientimage that you built before-denables the development modeThis is required for all developers who need this setup for local development!
-jis the JWT you generated upon registering your HCMS instancedocker composeoverrides the already created configuration, including the JWT token. For development, this is not a problem. If you need the local installation for other purposes, such as testing, demonstration, or validation with your stakeholders, you need to use the token you created. For development purpose, you can letdocker-composedo the override.
-Dis the security domain you created before upon registering the HCMS instance (the first domain)If you do not specify the
-Dargument, theroot.will be set in the local configuration override.
Optional arguments
-c: your TLS certificate for HTTPs connection. This needs to be prepared in advance and is not part of the current guide. When not available, a self-signed certificate is automatically generated by the preparation script and is later mounted inside the HCMS image bydocker compose.If a https certificate is provided via
-coption, this domain must match the certificate!
SMTP values
Necessary for registration and/or password reset to work (activation link is sent via email). Without SMTP, new user registration fails with a generic error (HTTP 500 from the backend endpoint). The user, however, is still created and it is possible to activate it using the Java Client: open the user's asset metadata and remove the asset feature labelled "Portal: User Confirmation Key" (
censhare:module.oc.portal.user-confirmation-key). See also create an administrator account article for complete instructions.Please run
./prepare-env.sh -hto show all available options.
Complete command
An example for the setup without a local configuration override (with all mandatory and semi-optional arguments):
./prepare-env.sh -s frmis://hcms-client-dev.oc.censhare.com:30546/corpus.RMIServerSSL -i dev1.demo:default1 -o root.hcms.dev1. -k ./dev1.demo:default1.pem -j JWT -d -D root.sampleportal1. -I hcms-client:local dev1.hcms-client.mycompany.com
When everything is done, the .env file is created with the correct values.
Note: this script creates a number of temporary files. If you need to remove them, just run git clean -fdx . in the directory where it is present. This is handy especially if the previous run failed for some reason.