Test Environment
Audience: Technical administration, anyone who wants to try oPBWeb
Overview
The test environment starts oPBWeb together with two simulated opsi servers (opsiconfd mocks). With them you try the editor and the whole workflow, from the import from the workbench through building to promoting from Test to Production, without a real opsi server.
| Config server in oPBWeb | Stage | Depots | Mock container |
|---|---|---|---|
opsi-test | Test | opsi-test.mock (config server), depot-test.mock | opbweb-opsi-mock-test |
opsi-prod | Production | opsi-prod.mock (config server), depot-prod.mock | opbweb-opsi-mock-prod |
The mocks run with the oPBWeb backend image, their code comes from tools/opsi-mock/opsi_mock.py. Both are part of the repository clone and of the stack ZIP
. The short version of this guide is next to them as START-TEST-ENVIRONMENT_en.md.
The test environment uses the same container names and volumes as a regular installation (Compose project opbweb). Set it up on a host without another oPBWeb installation, for example a VM or your own computer. On a host with a production installation it would replace its containers.
Requirements
- Docker with the Compose plugin and
openssl, see Requirements . Access to an opsi server is not needed. - The oPBWeb files, a clone or the stack ZIP, see Installation .
Set up and start
Change into the directory with the files and run the setup:
./setup-opbweb.shThe defaults suit a test, Enter accepts them. At the images question choose
r(registry) or, in a clone,l(build locally). In the stack ZIP the setup selects the registry images fromversions.env. At the end the setup shows the password of the first administratoradmin; it is also insecrets/admin_password.txt.Start the stack with the mocks:
./start.sh --test # images from the registry ./start.sh --test --build # in a clone with locally built images--testaddsdocker-compose.test.yml. On the first start the API registers the two mocks as config servers, as long as no opsi server is configured yet (variableOPSI_MOCK_SERVERSin the overlay). The technical user isopsiadmwith the passwordmock, TLS verification is off.Open
https://localhost/(or the port from the setup) and sign in asadmin. Without your own certificate the setup created a self-signed one; confirm the browser warning.Open Depots.
opsi-prod(Production) andopsi-test(Test) are listed on the left. Clickopsi-test, then Test connection; oPBWeb reads the depots of the server. Do the same foropsi-prod. Without this step the depots arrive with the next opsi check, after 5 minutes at the latest.
Trying the workflow
- In Packages, click Workbench … and choose the config server
opsi-test. The workbench of the mock contains the projectmock-demoand the folderkein-paket(not a valid project, to see the error message). Selectmock-demoand click Import selected (1), see Packages . - Open
mock-demowith Open in editor, change something, for example inCLIENT_DATA/setup.opsiscriptin the script editor , and save. - Click Build, then Install …. Select the two depots of
opsi-test(stage Test) and click Install. The version is released afterwards, see Build and Deploy . - In Packages, click Promote …, set From Test to Production and click Promote (1). oPBWeb installs the same build on the depots of
opsi-prod, see Promoting to another stage . - Under Depots you see the installed products, the files and the repository of each depot, under Jobs the logs of all steps.
What the mocks can do
- Reproduced: sign-in, workbench, repository and depot via WebDAV, install and uninstall (the uploaded package is read and its
.md5checked), installed products per depot, four sample clients (client1.mocktoclient4.mock) for “Request setup on all clients that have the product installed”. The producthwauditis locked on the depots except the config server, to try Unlock. - State in memory: restarting the mocks (or the stack) resets them, with a fresh workbench and without the installed packages. The oPBWeb database keeps packages, versions and users; the next sync brings the depot states up to date.
- No substitute for a real server: permissions,
admin-networks, certificates and the behaviour of remote depots only show on a real opsi server.
Stop, continue, remove
| Goal | Steps |
|---|---|
| Stop | ./stop.sh (also stops the mocks; the data is kept) |
| Start again | ./start.sh --test |
| Continue with a real opsi server | add the real config server under Depots (Initial Setup
), remove the two mock servers and start without --test from then on |
| Remove everything, including all data | docker compose -f docker-compose.yml -f docker-compose.test.yml down -v, then delete the directory |