From 601a0a386c38d8d9ba1de381ecb2e95f827e347e Mon Sep 17 00:00:00 2001 From: liujie-666 Date: Tue, 10 Dec 2024 11:26:45 +0800 Subject: [PATCH 1/4] Create 5.05 --- delron/fastdfs/5.05 | 1 + 1 file changed, 1 insertion(+) create mode 100644 delron/fastdfs/5.05 diff --git a/delron/fastdfs/5.05 b/delron/fastdfs/5.05 new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/delron/fastdfs/5.05 @@ -0,0 +1 @@ + From ec4281b0ca2f1f3c11f0f6faa5dd87db34edeccf Mon Sep 17 00:00:00 2001 From: liujie-666 Date: Wed, 11 Dec 2024 09:34:13 +0800 Subject: [PATCH 2/4] Delete delron/fastdfs/5.05 --- delron/fastdfs/5.05 | 1 - 1 file changed, 1 deletion(-) delete mode 100644 delron/fastdfs/5.05 diff --git a/delron/fastdfs/5.05 b/delron/fastdfs/5.05 deleted file mode 100644 index 8b137891..00000000 --- a/delron/fastdfs/5.05 +++ /dev/null @@ -1 +0,0 @@ - From 338460ae7be10d04561c9ecf1e7f649a39a336a7 Mon Sep 17 00:00:00 2001 From: liujie Date: Wed, 11 Dec 2024 10:10:22 +0800 Subject: [PATCH 3/4] add fastdfsV5.05 --- delron/fastdfs/5.05/Dockerfile | 26 ++++++++++++ delron/fastdfs/5.05/Makefile | 34 +++++++++++++++ delron/fastdfs/5.05/start1.sh | 76 ++++++++++++++++++++++++++++++++++ 3 files changed, 136 insertions(+) create mode 100644 delron/fastdfs/5.05/Dockerfile create mode 100644 delron/fastdfs/5.05/Makefile create mode 100755 delron/fastdfs/5.05/start1.sh diff --git a/delron/fastdfs/5.05/Dockerfile b/delron/fastdfs/5.05/Dockerfile new file mode 100644 index 00000000..cc6e1b6a --- /dev/null +++ b/delron/fastdfs/5.05/Dockerfile @@ -0,0 +1,26 @@ +FROM cr.loongnix.cn/openanolis/anolisos:8.9 +LABEL org.label-schema.schema-version==1.0 org.label-schema.license=GPLv2 +CMD ["/bin/bash"] +LABEL maintainer=liujie@loongson.cn +ENV FASTDFS_PATH=/opt/fdfs FASTDFS_BASE_PATH=/var/fdfs PORT= GROUP_NAME= TRACKER_SERVER= +RUN /bin/sh -c "dnf install -y wget zlib zlib-devel pcre pcre-devel gcc gcc-c++ openssl openssl-devel libevent libevent-devel perl unzip net-tools git make" +RUN /bin/sh -c "mkdir -p ${FASTDFS_PATH}/libfastcommon && mkdir -p ${FASTDFS_PATH}/fastdfs && mkdir ${FASTDFS_BASE_PATH}" +WORKDIR /opt/fdfs/libfastcommon +ADD src/libfastcommon ${FASTDFS_PATH}/libfastcommon +RUN ./make.sh && ./make.sh install && rm -rf ${FASTDFS_PATH}/libfastcommon +WORKDIR /opt/fdfs/fastdfs +ADD src/fastdfs ${FASTDFS_PATH}/fastdfs +RUN ./make.sh && ./make.sh install && rm -rf ${FASTDFS_PATH}/fastdfs +EXPOSE 22122 23000 8080 8888 +VOLUME ["/var/fdfs", "/etc/fdfs"] +RUN mkdir -p /tmp/nginx +ADD src/nginx /tmp/nginx/nginx +COPY src/nginx_module /tmp/nginx/nginx_module +WORKDIR /tmp/nginx/nginx +RUN ./auto/configure --prefix=/usr/local/nginx --add-module=/tmp/nginx/nginx_module/src && make && make install +COPY src/nginx/conf/ /etc/fdfs/ +RUN ls -al /usr/local/nginx/conf +COPY start1.sh /usr/bin/ +RUN chmod 777 /usr/bin/start1.sh +ENTRYPOINT ["/usr/bin/start1.sh"] +CMD ["tracker"] diff --git a/delron/fastdfs/5.05/Makefile b/delron/fastdfs/5.05/Makefile new file mode 100644 index 00000000..b29f59f4 --- /dev/null +++ b/delron/fastdfs/5.05/Makefile @@ -0,0 +1,34 @@ + +REGISTRY?=cr.loongnix.cn +ORGANIZATION?=calico +REPOSITORY?=fastdfs +TAG?=5.05 + +FASTDFS_SRC_URL=https://github.com/liujie-666/fastdfs.git +NGINX_SRC_URL=https://github.com/nginx/nginx.git +NGINX_MODULE_URL=https://github.com/happyfish100/fastdfs-nginx-module.git +LIBFAST_COMMON_SRC_URL=https://github.com/happyfish100/libfastcommon.git + +NGINX_COMMIT=0ddad64 +NGINX_MODULE_COMMIT=10d1729 +LIBFAST_COMMON_COMMIT=906c9e8 + +IMAGE_NAME=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG) +SUBDIR = fastdfs nginx nginx_module libfastcommon + +default:image + +image: $(foreach dir, $(SUBDIR), src/$(dir)) + docker build -t $(IMAGE_NAME) . +src/fastdfs: + git clone $(FASTDFS_SRC_URL) $@ +src/nginx: + git clone $(NGINX_SRC_URL) $@ && cd $@ && git checkout ${NGINX_COMMITI} +src/nginx_module: + git clone $(NGINX_MODULE_URL) $@ && cd $@ && git checkout ${NGINX_MODULE_COMMIT} +src/libfastcommon: + git clone $(LIBFAST_COMMON_SRC_URL) $@ && cd $@ && git checkout ${LIBFAST_COMMON_COMMIT} +push: + docker push $(IMAGE_NAME) +clean: + rm -rf src diff --git a/delron/fastdfs/5.05/start1.sh b/delron/fastdfs/5.05/start1.sh new file mode 100755 index 00000000..c6080d89 --- /dev/null +++ b/delron/fastdfs/5.05/start1.sh @@ -0,0 +1,76 @@ +#!/bin/bash +#set -e +if [ "$1" = "monitor" ] ; then + if [ -n "$TRACKER_SERVER" ] ; then + sed -i "s|tracker_server=.*$|tracker_server=${TRACKER_SERVER}|g" /etc/fdfs/client.conf + fi + fdfs_monitor /etc/fdfs/client.conf + exit 0 +elif [ "$1" = "storage" ] ; then + FASTDFS_MODE="storage" + sed -i "s|store_path0.*$|store_path0=/var/fdfs|g" /etc/fdfs/mod_fastdfs.conf + sed -i "s|url_have_group_name =.*$|url_have_group_name = true|g" /etc/fdfs/mod_fastdfs.conf + /usr/local/nginx/sbin/nginx +else + FASTDFS_MODE="tracker" +fi + +if [ -n "$PORT" ] ; then +sed -i "s|^port=.*$|port=${PORT}|g" /etc/fdfs/"$FASTDFS_MODE".conf +fi + +if [ -n "$TRACKER_SERVER" ] ; then + +sed -i "s|tracker_server=.*$|tracker_server=${TRACKER_SERVER}|g" /etc/fdfs/storage.conf +sed -i "s|tracker_server=.*$|tracker_server=${TRACKER_SERVER}|g" /etc/fdfs/client.conf +sed -i "s|tracker_server=.*$|tracker_server=${TRACKER_SERVER}:22122|g" /etc/fdfs/mod_fastdfs.conf + +fi + +if [ -n "$GROUP_NAME" ] ; then + +sed -i "s|group_name=.*$|group_name=${GROUP_NAME}|g" /etc/fdfs/storage.conf + +fi + +FASTDFS_LOG_FILE="${FASTDFS_BASE_PATH}/logs/${FASTDFS_MODE}d.log" +PID_NUMBER="${FASTDFS_BASE_PATH}/data/fdfs_${FASTDFS_MODE}d.pid" + +echo "try to start the $FASTDFS_MODE node..." +if [ -f "$FASTDFS_LOG_FILE" ]; then + rm "$FASTDFS_LOG_FILE" +fi +# start the fastdfs node. +fdfs_${FASTDFS_MODE}d /etc/fdfs/${FASTDFS_MODE}.conf start + +# wait for pid file(important!),the max start time is 5 seconds,if the pid number does not appear in 5 seconds,start failed. +TIMES=5 +while [ ! -f "$PID_NUMBER" -a $TIMES -gt 0 ] +do + sleep 1s + TIMES=`expr $TIMES - 1` +done + +# if the storage node start successfully, print the started time. +# if [ $TIMES -gt 0 ]; then +# echo "the ${FASTDFS_MODE} node started successfully at $(date +%Y-%m-%d_%H:%M)" + +# # give the detail log address +# echo "please have a look at the log detail at $FASTDFS_LOG_FILE" + +# # leave balnk lines to differ from next log. +# echo +# echo + + + +# # make the container have foreground process(primary commond!) +# tail -F --pid=`cat $PID_NUMBER` /dev/null +# # else print the error. +# else +# echo "the ${FASTDFS_MODE} node started failed at $(date +%Y-%m-%d_%H:%M)" +# echo "please have a look at the log detail at $FASTDFS_LOG_FILE" +# echo +# echo +# fi +tail -f "$FASTDFS_LOG_FILE" From 02a6f46dd4a1c04bc6f4e036d29e87234015ddfc Mon Sep 17 00:00:00 2001 From: liujie Date: Wed, 11 Dec 2024 14:02:24 +0800 Subject: [PATCH 4/4] add fastdfsV5.05patch --- delron/fastdfs/5.05/Makefile | 5 +- delron/fastdfs/5.05/fastdfsV5.05_patch.patch | 113 +++++++++++++++++++ 2 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 delron/fastdfs/5.05/fastdfsV5.05_patch.patch diff --git a/delron/fastdfs/5.05/Makefile b/delron/fastdfs/5.05/Makefile index b29f59f4..5f9bdaa2 100644 --- a/delron/fastdfs/5.05/Makefile +++ b/delron/fastdfs/5.05/Makefile @@ -4,11 +4,12 @@ ORGANIZATION?=calico REPOSITORY?=fastdfs TAG?=5.05 -FASTDFS_SRC_URL=https://github.com/liujie-666/fastdfs.git +FASTDFS_SRC_URL=https://github.com/happyfish100/fastdfs.git NGINX_SRC_URL=https://github.com/nginx/nginx.git NGINX_MODULE_URL=https://github.com/happyfish100/fastdfs-nginx-module.git LIBFAST_COMMON_SRC_URL=https://github.com/happyfish100/libfastcommon.git +FASTDFS_COMMIT=9a47139 NGINX_COMMIT=0ddad64 NGINX_MODULE_COMMIT=10d1729 LIBFAST_COMMON_COMMIT=906c9e8 @@ -21,7 +22,7 @@ default:image image: $(foreach dir, $(SUBDIR), src/$(dir)) docker build -t $(IMAGE_NAME) . src/fastdfs: - git clone $(FASTDFS_SRC_URL) $@ + git clone $(FASTDFS_SRC_URL) $@ && cd $@ && git checkout ${FASTDFS_COMMIT} && git apply ../../fastdfsV5.05_patch.patch src/nginx: git clone $(NGINX_SRC_URL) $@ && cd $@ && git checkout ${NGINX_COMMITI} src/nginx_module: diff --git a/delron/fastdfs/5.05/fastdfsV5.05_patch.patch b/delron/fastdfs/5.05/fastdfsV5.05_patch.patch new file mode 100644 index 00000000..5437d9f2 --- /dev/null +++ b/delron/fastdfs/5.05/fastdfsV5.05_patch.patch @@ -0,0 +1,113 @@ +diff --git a/common/linux_stack_trace.c b/common/linux_stack_trace.c +index 800e1a6..0bf381d 100644 +--- a/common/linux_stack_trace.c ++++ b/common/linux_stack_trace.c +@@ -56,108 +56,5 @@ extern char g_exe_name[256]; + + void signal_stack_trace_print(int signum, siginfo_t *info, void *ptr) + { +- static const char *si_codes[3] = {"", "SEGV_MAPERR", "SEGV_ACCERR"}; +- +- int i, f = 0; +- ucontext_t *ucontext; +- Dl_info dlinfo; +- void **bp = NULL; +- void *ip = NULL; +- char cmd[256]; +- char buff[256]; +- char output[8 * 1024]; +- char *pCurrent; +- +- pCurrent = output; +- ucontext = (ucontext_t*)ptr; +- pCurrent += sprintf(pCurrent, "Segmentation Fault!\n"); +- pCurrent += sprintf(pCurrent, "\tinfo.si_signo = %d\n", signum); +- pCurrent += sprintf(pCurrent, "\tinfo.si_errno = %d\n", info->si_errno); +- pCurrent += sprintf(pCurrent, "\tinfo.si_code = %d (%s)\n", \ +- info->si_code, si_codes[info->si_code]); +- pCurrent += sprintf(pCurrent, "\tinfo.si_addr = %p\n", info->si_addr); +- for(i = 0; i < NGREG; i++) +- { +- pCurrent += sprintf(pCurrent, "\treg[%02d] = 0x"REGFORMAT"\n", +- i, ucontext->uc_mcontext.gregs[i]); +- } +- +-#ifndef SIGSEGV_NOSTACK +-#if defined(SIGSEGV_STACK_IA64) || defined(SIGSEGV_STACK_X86) +-#if defined(SIGSEGV_STACK_IA64) +- ip = (void*)ucontext->uc_mcontext.gregs[REG_RIP]; +- bp = (void**)ucontext->uc_mcontext.gregs[REG_RBP]; +-#elif defined(SIGSEGV_STACK_X86) +- ip = (void*)ucontext->uc_mcontext.gregs[REG_EIP]; +- bp = (void**)ucontext->uc_mcontext.gregs[REG_EBP]; +-#endif +- +- pCurrent += sprintf(pCurrent, "\tStack trace:\n"); +- while(bp && ip) +- { +- const char *symname; +-#ifndef NO_CPP_DEMANGLE +- int status; +- char * tmp; +-#endif +- +- if(!dladdr(ip, &dlinfo)) +- { +- break; +- } +- +- symname = dlinfo.dli_sname; +- +-#ifndef NO_CPP_DEMANGLE +- tmp = __cxa_demangle(symname, NULL, 0, &status); +- +- if (status == 0 && tmp) +- { +- symname = tmp; +- } +-#endif +- +- sprintf(cmd, "addr2line -e %s %p", g_exe_name, ip); +- if (getExecResult(cmd, buff, sizeof(buff)) != 0) +- { +- *buff = '0'; +- } +- +- pCurrent += sprintf(pCurrent, "\t\t% 2d: %p <%s+%lu> (%s in %s)\n", +- ++f, ip, symname, +- (unsigned long)ip-(unsigned long)dlinfo.dli_saddr, +- trim_right(buff), dlinfo.dli_fname); +- +- +-#ifndef NO_CPP_DEMANGLE +- if (tmp) +- { +- free(tmp); +- } +-#endif +- +- if(dlinfo.dli_sname && !strcmp(dlinfo.dli_sname, "main")) +- { +- break; +- } +- +- ip = bp[1]; +- bp = (void**)bp[0]; +- } +-#else +- pCurrent += sprintf(pCurrent, "\tStack trace (non-dedicated):\n"); +- sz = backtrace(bt, 20); +- strings = backtrace_symbols(bt, sz); +- for(i = 0; i < sz; ++i) +- { +- pCurrent += sprintf(pCurrent, "\t\t%s\n", strings[i]); +- } +-#endif +- pCurrent += sprintf(pCurrent, "\tEnd of stack trace.\n"); +-#else +- pCurrent += sprintf(pCurrent, "\tNot printing stack strace.\n"); +-#endif +- +- log_it_ex(&g_log_context, LOG_CRIT, output, pCurrent - output); + } +