Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ LIFERAY_DEBUG_PORT=8000-8009
LIFERAY_YOURKIT_PORT=10001-10010
```

When the project is running, `lec ports` prints both `http://localhost:<port>` and `http://<namespace>.localhost:<port>` for browser-facing ports. The `*.localhost` form gives each project a distinct hostname, so the browser tracks its session separately from other projects. Either URL can be used to connect to a single project.

**Note:** macOS's OS resolver does not handle `*.localhost`. Chrome, Firefox, and Edge resolve it internally, but Safari, `curl`, `wget`, and other tools that use the OS resolver do not. macOS users of those tools should add `127.0.0.1 <namespace>.localhost` to `/etc/hosts` for each project.

#### Enable LibreOffice integration

You can enable LibreOffice integration with Liferay by setting the `lr.docker.environment.service.enabled[libreoffice]` property to `true` or `1` in `gradle.properties`.
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ if (config.dlStore == "s3") {
}

environmentMap.put("DL_STORE_CLASS", config.dlStoreClass)
environmentMap.put("LIFERAY_VALID_HOSTS", config.webserverHostnames.replace(' ', ','))

environmentMap.put("MEDIA_PREVIEW_ENABLED", config.mediaPreviewEnabled)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ class Config {
this.recaptchaEnabled = recaptchaEnabledProperty.toBoolean()
}

def webserverHostnamesProperty = project.findProperty("lr.docker.environment.web.server.hostnames").split(',')*.trim().findAll { it }
def webserverHostnamesProperty = project.findProperty("lr.docker.environment.web.server.hostnames")?.split(',')*.trim()?.findAll { it }

if (webserverHostnamesProperty != null) {
if (webserverHostnamesProperty) {
this.webserverHostnames = webserverHostnamesProperty.join(' ')
}

Expand Down
1 change: 1 addition & 0 deletions compose-recipes/liferay/service.liferay.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ services:
- LIFERAY_JPDA_ENABLED=true
- LIFERAY_DISABLE_TRIAL_LICENSE=true
- LIFERAY_UPGRADE_PERIOD_DATABASE_PERIOD_AUTO_PERIOD_RUN=true
- LIFERAY_VIRTUAL_PERIOD_HOSTS_PERIOD_VALID_PERIOD_HOSTS=${LIFERAY_VALID_HOSTS},*.localhost
healthcheck:
interval: 5s
start_period: 5m
Expand Down
49 changes: 33 additions & 16 deletions scripts/cli/lec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ fi

PROJECT_DIRECTORY=""

_column() {
if [[ "$(uname)" == "Darwin" ]]; then
if ! command -v "$(brew --prefix util-linux)/bin/column" &>/dev/null; then
brew install util-linux
fi

"$(brew --prefix util-linux)/bin/column" "${@}"

return
fi

column "${@}"
}

#
# Helper function for fzf
#
Expand Down Expand Up @@ -463,26 +477,30 @@ _getServicePorts() {
local template

read -r -d '' template <<- 'EOF'
table NAME CONTAINER PORT HOST PORT WEB LINK
{{$name := .Name -}}

NAME,CONTAINER PORT,HOST PORT,WEB LINK,NAMESPACED LINK
{{range .Publishers -}}

{{if eq .URL "0.0.0.0" -}}
{{$name}} {{.TargetPort}} {{.PublishedPort}} {{if eq .PublishedPort 443}}https{{else}}http{{end}}://localhost:{{.PublishedPort}}
{{end -}}

{{end -}}
{{if eq .URL "0.0.0.0"}}
{{- $.Name}},
{{- .TargetPort}},
{{- .PublishedPort}},
{{- if eq .PublishedPort 443}}https{{else}}http{{end}}://localhost:{{.PublishedPort}},
{{- "-"}}
{{end}}
{{- end}}
EOF

local hostname
hostname="$(_getComposeProjectName "${projectDir}").localhost"

(
cd "${projectDir}" || exit 1

if [[ "${serviceName}" ]]; then
docker compose ps "${serviceName}" --format "${template}" | tail -n +3
else
docker compose ps --format "${template}" | tail -n +3
fi
docker compose ps ${serviceName:+"${serviceName}"} --format "${template}" |
sed -E "s@((https?://)localhost:(80|443|8080|8443|9080)),-@\1,\2${hostname}:\3@g" |
_column --keep-empty-lines --separator ',' --table |
tee /dev/tty |
grep -q "${hostname}" &&
printf "Tip: Use the 'NAMESPACED LINK' when running multiple projects at once to keep browser sessions isolated.\n"
)
}
_getWorktreeDir() {
Expand Down Expand Up @@ -792,7 +810,6 @@ cmd_clean() {
fi

_clean "${PROJECT_DIRECTORY}"

}
cmd_exportData() {
_checkProjectDirectory "${PWD}"
Expand Down Expand Up @@ -1012,7 +1029,7 @@ cmd_restart() {
;;
esac
done

if [[ "${FLAG_CLEAN}" -gt 0 ]]; then
_clean "${PROJECT_DIRECTORY}"
else
Expand Down
Loading