-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-bika.sh
More file actions
85 lines (75 loc) · 2.31 KB
/
install-bika.sh
File metadata and controls
85 lines (75 loc) · 2.31 KB
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
85
#!/usr/bin/env bash
##
# install bika selfhost(docker) online
##
set -e
notes () {
cat << EOF
======== WARM TIPS ========
Before you submit any github issue, please do the following check:
* make sure the docker daemon is running
* make sure you use docker compose v2: recommend 2.x.x, got $(docker compose version --short 2>/dev/null || echo not install)
* make sure the kernel version is greater than 4.10+, got $(uname -r)
* check your internet connection if timeout happens
* check for potential port conflicts if you have local services listening on all interfaces (e.g. another redis container listening on *:6379)
===========================
EOF
}
trap notes ERR
map_arch() {
local arch=$(uname -m)
case $arch in
x86_64)
echo "amd64"
;;
aarch64)
echo "arm64"
;;
armv7l)
echo "arm"
;;
*)
echo "$arch"
;;
esac
}
arch=$(map_arch)
if ! docker info >/dev/null 2>&1; then
os=$(uname -s)
if [ "$os" == "Linux" ]; then
curl -O https://download-selfhosted.bika.ai/docker-compose/${arch}/docker-28.0.1.tgz
tar -zxvf docker-28.0.1.tgz -C /tmp
mkdir -p /etc/docker
mkdir -p /usr/local/lib/docker/cli-plugins
mv /tmp/docker/bin/* /usr/local/bin/
cp -rf /tmp/docker/docker.service /usr/lib/systemd/system/
if [ ! -e "/usr/bin/docker" ];then
ln -s /usr/local/bin/docker /usr/bin/
fi
if [ ! -e "/usr/local/lib/docker/cli-plugins/docker-compose" ]; then
ln -s /usr/local/bin/docker-compose /usr/local/lib/docker/cli-plugins/
fi
systemctl daemon-reload
systemctl enable docker
systemctl start docker
else
echo "Docker daemon or Docker Desktop is not running... please check" 2>&1
false
exit 1
fi
fi
DOWNLOAD_URL="https://download-selfhosted.bika.ai/latest/bika-docker-${arch}.tar.gz"
: "${DOWNLOAD_URL?✗ missing env}"
curl -fLo bika-docker-amd64.tar.gz "${DOWNLOAD_URL}"
tar -zxvf bika-docker-amd64.tar.gz && cd bika
[ ! -f .env ] && cat .env.template > .env
mkdir -p .data/elasticsearch
docker compose --profile all down -v --remove-orphans
for i in {1..50}; do
if docker compose --profile all pull; then
if docker compose --profile all up -d; then
break
fi
fi
sleep 6
done