mirror of
https://github.com/tiennm99/docker-images.git
synced 2026-10-13 04:14:58 +00:00
feat(couchbase): fix
This commit is contained in:
1 parent
eb028c8ee1
commit
a141b1db39
7 files changed
+36
-165
No files matched your search
@@ -6,6 +6,7 @@ on:
|
||||
- 'main'
|
||||
paths:
|
||||
- 'couchbase-2.5/**'
|
||||
- '.github/workflows/publish-couchbase-2.5.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
@@ -41,6 +42,9 @@ jobs:
|
||||
images: |
|
||||
${{ secrets.DOCKER_USERNAME }}/couchbase-2.5
|
||||
ghcr.io/${{ github.actor }}/couchbase-2.5
|
||||
tags: |
|
||||
type=raw,value=latest
|
||||
type=raw,value=2.5.2
|
||||
|
||||
- name: Build and push Docker images
|
||||
id: push
|
||||
|
||||
+14
-70
@@ -5,84 +5,28 @@ LABEL maintainer="Tien Nguyen Minh <tiennm99@outlook.com>"
|
||||
RUN sed -i 's|http://archive.ubuntu.com/ubuntu/|http://old-releases.ubuntu.com/ubuntu/|g' /etc/apt/sources.list && \
|
||||
sed -i 's|http://security.ubuntu.com/ubuntu|http://old-releases.ubuntu.com/ubuntu|g' /etc/apt/sources.list
|
||||
|
||||
# Install dependencies:
|
||||
# runit: for container process management
|
||||
# wget: for downloading .deb
|
||||
# python-httplib2: used by CLI tools
|
||||
# chrpath: for fixing curl, below
|
||||
# tzdata: timezone info used by some N1QL functions
|
||||
# Additional dependencies for system commands used by cbcollect_info:
|
||||
# lsof: lsof
|
||||
# lshw: lshw
|
||||
# sysstat: iostat, sar, mpstat
|
||||
# net-tools: ifconfig, arp, netstat
|
||||
# numactl: numactl
|
||||
RUN apt-get update && \
|
||||
apt-get install -yq runit wget python-httplib2 chrpath tzdata \
|
||||
lsof lshw sysstat net-tools numactl librtmp0 && \
|
||||
# apt-get install -yq libssl0.9.8 && \
|
||||
# apt-get install -yq dos2unix && \
|
||||
apt-get install -yq libc6 && \
|
||||
apt-get autoremove && apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
ARG CB_VERSION=2.5.2
|
||||
ARG CB_RELEASE_URL=https://packages.couchbase.com/releases
|
||||
ARG CB_PACKAGE=couchbase-server-enterprise_2.5.2_x86_64.deb
|
||||
ARG CB_SHA256=27a79a65758023c34ed900e8ef8c54bab4a65f4c84b7c94359cba910800a4b19
|
||||
ENV CB_VERSION=2.5.2
|
||||
ENV CB_RELEASE_URL=https://packages.couchbase.com/releases
|
||||
ENV CB_PACKAGE=couchbase-server-enterprise_2.5.2_x86_64.deb
|
||||
ENV CB_SHA256=27a79a65758023c34ed900e8ef8c54bab4a65f4c84b7c94359cba910800a4b19
|
||||
|
||||
ENV PATH=$PATH:/opt/couchbase/bin:/opt/couchbase/bin/tools:/opt/couchbase/bin/install
|
||||
|
||||
# Create Couchbase user with UID 1000 (necessary to match default
|
||||
# boot2docker UID)
|
||||
RUN groupadd -g 1000 couchbase && useradd couchbase -u 1000 -g couchbase -M
|
||||
RUN apt-get update && \
|
||||
apt-get install -yq wget libssl0.9.8 librtmp0 dos2unix && \
|
||||
apt-get autoremove && apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
# Install couchbase
|
||||
RUN export INSTALL_DONT_START_SERVER=1 && \
|
||||
wget -N $CB_RELEASE_URL/$CB_VERSION/$CB_PACKAGE && \
|
||||
wget -N --no-check-certificate $CB_RELEASE_URL/$CB_VERSION/$CB_PACKAGE && \
|
||||
echo "$CB_SHA256 $CB_PACKAGE" | sha256sum -c - && \
|
||||
dpkg -i ./$CB_PACKAGE && rm -f ./$CB_PACKAGE
|
||||
|
||||
# Add runit script for couchbase-server
|
||||
COPY scripts/run /etc/service/couchbase-server/run
|
||||
# RUN dos2unix /etc/service/couchbase-server/run && \
|
||||
# chmod +x /etc/service/couchbase-server/run
|
||||
RUN chown -R couchbase:couchbase /etc/service
|
||||
ADD scripts/couchbase-start /usr/local/bin/
|
||||
RUN dos2unix /usr/local/bin/couchbase-start && \
|
||||
chmod +x /usr/local/bin/couchbase-start
|
||||
|
||||
# Add dummy script for commands invoked by cbcollect_info that
|
||||
# make no sense in a Docker container
|
||||
COPY scripts/dummy.sh /usr/local/bin/
|
||||
# RUN dos2unix /usr/local/bin/dummy.sh && \
|
||||
# chmod +x /usr/local/bin/dummy.sh
|
||||
RUN ln -s dummy.sh /usr/local/bin/iptables-save && \
|
||||
ln -s dummy.sh /usr/local/bin/lvdisplay && \
|
||||
ln -s dummy.sh /usr/local/bin/vgdisplay && \
|
||||
ln -s dummy.sh /usr/local/bin/pvdisplay
|
||||
ENTRYPOINT ["/usr/local/bin/couchbase-start"]
|
||||
|
||||
# Fix curl RPATH
|
||||
RUN chrpath -r '$ORIGIN/../lib' /opt/couchbase/bin/curl
|
||||
|
||||
# Add bootstrap script
|
||||
COPY scripts/entrypoint.sh /
|
||||
# RUN dos2unix /entrypoint.sh && \
|
||||
# chmod +x /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["couchbase-server", "-- -kernel global_enable_tracing false -noinput"]
|
||||
|
||||
# 8091: Couchbase Web console, REST/HTTP interface
|
||||
# 8092: Views, queries, XDCR
|
||||
# 8093: Query services (4.0+)
|
||||
# 8094: Full-text Search (4.5+)
|
||||
# 8095: Analytics (5.5+)
|
||||
# 8096: Eventing (5.5+)
|
||||
# 11207: Smart client library data node access (SSL)
|
||||
# 11210: Smart client library/moxi data node access
|
||||
# 11211: Legacy non-smart client library data node access
|
||||
# 18091: Couchbase Web console, REST/HTTP interface (SSL)
|
||||
# 18092: Views, query, XDCR (SSL)
|
||||
# 18093: Query services (SSL) (4.0+)
|
||||
# 18094: Full-text Search (SSL) (4.5+)
|
||||
# 18095: Analytics (SSL) (5.5+)
|
||||
# 18096: Eventing (SSL) (5.5+)
|
||||
EXPOSE 8091 8092 8093 8094 8095 8096 11207 11210 11211 18091 18092 18093 18094 18095 18096
|
||||
EXPOSE 8091 8092 11210 11211
|
||||
VOLUME /opt/couchbase/var
|
||||
@@ -1,16 +1,13 @@
|
||||
services:
|
||||
couchbase:
|
||||
# image: ghcr.io/tiennm99/docker-images/couchbase-2.5:latest
|
||||
image: couchbase-2.5:latest
|
||||
image: ghcr.io/tiennm99/couchbase-2.5:2.5.2
|
||||
ports:
|
||||
- "8091:8091"
|
||||
- "8092:8092"
|
||||
- "11210:11210"
|
||||
- "11211:11211"
|
||||
# stdin_open: true
|
||||
# tty: true
|
||||
# volumes:
|
||||
# - couchbase_data:/opt/couchbase/var
|
||||
volumes:
|
||||
- couchbase_data:/opt/couchbase/var
|
||||
|
||||
# volumes:
|
||||
# couchbase_data:
|
||||
volumes:
|
||||
couchbase_data:
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
cd /opt/couchbase
|
||||
mkdir -p var/lib/couchbase \
|
||||
var/lib/couchbase/config \
|
||||
var/lib/couchbase/data \
|
||||
var/lib/couchbase/stats \
|
||||
var/lib/couchbase/logs \
|
||||
var/lib/moxi
|
||||
|
||||
chown -R couchbase:couchbase var
|
||||
su - couchbase -c "/opt/couchbase/bin/couchbase-server -- -noinput"
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Running in Docker container - $0 not available"
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
staticConfigFile=/opt/couchbase/etc/couchbase/static_config
|
||||
restPortValue=8091
|
||||
|
||||
# see https://developer.couchbase.com/documentation/server/current/install/install-ports.html
|
||||
# https://docs.couchbase.com/couchbase-manual-2.5/cb-install/#network-ports
|
||||
function overridePort() {
|
||||
portName=$1
|
||||
portNameUpper=$(echo $portName | awk '{print toupper($0)}')
|
||||
portValue=${!portNameUpper}
|
||||
|
||||
# only override port if value available AND not already contained in static_config
|
||||
if [ "$portValue" != "" ]; then
|
||||
if grep -Fq "{${portName}," ${staticConfigFile}
|
||||
then
|
||||
echo "Don't override port ${portName} because already available in $staticConfigFile"
|
||||
else
|
||||
echo "Override port '$portName' with value '$portValue'"
|
||||
echo "{$portName, $portValue}." >> ${staticConfigFile}
|
||||
|
||||
if [ ${portName} == "rest_port" ]; then
|
||||
restPortValue=${portValue}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
overridePort "rest_port"
|
||||
overridePort "mccouch_port"
|
||||
overridePort "memcached_port"
|
||||
overridePort "query_port"
|
||||
overridePort "ssl_query_port"
|
||||
overridePort "fts_http_port"
|
||||
overridePort "moxi_port"
|
||||
overridePort "ssl_rest_port"
|
||||
overridePort "ssl_capi_port"
|
||||
overridePort "ssl_proxy_downstream_port"
|
||||
overridePort "ssl_proxy_upstream_port"
|
||||
|
||||
|
||||
# if [ "$1" == "couchbase-server" ] && [ ! -d "/etc/service" ]; then
|
||||
[[ "$1" == "couchbase-server" ]] && {
|
||||
|
||||
if [ "$(whoami)" = "couchbase" ]; then
|
||||
# Ensure that /opt/couchbase/var is owned by user 'couchbase' and
|
||||
# is writable
|
||||
if [ ! -w /opt/couchbase/var -o \
|
||||
$(find /opt/couchbase/var -maxdepth 0 -printf '%u') != "couchbase" ]; then
|
||||
echo "/opt/couchbase/var is not owned and writable by UID 1000"
|
||||
echo "Aborting as Couchbase Server will likely not run"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
echo "Starting Couchbase Server -- Web UI available at http://<ip>:$restPortValue"
|
||||
echo "and logs available in /opt/couchbase/var/lib/couchbase/logs"
|
||||
exec /usr/bin/runsvdir -P /etc/service
|
||||
}
|
||||
# fi
|
||||
|
||||
exec "$@"
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
unset HOME
|
||||
|
||||
exec 2>&1
|
||||
|
||||
# Create directories where couchbase stores its data
|
||||
cd /opt/couchbase
|
||||
mkdir -p var/lib/couchbase \
|
||||
var/lib/couchbase/config \
|
||||
var/lib/couchbase/data \
|
||||
var/lib/couchbase/stats \
|
||||
var/lib/couchbase/logs \
|
||||
var/lib/moxi
|
||||
|
||||
chown -R couchbase:couchbase var
|
||||
if [ $(whoami) = "couchbase" ]; then
|
||||
exec /opt/couchbase/bin/couchbase-server -- -kernel global_enable_tracing false -noinput
|
||||
else
|
||||
exec chpst -ucouchbase /opt/couchbase/bin/couchbase-server -- -kernel global_enable_tracing false -noinput
|
||||
fi
|
||||
Reference in new issue
Block a user