https://github.com/lgdd/wait-for-liferay
Script to wait for the availability of a Liferay instance.
https://github.com/lgdd/wait-for-liferay
docker docker-compose liferay script
Last synced: about 2 months ago
JSON representation
Script to wait for the availability of a Liferay instance.
- Host: GitHub
- URL: https://github.com/lgdd/wait-for-liferay
- Owner: lgdd
- License: mit
- Created: 2019-11-08T10:38:28.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-14T08:57:31.000Z (over 6 years ago)
- Last Synced: 2025-12-26T09:35:37.831Z (6 months ago)
- Topics: docker, docker-compose, liferay, script
- Language: Shell
- Size: 5.86 KB
- Stars: 4
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wait-for-liferay
`wait-for-liferay.sh` is a script that will wait on the availability of a Liferay instance based on its host and TCP port. It is designed to synchronize services like docker containers. It was inspired by [vishnubob/wait-for-it](https://github.com/vishnubob/wait-for-it) and [eficode/wait-for](https://github.com/eficode/wait-for).
## Usage
```
Usage:
wait-for-liferay.sh host:port [-- command args]
-s | --sleep=SLEEP Time in seconds to wait between tests (default=1)
-q | --quiet Don't output any status messages
-- COMMAND ARGS Execute command with args after the test finishes
```
## Example
With [Docker Compose](https://docs.docker.com/compose/startup-order/), you want to start a Liferay cluster and therefore the second node must start just after the first node is available:
- `Dockerfile`:
```
FROM liferay/portal:7.2.0-ga1
ADD --chown=liferay:liferay https://raw.githubusercontent.com/lgdd/wait-for-liferay/master/wait-for-liferay.sh /usr/local/bin/
RUN chmod a+x /usr/local/bin/wait-for-liferay.sh
```
- `docker-compose.yml`:
```
version: '3.3'
services:
liferay-node-1:
build: .
liferay-node-2:
build: .
entrypoint: /usr/local/bin/wait-for-liferay.sh liferay-node-1:8080 -- /usr/local/bin/liferay_entrypoint.sh
```
- Docker Compose logs output:
```
liferay-node-2_1 | Liferay is unavailable on liferay-node-1:8080 - sleeping
liferay-node-1_1 | INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [x] milliseconds
... | ...
liferay-node-1_1 | INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [x] milliseconds
liferay-node-2_1 | Liferay is up on liferay-node-1:8080 - executing command
liferay-node-2_1 | [LIFERAY] To SSH into this container, run: "docker exec -it liferay-node-2.local /bin/bash".
... | ...
```
## License
[MIT](LICENSE)