forked from stroate/docker-neo4j-increased-heap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-entrypoint.sh
84 lines (73 loc) · 3.4 KB
/
docker-entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash -eu
setting() {
setting="${1}"
value="${2}"
file="neo4j.conf"
if [ -n "${value}" ]; then
if grep -q -F "${setting}=" conf/"${file}"; then
sed --in-place "s|.*${setting}=.*|${setting}=${value}|" conf/"${file}"
else
echo "${setting}=${value}" >>conf/"${file}"
fi
fi
}
if [ "$1" == "neo4j" ]; then
setting "dbms.tx_log.rotation.retention_policy" "${NEO4J_dbms_txLog_rotation_retentionPolicy:-100M size}"
setting "dbms.memory.pagecache.size" "${NEO4J_dbms_memory_pagecache_size:-2000M}"
setting "wrapper.java.additional=-Dneo4j.ext.udc.source" "${NEO4J_UDC_SOURCE:-docker}"
setting "dbms.memory.heap.initial_size" "${NEO4J_dbms_memory_heap_maxSize:-2000M}"
setting "dbms.memory.heap.max_size" "${NEO4J_dbms_memory_heap_maxSize:-2000M}"
setting "dbms.unmanaged_extension_classes" "${NEO4J_dbms_unmanagedExtensionClasses:-}"
setting "dbms.allow_format_migration" "${NEO4J_dbms_allowFormatMigration:-}"
if [ "${NEO4J_AUTH:-}" == "none" ]; then
setting "dbms.security.auth_enabled" "false"
elif [[ "${NEO4J_AUTH:-}" == neo4j/* ]]; then
password="${NEO4J_AUTH#neo4j/}"
if [ "${password}" == "neo4j" ]; then
echo "Invalid value for password. It cannot be 'neo4j', which is the default."
exit 1
fi
bin/neo4j-admin set-initial-password "${password}"
elif [ -n "${NEO4J_AUTH:-}" ]; then
echo "Invalid value for NEO4J_AUTH: '${NEO4J_AUTH}'"
exit 1
fi
setting "dbms.connectors.default_listen_address" "0.0.0.0"
setting "dbms.connector.http.listen_address" "0.0.0.0:7474"
setting "dbms.connector.https.listen_address" "0.0.0.0:7473"
setting "dbms.connector.bolt.listen_address" "0.0.0.0:7687"
setting "dbms.mode" "${NEO4J_dbms_mode:-}"
setting "dbms.connectors.default_advertised_address" "${NEO4J_dbms_connectors_defaultAdvertisedAddress:-}"
setting "ha.server_id" "${NEO4J_ha_serverId:-}"
setting "ha.host.data" "${NEO4J_ha_host_data:-}"
setting "ha.host.coordination" "${NEO4J_ha_host_coordination:-}"
setting "ha.initial_hosts" "${NEO4J_ha_initialHosts:-}"
setting "causal_clustering.expected_core_cluster_size" "${NEO4J_causalClustering_expectedCoreClusterSize:-}"
setting "causal_clustering.initial_discovery_members" "${NEO4J_causalClustering_initialDiscoveryMembers:-}"
setting "causal_clustering.discovery_advertised_address" "${NEO4J_causalClustering_discoveryAdvertisedAddress:-$(hostname):5000}"
setting "causal_clustering.transaction_advertised_address" "${NEO4J_causalClustering_transactionAdvertisedAddress:-$(hostname):6000}"
setting "causal_clustering.raft_advertised_address" "${NEO4J_causalClustering_raftAdvertisedAddress:-$(hostname):7000}"
[ -f "${EXTENSION_SCRIPT:-}" ] && . ${EXTENSION_SCRIPT}
if [ -d /conf ]; then
find /conf -type f -exec cp {} conf \;
fi
if [ -d /ssl ]; then
setting "dbms.directories.certificates" "/ssl" neo4j.conf
fi
if [ -d /plugins ]; then
setting "dbms.directories.plugins" "/plugins" neo4j.conf
fi
if [ -d /logs ]; then
setting "dbms.directories.logs" "/logs" neo4j.conf
fi
exec bin/neo4j console
elif [ "$1" == "dump-config" ]; then
if [ -d /conf ]; then
cp --recursive conf/* /conf
else
echo "You must provide a /conf volume"
exit 1
fi
else
exec "$@"
fi