|
| 1 | + |
| 2 | +# How to customize your Liberty Server |
| 3 | + |
| 4 | +## Provide a custom server name |
| 5 | + |
| 6 | +You can provide a custom name for your Liberty server by specifying the `SERVER_NAME` environment variable at container image **build-time**. |
| 7 | + |
| 8 | +### Building from a new image |
| 9 | + |
| 10 | +Specifying the `ENV SERVER_NAME=<your-server-name>` variable allows you to run a Liberty server with a custom name, as in the Dockerfile below. |
| 11 | +```Dockerfile |
| 12 | +FROM icr.io/appcafe/websphere-liberty:kernel-java17-openj9-ubi |
| 13 | + |
| 14 | +ENV SERVER_NAME=liberty1 |
| 15 | + |
| 16 | +RUN features.sh |
| 17 | + |
| 18 | +RUN configure.sh |
| 19 | +``` |
| 20 | +Running this container will produce output similar to: |
| 21 | +``` |
| 22 | +Launching liberty1 (WebSphere Application Server 23.0.0.5/wlp-1.0.77.cl230520230514-1901) on Eclipse OpenJ9 VM, version 17.0.7+7 (en_US) |
| 23 | +[AUDIT ] CWWKE0001I: The server liberty1 has been launched. |
| 24 | +[AUDIT ] CWWKE0100I: This product is licensed for development, and limited production use. The full license terms can be viewed here: https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/license/base_ilan/ilan/23.0.0.5/lafiles/en.html |
| 25 | +[AUDIT ] CWWKG0093A: Processing configuration drop-ins resource: /opt/ibm/wlp/usr/servers/liberty1/configDropins/defaults/keystore.xml |
| 26 | +[WARNING ] CWWKF0009W: The server has not been configured to install any features. |
| 27 | +[AUDIT ] CWWKF0012I: The server installed the following features: []. |
| 28 | +[AUDIT ] CWWKF0011I: The liberty1 server is ready to run a smarter planet. The liberty1 server started in 0.473 seconds. |
| 29 | +``` |
| 30 | + |
| 31 | +### Renaming an existing Liberty server |
| 32 | + |
| 33 | +Liberty server configurations and existing output data under `/config` and `/output`, respectively, will be relocated to the server with new name, allowing you to **rename** servers `FROM` any Liberty image. |
| 34 | + |
| 35 | +```Dockerfile |
| 36 | +FROM icr.io/appcafe/websphere-liberty:kernel-java17-openj9-ubi as staging |
| 37 | + |
| 38 | +ENV SERVER_NAME=liberty1 |
| 39 | + |
| 40 | +# Initialize server configuration |
| 41 | +COPY --chown=1001:0 server.xml /config/ |
| 42 | + |
| 43 | +RUN features.sh |
| 44 | + |
| 45 | +RUN configure.sh |
| 46 | + |
| 47 | +# From an existing Liberty server |
| 48 | +FROM staging |
| 49 | + |
| 50 | +# Rename liberty1 to liberty2, retaining /config/server.xml from above |
| 51 | +ENV SERVER_NAME=liberty2 |
| 52 | + |
| 53 | +RUN features.sh |
| 54 | + |
| 55 | +RUN configure.sh |
| 56 | +``` |
| 57 | + |
| 58 | +### Notes |
| 59 | + |
| 60 | +The new server name changes the directory of stored configurations and server output. For example, for a custom server name `liberty1`. |
| 61 | +- `/config -> /opt/ol/wlp/usr/servers/liberty1` |
| 62 | +- `/output -> /opt/ol/wlp/output/liberty1` |
| 63 | + |
| 64 | +By using the symbolic links `/config` and `/output`, you can always ensure a correct mapping to the Liberty server's directories. |
| 65 | + |
| 66 | + |
0 commit comments