فهرست منبع

:wrench: merge alpine & jammy docker files

Jeremy Zheng 3 سال پیش
والد
کامیت
1ded8ffee1
35فایلهای تغییر یافته به همراه866 افزوده شده و 0 حذف شده
  1. 2 0
      docker/.gitignore
  2. 36 0
      docker/alpine/Dockerfile
  3. 16 0
      docker/alpine/build.sh
  4. 16 0
      docker/alpine/start.sh
  5. 265 0
      docker/jammy/Dockerfile
  6. 57 0
      docker/jammy/README.md
  7. 16 0
      docker/jammy/build.sh
  8. 48 0
      docker/jammy/conan/conanfile.txt
  9. 26 0
      docker/jammy/conan/install.sh
  10. 18 0
      docker/jammy/conan/profiles/amd64
  11. 34 0
      docker/jammy/conan/profiles/arm64
  12. 34 0
      docker/jammy/conan/profiles/armhf
  13. 12 0
      docker/jammy/conan/toolchains/amd64.cmake
  14. 18 0
      docker/jammy/conan/toolchains/arm64.cmake
  15. 17 0
      docker/jammy/conan/toolchains/armhf.cmake
  16. 61 0
      docker/jammy/etc/envoy.yaml
  17. 15 0
      docker/jammy/etc/nginx.conf
  18. 3 0
      docker/jammy/etc/redis/clusters-init.sh
  19. 11 0
      docker/jammy/etc/redis/node-1.conf
  20. 11 0
      docker/jammy/etc/redis/node-2.conf
  21. 11 0
      docker/jammy/etc/redis/node-3.conf
  22. 11 0
      docker/jammy/etc/redis/node-4.conf
  23. 11 0
      docker/jammy/etc/redis/node-5.conf
  24. 11 0
      docker/jammy/etc/redis/node-6.conf
  25. 5 0
      docker/jammy/etc/supervisor/conf.d/envoy.conf
  26. 7 0
      docker/jammy/etc/supervisor/conf.d/minio.conf
  27. 5 0
      docker/jammy/etc/supervisor/conf.d/mysql.conf
  28. 5 0
      docker/jammy/etc/supervisor/conf.d/nginx.conf
  29. 7 0
      docker/jammy/etc/supervisor/conf.d/opensearch.conf
  30. 5 0
      docker/jammy/etc/supervisor/conf.d/php-fpm.conf
  31. 5 0
      docker/jammy/etc/supervisor/conf.d/postgresql.conf
  32. 5 0
      docker/jammy/etc/supervisor/conf.d/rabbitmq.conf
  33. 37 0
      docker/jammy/etc/supervisor/conf.d/redis.conf
  34. 14 0
      docker/jammy/etc/supervisor/supervisord.conf
  35. 11 0
      docker/jammy/start.sh

+ 2 - 0
docker/.gitignore

@@ -0,0 +1,2 @@
+*.tar*
+md5.txt

+ 36 - 0
docker/alpine/Dockerfile

@@ -0,0 +1,36 @@
+FROM alpine:latest
+LABEL maintainer="Jeremy Zheng"
+
+RUN apk update
+RUN apk upgrade
+RUN apk add vim curl bash zsh pwgen openssl git tmux rsync openssh-client \
+    build-base cmake git \
+    python3 py3-pip python3-dev \
+    openssl-dev 
+
+RUN mkdir -p $HOME/downloads $HOME/local $HOME/tmp
+
+# https://github.com/ohmyzsh/ohmyzsh
+RUN git clone https://github.com/ohmyzsh/ohmyzsh.git $HOME/.oh-my-zsh
+RUN cp $HOME/.oh-my-zsh/templates/zshrc.zsh-template $HOME/.zshrc
+RUN echo 'export PATH=$HOME/.local/bin:$PATH' >> $HOME/.profile
+RUN echo 'source $HOME/.profile' >> $HOME/.zshrc
+
+RUN git config --global core.quotepath false
+RUN git config --global http.version HTTP/1.1
+RUN git config --global pull.rebase false
+RUN echo 'set-option -g history-limit 102400' > $HOME/.tmux.conf
+
+RUN sh -c ". $HOME/.profile \
+    && pip install --user ansible paramiko"
+RUN echo 'export ANSIBLE_HOST_KEY_CHECKING=False' >> $HOME/.profile
+RUN echo 'export PATH=$HOME/.local/bin:$PATH' >> $HOME/.profile
+RUN echo 'alias peony="ANSIBLE_LOG_PATH=$HOME/tmp/$(date +%Y%m%d%H%M%S).log ansible-playbook"' >> $HOME/.profile
+
+RUN echo "$(date -u +%4Y%m%d%H%M%S)" | tee /VERSION
+
+VOLUME /workspace
+WORKDIR /workspace
+
+CMD ["/bin/zsh", "-l"]
+

+ 16 - 0
docker/alpine/build.sh

@@ -0,0 +1,16 @@
+#!/bin/bash
+
+set -e
+
+export VERSION=$(date "+%4Y%m%d%H%M%S")
+export CODE="palm-alpine"
+
+buildah pull alpine:latest
+buildah bud --layers -t $CODE .
+podman save -o $CODE-$VERSION.tar $CODE
+XZ_OPT=-9 tar -cJf $CODE-$VERSION.tar.xz $CODE-$VERSION.tar
+md5sum $CODE-$VERSION.tar* > md5.txt
+
+echo "done($CODE-$VERSION.tar.xz)."
+
+exit 0

+ 16 - 0
docker/alpine/start.sh

@@ -0,0 +1,16 @@
+#!/bin/bash
+
+export CODE="palm-alpine"
+export NAME="$CODE-$USER"
+
+if podman container exists $NAME
+then
+    podman start -i -a $NAME
+else
+    if [ "$(uname)" == "Darwin" ]
+    then
+        podman run --name $NAME -it --hostname=palm --network host -v $PWD:/workspace:z $CODE
+    else
+        podman run --name $NAME -it --events-backend=file --hostname=palm --network host -v $PWD:/workspace:z $CODE
+    fi
+fi

+ 265 - 0
docker/jammy/Dockerfile

@@ -0,0 +1,265 @@
+FROM ubuntu:jammy
+LABEL maintainer="Jeremy Zheng"
+
+ENV DEBIAN_FRONTEND noninteractive
+
+RUN apt update
+RUN apt -y upgrade
+RUN apt -y install debian-keyring debian-archive-keyring apt-transport-https software-properties-common curl wget gnupg
+
+# https://wiki.ubuntu.com/ToolChain
+RUN echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs) main restricted universe multiverse" > /etc/apt/sources.list
+RUN echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-updates main restricted universe multiverse" >> /etc/apt/sources.list
+RUN echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-security main restricted universe multiverse" >> /etc/apt/sources.list
+RUN dpkg --add-architecture armhf
+RUN dpkg --add-architecture arm64
+RUN echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ $(lsb_release -cs) main restricted universe multiverse" >> /etc/apt/sources.list
+RUN echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ $(lsb_release -cs)-security main restricted universe multiverse" >> /etc/apt/sources.list
+RUN echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ $(lsb_release -cs)-updates main restricted universe multiverse" >> /etc/apt/sources.list
+RUN apt update
+RUN apt -y upgrade
+
+RUN apt -y install zsh git locales locales-all rsync openssh-client sshpass \
+    vim tzdata pwgen zip unzip tree tmux dialog \
+    net-tools dnsutils net-tools iputils-arping iputils-ping telnet \
+    imagemagick ffmpeg fonts-dejavu \
+    clang clang-format lldb lld \
+    build-essential cmake pkg-config libtool automake autoconf binutils cpio mold \
+    debhelper bison flex ninja-build \
+    crossbuild-essential-armhf crossbuild-essential-arm64 \
+    python3 python3-distutils python3-dev python3-pip virtualenv \
+    php-fpm php-mbstring php-json php-xml php-pear php-bcmath php-curl php-zip \
+    php-mysql php-pgsql php-redis php-amqp \
+    php-imagick php-gd \
+    nginx rabbitmq-server redis postgresql mariadb-server
+
+# https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
+RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
+RUN apt update
+ENV GCC_VERSION 12
+RUN apt install -y g++-${GCC_VERSION} g++-${GCC_VERSION}-aarch64-linux-gnu g++-${GCC_VERSION}-arm-linux-gnueabihf
+
+# https://apt.llvm.org/
+ENV CLANG_VERSION=14
+RUN echo "deb [arch=amd64] http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-${CLANG_VERSION} main" > /etc/apt/sources.list.d/llvm.list
+RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
+RUN apt update
+RUN apt install -y clang-${CLANG_VERSION} \
+    clangd-${CLANG_VERSION} clang-tools-${CLANG_VERSION} clang-format-${CLANG_VERSION} \
+    lldb-${CLANG_VERSION} lld-${CLANG_VERSION}
+RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANG_VERSION} 100
+RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${CLANG_VERSION} 100
+RUN update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-${CLANG_VERSION} 100
+RUN update-alternatives --install /usr/bin/lldb lldb /usr/bin/lldb-${CLANG_VERSION} 100
+RUN update-alternatives --install /usr/bin/lld lld /usr/bin/lld-${CLANG_VERSION} 100
+
+# https://www.envoyproxy.io/docs/envoy/latest/start/install#install-envoy-on-ubuntu-linux
+RUN curl -sL 'https://deb.dl.getenvoy.io/public/gpg.8115BA8E629CC074.key' | gpg --dearmor -o /usr/share/keyrings/getenvoy-keyring.gpg
+RUN echo a077cb587a1b622e03aa4bf2f3689de14658a9497a9af2c427bba5f4cc3c4723 /usr/share/keyrings/getenvoy-keyring.gpg | sha256sum --check
+RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/getenvoy-keyring.gpg] https://deb.dl.getenvoy.io/public/deb/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/getenvoy.list
+RUN apt update
+RUN apt install -y getenvoy-envoy
+
+# https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/
+# RUN wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | apt-key add -
+# RUN echo "deb [arch=amd64,arm64] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/6.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list
+# RUN apt update
+# RUN apt install -y mongodb
+
+RUN apt -y autoremove
+RUN apt -y clean
+
+RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
+RUN locale-gen
+RUN update-locale LANG=en_US.UTF-8
+RUN update-alternatives --set editor /usr/bin/vim.basic
+
+RUN mkdir -p $HOME/downloads $HOME/build $HOME/local $HOME/tmp
+
+# https://github.com/ohmyzsh/ohmyzsh
+RUN git clone https://github.com/ohmyzsh/ohmyzsh.git $HOME/.oh-my-zsh
+RUN cp $HOME/.oh-my-zsh/templates/zshrc.zsh-template $HOME/.zshrc
+RUN echo 'source $HOME/.profile' >> $HOME/.zshrc
+RUN echo 'export LANG=en_US.UTF-8' >> $HOME/.profile
+RUN echo 'export LC_ALL=en_US.UTF-8' >> $HOME/.profile
+
+RUN git config --global core.quotepath false
+RUN git config --global http.version HTTP/1.1
+RUN git config --global pull.rebase false
+RUN echo 'set-option -g history-limit 102400' > $HOME/.tmux.conf
+
+RUN sh -c ". $HOME/.profile && pip3 install --user cmake"
+
+RUN sh -c ". $HOME/.profile \
+    && pip3 install --user ansible paramiko"
+RUN echo 'export ANSIBLE_HOST_KEY_CHECKING=False' >> $HOME/.profile
+RUN echo 'export PATH=$HOME/.local/bin:$PATH' >> $HOME/.profile
+RUN echo 'alias peony="ANSIBLE_LOG_PATH=$HOME/tmp/$(date +%Y%m%d%H%M%S).log ansible-playbook"' >> $HOME/.profile
+
+RUN sh -c ". $HOME/.profile \
+    && pip3 install --user conan \
+    && conan profile new default --detect \
+    && conan profile update settings.compiler.libcxx=libstdc++11 default"
+
+RUN sh -c ". $HOME/.profile && pip3 install --user supervisor"
+
+# https://getcomposer.org/doc/00-intro.md#installation-linux-unix-macos
+RUN wget -q -O $HOME/.local/bin/composer https://getcomposer.org/installer
+RUN chmod +x $HOME/.local/bin/composer
+
+ENV BAZEL_VERSION "v1.14.0"
+RUN wget -q -O $HOME/.local/bin/bazel \
+    https://github.com/bazelbuild/bazelisk/releases/download/${BAZEL_VERSION}/bazelisk-linux-amd64
+RUN chmod +x $HOME/.local/bin/bazel
+
+# https://github.com/nvm-sh/nvm
+RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | sh
+RUN sh -c ". $HOME/.profile \
+    && nvm install node \
+    && nvm use node \
+    && npm i yarn -g"
+RUN sh -c ". $HOME/.profile \
+    && nvm install --lts \
+    && nvm use --lts \
+    && npm i yarn -g"
+# https://stackoverflow.com/questions/37324519/node-sass-does-not-yet-support-your-current-environment-linux-64-bit-with-false
+RUN sh -c ". $HOME/.profile \
+    && nvm install lts/fermium \
+    && nvm use lts/fermium \
+    && npm i yarn -g"
+RUN echo 'export PATH=$HOME/.yarn/bin:$PATH' >> $HOME/.profile
+
+ENV JDK_VERSION "19-open"
+RUN curl -s "https://get.sdkman.io" | zsh
+RUN sed -i -e 's/sdkman_auto_answer=false/sdkman_auto_answer=true/g' $HOME/.sdkman/etc/config
+RUN zsh -c "source $HOME/.zshrc \
+    && sdk install java ${JDK_VERSION} \
+    && sdk install maven \
+    && sdk install gradle"
+
+
+# https://github.com/rbenv/rbenv
+RUN git clone https://github.com/rbenv/rbenv.git $HOME/.rbenv
+RUN cd $HOME/.rbenv && src/configure && make -C src
+RUN echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> $HOME/.zshrc
+RUN echo 'eval "$(rbenv init -)"' >> $HOME/.zshrc
+RUN git clone https://github.com/rbenv/ruby-build.git $HOME/.rbenv/plugins/ruby-build
+RUN git clone https://github.com/rbenv/rbenv-vars.git $HOME/.rbenv/plugins/rbenv-vars
+ENV RUBY_VERSION "3.1.2"
+RUN apt install -y libssl-dev
+RUN zsh -c "source $HOME/.zshrc \
+    && rbenv install ${RUBY_VERSION} \
+    && rbenv global ${RUBY_VERSION} \
+    && gem install bundler"
+
+ENV GO_VERSION "1.19.1"
+RUN wget -q -P $HOME/downloads https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz
+RUN tar xf $HOME/downloads/go${GO_VERSION}.linux-amd64.tar.gz -C $HOME/local
+RUN echo 'export GOROOT=$HOME/local/go' >> $HOME/.zshrc
+RUN echo 'export PATH=$GOROOT/bin:$PATH' >> $HOME/.zshrc
+RUN echo 'export GOPATH=$HOME/go' >> $HOME/.zshrc
+
+# https://www.rust-lang.org/tools/install
+RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
+# https://doc.rust-lang.org/nightly/rustc/platform-support.html
+RUN zsh -c "source $HOME/.cargo/env \
+    && rustup component add rust-analyzer \
+    && rustup target add armv7-unknown-linux-gnueabihf \
+    && rustup target add aarch64-unknown-linux-gnu"
+
+# https://github.com/richfelker/musl-cross-make
+RUN git clone https://github.com/richfelker/musl-cross-make.git $HOME/build/musl-cross-make
+RUN cd $HOME/build/musl-cross-make \
+    && echo "TARGET=x86_64-linux-musl" > config.mak \
+    && echo "OUTPUT=/opt/cross" >> config.mak \
+    && make \
+    && make install 
+RUN cd $HOME/build/musl-cross-make \
+    && echo "TARGET=aarch64-linux-musl" > config.mak \
+    && echo "OUTPUT=/opt/cross" >> config.mak \
+    && make \
+    && make install
+RUN cd $HOME/build/musl-cross-make \
+    && echo "TARGET=arm-linux-musleabihf" > config.mak \
+    && echo "OUTPUT=/opt/cross" >> config.mak \
+    && make \
+    && make install
+
+RUN apt install -y libpq-dev libmysqlclient-dev libsqlite3-dev
+RUN zsh -c "source $HOME/.zshrc \
+    && cargo install diesel_cli \
+    && cargo install --locked cargo-outdated \
+    && cargo install mdbook"
+
+ADD conan /opt/conan
+RUN zsh -c "source $HOME/.zshrc && cd /opt/conan && ./install.sh amd64"
+RUN zsh -c "source $HOME/.zshrc && cd /opt/conan && ./install.sh arm64"
+RUN zsh -c "source $HOME/.zshrc && cd /opt/conan && ./install.sh armhf"
+
+ENV GRPC_VERSION "v1.49.1"
+RUN git clone --recurse-submodules -b $GRPC_VERSION https://github.com/grpc/grpc.git $HOME/downloads/grpc
+RUN zsh -c "source $HOME/.zshrc \
+    && mkdir -pv $HOME/build/grpc \
+    && cd $HOME/build/grpc \
+    && cmake -DCMAKE_BUILD_TYPE=Release \
+        -DgRPC_INSTALL=ON \
+        -DgRPC_SSL_PROVIDER=package \
+        -DgRPC_BUILD_TESTS=OFF \
+        -DCMAKE_INSTALL_PREFIX=$HOME/.local $HOME/downloads/grpc \
+    && make -j \
+    && make install"
+# https://github.com/grpc/grpc-web#code-generator-plugin
+ENV GRPC_WEB_PLUGIN_VERSION "1.4.1"
+RUN wget -q -O $HOME/.local/bin/protoc-gen-grpc-web \
+    https://github.com/grpc/grpc-web/releases/download/${GRPC_WEB_PLUGIN_VERSION}/protoc-gen-grpc-web-${GRPC_WEB_PLUGIN_VERSION}-linux-x86_64
+RUN chmod +x $HOME/.local/bin/protoc-gen-grpc-web
+# https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/
+ENV GRPC_JAVA_PLUGIN_VERSION "1.49.1"
+RUN wget -q -O $HOME/.local/bin/grpc_java_plugin \
+    https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/${GRPC_JAVA_PLUGIN_VERSION}/protoc-gen-grpc-java-${GRPC_JAVA_PLUGIN_VERSION}-linux-x86_64.exe
+RUN chmod +x $HOME/.local/bin/grpc_java_plugin
+
+# https://opensearch.org/downloads.html#opensearch
+ENV OPENSEARCH_VERSION "2.3.0"
+RUN wget -q -P $HOME/downloads \
+    https://artifacts.opensearch.org/releases/bundle/opensearch/${OPENSEARCH_VERSION}/opensearch-${OPENSEARCH_VERSION}-linux-x64.tar.gz
+RUN tar xf $HOME/downloads/opensearch-${OPENSEARCH_VERSION}-linux-x64.tar.gz -C /opt
+
+# https://min.io/download#/linux
+RUN wget -q -O /usr/bin/minio \
+    https://dl.min.io/server/minio/release/linux-amd64/minio
+RUN chmod +x /usr/bin/minio
+
+# https://opensearch.org/docs/latest/opensearch/install/tar/
+RUN echo "network.host: 0.0.0.0" >> /opt/opensearch-${OPENSEARCH_VERSION}/config/opensearch.yml
+RUN echo "discovery.type: single-node" >> /opt/opensearch-${OPENSEARCH_VERSION}/config/opensearch.yml
+RUN echo "plugins.security.disabled: true" >> /opt/opensearch-${OPENSEARCH_VERSION}/config/opensearch.yml
+RUN chown -R nobody /opt/opensearch-${OPENSEARCH_VERSION}
+
+RUN mkdir -p /var/lib/minio/data
+RUN chown -R nobody /var/lib/minio
+
+RUN sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/mariadb.conf.d/50-server.cnf
+
+RUN su - postgres -c "/usr/lib/postgresql/14/bin/initdb -D /var/lib/postgresql/data"
+RUN echo "listen_addresses = '0.0.0.0'" >> /var/lib/postgresql/data/postgresql.conf
+
+RUN mkdir -p /var/lib/redis-1 /var/lib/redis-2 /var/lib/redis-3 /var/lib/redis-4 /var/lib/redis-5 /var/lib/redis-6
+ADD etc/redis/* /etc/redis/
+
+RUN mkdir /run/php
+RUN echo "<?php phpinfo(); ?>" > /var/www/html/info.php
+RUN echo "daemon off;" >> /etc/nginx/nginx.conf
+ADD etc/nginx.conf /etc/nginx/sites-enabled/default
+
+ADD etc/envoy.yaml /etc/
+
+ADD etc/supervisor /etc/supervisor
+
+
+RUN echo "$(date -u +%4Y%m%d%H%M%S)" | tee /VERSION
+
+VOLUME /workspace
+WORKDIR /workspace
+
+CMD ["/bin/zsh", "-l"]

+ 57 - 0
docker/jammy/README.md

@@ -0,0 +1,57 @@
+# USAGE
+
+- add to `/etc/sysctl.d/60-my.conf` and then `reboot` or `sysctl -p`
+
+  ```text
+  vm.overcommit_memory = 1
+  vm.max_map_count = 262144
+  ```
+
+- start container [dashboard](http://localhost:10001)
+
+  ```bash
+  $ cd ~/workspace
+  $ ./saturn-xiv/palm/docker/jammy/start.sh
+  > supervisord -c /etc/supervisor/supervisord.conf
+  # init redis cluster
+  > /etc/redis/clusters-init.sh
+  ```
+
+- PostgreSql
+
+  ```bash
+  psql -h 127.0.0.1 -p 5432 -U postgres
+  ```
+
+- MySql
+
+  ```bash
+  # reset root's password
+  mysql_secure_installation
+  ```
+
+- Redis
+
+  ```bash
+  # connect to redis node-1
+  redis-cli -c -h 127.0.0.1 -p 16371
+  ```
+
+- Minio [dashboard](http://localhost:9001) (`admin:12345678`)
+
+- RabbitMQ [dashboard](http://localhost:15672) (`guest:guest`)
+
+  ```bash
+  # enable rabbitmq management plugin
+  rabbitmq-plugins enable rabbitmq_management
+  ```
+
+- Php [info.php](http://localhost:8080/info.php)
+
+- OpenSearch
+
+  ```bash
+  # show info
+  curl -X GET http://localhost:9200
+  curl -X GET http://localhost:9200/_cat/plugins?v
+  ```

+ 16 - 0
docker/jammy/build.sh

@@ -0,0 +1,16 @@
+#!/bin/bash
+
+set -e
+
+export VERSION=$(date "+%4Y%m%d%H%M%S")
+export CODE="palm-jammy"
+
+buildah pull ubuntu:jammy
+buildah bud --layers -t $CODE .
+podman save -o $CODE-$VERSION.tar $CODE
+XZ_OPT=-9 tar -cJf - $CODE-$VERSION.tar | split -d -b 1G - $CODE-$VERSION.tar.xz.
+md5sum $CODE-$VERSION.tar* > md5.txt
+
+echo "done($CODE-$VERSION.tar.xz)."
+
+exit 0

+ 48 - 0
docker/jammy/conan/conanfile.txt

@@ -0,0 +1,48 @@
+[requires]
+libxcrypt/4.4.28
+libcurl/7.85.0
+openssl/1.1.1q
+boost/1.80.0
+cpp-httplib/0.11.2
+cpr/1.9.0
+nlohmann_json/3.11.2
+inja/3.3.0
+tomlplusplus/3.2.0
+yaml-cpp/0.7.0
+cppcodec/0.2
+libpq/14.2
+libpqxx/7.7.4
+# libmysqlclient/8.0.17
+mariadb-connector-c/3.1.12
+sqlite3/3.39.3
+sqlitecpp/3.2.0
+soci/4.0.3
+mongo-cxx-driver/3.6.7
+redis-plus-plus/1.3.3
+rabbitmq-c/0.11.0
+amqp-cpp/4.3.16
+zmqpp/4.2.0
+paho-mqtt-cpp/1.2.0
+libgit2/1.5.0
+libssh2/1.10.0
+# libpng/1.6.37
+serial/1.2.1
+# net-snmp/5.9.1
+# imgui/1.88
+flatbuffers/2.0.6
+protobuf/3.21.4
+grpc/1.48.0 
+
+[options]
+zeromq:encryption=None
+sqlite3:build_executable=False
+soci:with_sqlite3=True
+# soci:with_mysql=True
+soci:with_postgresql=True
+soci:with_boost=True
+boost:without_stacktrace=True
+boost:without_python=True
+
+[generators]
+cmake
+cmake_find_package

+ 26 - 0
docker/jammy/conan/install.sh

@@ -0,0 +1,26 @@
+#!/bin/bash
+
+set -e
+
+. /etc/os-release
+export WORKSPACE=$PWD
+
+if [ "$#" -ne 1 ]
+then
+    echo "USAGE: $0 PROFILE"
+    exit 1
+fi
+
+export TARGET=$HOME/build/conan-$1
+
+if [ -d $TARGET ]
+then
+    rm -r $TARGET
+fi
+mkdir -p $TARGET
+cd $TARGET
+conan install --build=missing --profile:build=default --profile:host=$WORKSPACE/profiles/$1 $WORKSPACE
+
+echo "done($1)."
+
+exit 0

+ 18 - 0
docker/jammy/conan/profiles/amd64

@@ -0,0 +1,18 @@
+target=x86_64-linux-gnu
+clang_version=14
+
+[settings]
+os=Linux
+arch=x86_64
+compiler=clang
+compiler.version=$clang_version
+compiler.libcxx=libstdc++11
+compiler.cppstd=20
+build_type=Release
+
+[env]
+CC=clang-$clang_version
+CXX=clang++-$clang_version
+CFLAGS="-target $target"
+CXXFLAGS="-target $target"
+LDFLAGS="--ld-path=mold"

+ 34 - 0
docker/jammy/conan/profiles/arm64

@@ -0,0 +1,34 @@
+target=aarch64-linux-gnu
+gcc_version=12
+clang_version=14
+
+[settings]
+os=Linux
+arch=armv8
+compiler=clang
+compiler.version=$clang_version
+compiler.libcxx=libstdc++11
+compiler.cppstd=20
+build_type=Release
+
+boost:compiler=gcc
+boost:compiler.cppstd=11
+boost:compiler.version=$gcc_version
+boost:compiler.libcxx=libstdc++11
+
+[env]
+CHOST=$target
+CC=clang-$clang_version
+CXX=clang++-$clang_version
+CFLAGS="-target $target -ccc-gcc-name $target-gcc-$gcc_version"
+CXXFLAGS="-target $target -ccc-gcc-name $target-gcc-$gcc_version"
+LDFLAGS="--ld-path=ld.lld-$clang_version"
+
+boost:CC=$target-gcc-$gcc_version
+boost:CXX=$target-g++-$gcc_version
+boost:CFLAGS=""
+boost:CXXFLAGS=""
+boost:LDFLAGS=""
+
+[options]
+libpng:neon=False

+ 34 - 0
docker/jammy/conan/profiles/armhf

@@ -0,0 +1,34 @@
+target=arm-linux-gnueabihf
+gcc_version=12
+clang_version=14
+
+[settings]
+os=Linux
+arch=armv7hf
+compiler=clang
+compiler.version=$clang_version
+compiler.libcxx=libstdc++11
+compiler.cppstd=20
+build_type=Release
+
+boost:compiler=gcc
+boost:compiler.cppstd=11
+boost:compiler.version=$gcc_version
+boost:compiler.libcxx=libstdc++11
+
+[env]
+CHOST=$target
+CC=clang-$clang_version
+CXX=clang++-$clang_version
+CFLAGS="-target $target -ccc-gcc-name $target-gcc-$gcc_version"
+CXXFLAGS="-target $target -ccc-gcc-name $target-gcc-$gcc_version"
+LDFLAGS="--ld-path=ld.lld-$clang_version"
+
+boost:CC=$target-gcc-$gcc_version
+boost:CXX=$target-g++-$gcc_version
+boost:CFLAGS=""
+boost:CXXFLAGS=""
+boost:LDFLAGS=""
+
+[options]
+libpng:neon=False

+ 12 - 0
docker/jammy/conan/toolchains/amd64.cmake

@@ -0,0 +1,12 @@
+set(CMAKE_SYSTEM_NAME Linux)
+set(CMAKE_SYSTEM_PROCESSOR x86_64)
+
+set(target x86_64-linux-gnu)
+set(clang_version 14)
+
+set(CMAKE_C_COMPILER clang-${clang_version})
+set(CMAKE_C_COMPILER_TARGET ${target})
+set(CMAKE_CXX_COMPILER clang++-${clang_version})
+set(CMAKE_CXX_COMPILER_TARGET ${target})
+set(CMAKE_CXX_FLAGS "-stdlib=libstdc++")
+set(CMAKE_EXE_LINKER_FLAGS "--ld-path=mold -Wl,--build-id=sha1")

+ 18 - 0
docker/jammy/conan/toolchains/arm64.cmake

@@ -0,0 +1,18 @@
+set(CMAKE_SYSTEM_NAME Linux)
+set(CMAKE_SYSTEM_PROCESSOR aarch64)
+
+set(target aarch64-linux-gnu)
+set(gcc_version 12)
+set(clang_version 14)
+
+set(CMAKE_C_COMPILER clang-${clang_version})
+set(CMAKE_C_COMPILER_TARGET ${target})
+set(CMAKE_CXX_COMPILER clang++-${clang_version})
+set(CMAKE_CXX_COMPILER_TARGET ${target})
+set(CMAKE_C_FLAGS "-ccc-gcc-name ${target}-gcc-${gcc_version}")
+set(CMAKE_CXX_FLAGS "-stdlib=libstdc++ -ccc-gcc-name ${target}-gcc-${gcc_version}")
+set(CMAKE_EXE_LINKER_FLAGS "--ld-path=ld.lld-${clang_version} -Wl,--build-id=sha1")
+
+set(CMAKE_FIND_ROOT_PATH /usr/${target})
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+

+ 17 - 0
docker/jammy/conan/toolchains/armhf.cmake

@@ -0,0 +1,17 @@
+set(CMAKE_SYSTEM_NAME Linux)
+set(CMAKE_SYSTEM_PROCESSOR armv7l)
+
+set(target arm-linux-gnueabihf)
+set(gcc_version 12)
+set(clang_version 14)
+
+set(CMAKE_C_COMPILER clang-${clang_version})
+set(CMAKE_C_COMPILER_TARGET ${target})
+set(CMAKE_CXX_COMPILER clang++-${clang_version})
+set(CMAKE_CXX_COMPILER_TARGET ${target})
+set(CMAKE_C_FLAGS "-ccc-gcc-name ${target}-gcc-${gcc_version}")
+set(CMAKE_CXX_FLAGS "-stdlib=libstdc++ -ccc-gcc-name ${target}-gcc-${gcc_version}")
+set(CMAKE_EXE_LINKER_FLAGS "--ld-path=ld.lld-${clang_version} -Wl,--build-id=sha1")
+
+set(CMAKE_FIND_ROOT_PATH /usr/${target})
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

+ 61 - 0
docker/jammy/etc/envoy.yaml

@@ -0,0 +1,61 @@
+admin:
+  access_log_path: /tmp/admin_access.log
+  address:
+    socket_address: { address: 127.0.0.1, port_value: 9901 }
+
+static_resources:
+  listeners:
+    - name: listener_0
+      address:
+        socket_address: { address: 0.0.0.0, port_value: 9090 }
+      filter_chains:
+        - filters:
+            - name: envoy.filters.network.http_connection_manager
+              typed_config:
+                "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
+                codec_type: auto
+                stat_prefix: ingress_http
+                route_config:
+                  name: local_route
+                  virtual_hosts:
+                    - name: local_service
+                      domains: ["*"]
+                      routes:
+                        - match: { prefix: "/" }
+                          route:
+                            cluster: echo_service
+                            timeout: 0s
+                            max_stream_duration:
+                              grpc_timeout_header_max: 0s
+                      cors:
+                        allow_origin_string_match:
+                          - prefix: "*"
+                        allow_methods: GET, PUT, DELETE, POST, OPTIONS
+                        allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout
+                        max_age: "1728000"
+                        expose_headers: custom-header-1,grpc-status,grpc-message
+                http_filters:
+                  - name: envoy.filters.http.grpc_web
+                    typed_config:
+                      "@type": type.googleapis.com/envoy.extensions.filters.http.grpc_web.v3.GrpcWeb
+                  - name: envoy.filters.http.cors
+                    typed_config:
+                      "@type": type.googleapis.com/envoy.extensions.filters.http.cors.v3.Cors
+                  - name: envoy.filters.http.router
+                    typed_config:
+                      "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
+  clusters:
+    - name: echo_service
+      connect_timeout: 0.25s
+      type: logical_dns
+      http2_protocol_options: {}
+      lb_policy: round_robin
+      load_assignment:
+        cluster_name: cluster_0
+        endpoints:
+          - lb_endpoints:
+              - endpoint:
+                  address:
+                    socket_address:
+                      address: node-server
+                      port_value: 11111

+ 15 - 0
docker/jammy/etc/nginx.conf

@@ -0,0 +1,15 @@
+server {
+    listen 8080;
+    server_name _;
+    index index.html index.php;
+    root /var/www/html;
+
+    location / {
+        try_files $uri $uri/ =404;
+    }
+
+    location ~ \.php$ {
+        include snippets/fastcgi-php.conf;
+        fastcgi_pass unix:/run/php/php8.1-fpm.sock;
+    }
+}

+ 3 - 0
docker/jammy/etc/redis/clusters-init.sh

@@ -0,0 +1,3 @@
+#!/bin/sh
+
+redis-cli --cluster create 127.0.0.1:16371 127.0.0.1:16372 127.0.0.1:16373 127.0.0.1:16374 127.0.0.1:16375 127.0.0.1:16376

+ 11 - 0
docker/jammy/etc/redis/node-1.conf

@@ -0,0 +1,11 @@
+bind 0.0.0.0
+port 16371
+daemonize no
+dir /var/lib/redis-1
+
+cluster-enabled yes
+cluster-config-file /tmp/redis-node-1.conf
+cluster-node-timeout 5000
+
+appendonly yes
+appendfsync everysec

+ 11 - 0
docker/jammy/etc/redis/node-2.conf

@@ -0,0 +1,11 @@
+bind 0.0.0.0
+port 16372
+daemonize no
+dir /var/lib/redis-2
+
+cluster-enabled yes
+cluster-config-file /tmp/redis-node-2.conf
+cluster-node-timeout 5000
+
+appendonly yes
+appendfsync everysec

+ 11 - 0
docker/jammy/etc/redis/node-3.conf

@@ -0,0 +1,11 @@
+bind 0.0.0.0
+port 16373
+daemonize no
+dir /var/lib/redis-3
+
+cluster-enabled yes
+cluster-config-file /tmp/redis-node-3.conf
+cluster-node-timeout 5000
+
+appendonly yes
+appendfsync everysec

+ 11 - 0
docker/jammy/etc/redis/node-4.conf

@@ -0,0 +1,11 @@
+bind 0.0.0.0
+port 16374
+daemonize no
+dir /var/lib/redis-4
+
+cluster-enabled yes
+cluster-config-file /tmp/redis-node-4.conf
+cluster-node-timeout 5000
+
+appendonly yes
+appendfsync everysec

+ 11 - 0
docker/jammy/etc/redis/node-5.conf

@@ -0,0 +1,11 @@
+bind 0.0.0.0
+port 16375
+daemonize no
+dir /var/lib/redis-5
+
+cluster-enabled yes
+cluster-config-file /tmp/redis-node-5.conf
+cluster-node-timeout 5000
+
+appendonly yes
+appendfsync everysec

+ 11 - 0
docker/jammy/etc/redis/node-6.conf

@@ -0,0 +1,11 @@
+bind 0.0.0.0
+port 16376
+daemonize no
+dir /var/lib/redis-6
+
+cluster-enabled yes
+cluster-config-file /tmp/redis-node-6.conf
+cluster-node-timeout 5000
+
+appendonly yes
+appendfsync everysec

+ 5 - 0
docker/jammy/etc/supervisor/conf.d/envoy.conf

@@ -0,0 +1,5 @@
+[program:envoy]
+command=/usr/bin/envoy -c /etc/envoy.yaml -l debug
+autostart=true
+autorestart=true
+user=root

+ 7 - 0
docker/jammy/etc/supervisor/conf.d/minio.conf

@@ -0,0 +1,7 @@
+[program:minio]
+command=/usr/bin/minio server data
+autostart=true
+autorestart=true
+user=nobody
+directory=/var/lib/minio
+environment=MINIO_ADDRESS="0.0.0.0:9000",MINIO_CONSOLE_ADDRESS="0.0.0.0:9001",MINIO_ROOT_USER="admin",MINIO_ROOT_PASSWORD="12345678"

+ 5 - 0
docker/jammy/etc/supervisor/conf.d/mysql.conf

@@ -0,0 +1,5 @@
+[program:mysql]
+command=/usr/bin/mysqld_safe --user=mysql
+autostart=true
+autorestart=true
+user=root

+ 5 - 0
docker/jammy/etc/supervisor/conf.d/nginx.conf

@@ -0,0 +1,5 @@
+[program:nginx]
+command=/usr/sbin/nginx
+autostart=true
+autorestart=true
+user=root

+ 7 - 0
docker/jammy/etc/supervisor/conf.d/opensearch.conf

@@ -0,0 +1,7 @@
+[program:opensearch]
+command=/opt/opensearch-2.3.0/bin/opensearch
+autostart=true
+autorestart=true
+user=nobody
+directory=/opt/opensearch-2.3.0
+environment=OPENSEARCH_JAVA_HOME="/opt/opensearch-2.3.0/jdk"

+ 5 - 0
docker/jammy/etc/supervisor/conf.d/php-fpm.conf

@@ -0,0 +1,5 @@
+[program:php-fpm8.1]
+command=/usr/sbin/php-fpm8.1 --nodaemonize --fpm-config /etc/php/8.1/fpm/php-fpm.conf
+autostart=true
+autorestart=true
+user=root

+ 5 - 0
docker/jammy/etc/supervisor/conf.d/postgresql.conf

@@ -0,0 +1,5 @@
+[program:postgresql]
+command=/usr/lib/postgresql/14/bin/postgres -D /var/lib/postgresql/data
+autostart=true
+autorestart=true
+user=postgres

+ 5 - 0
docker/jammy/etc/supervisor/conf.d/rabbitmq.conf

@@ -0,0 +1,5 @@
+[program:rabbitmq]
+command=/usr/sbin/rabbitmq-server
+autostart=true
+autorestart=true
+user=root

+ 37 - 0
docker/jammy/etc/supervisor/conf.d/redis.conf

@@ -0,0 +1,37 @@
+[program:redis-1]
+command=/usr/bin/redis-server /etc/redis/node-1.conf
+autostart=true
+autorestart=true
+user=root
+
+[program:redis-2]
+command=/usr/bin/redis-server /etc/redis/node-2.conf
+autostart=true
+autorestart=true
+user=root
+
+[program:redis-3]
+command=/usr/bin/redis-server /etc/redis/node-3.conf
+autostart=true
+autorestart=true
+user=root
+
+[program:redis-4]
+command=/usr/bin/redis-server /etc/redis/node-4.conf
+autostart=true
+autorestart=true
+user=root
+
+[program:redis-5]
+command=/usr/bin/redis-server /etc/redis/node-5.conf
+autostart=true
+autorestart=true
+user=root
+
+[program:redis-6]
+command=/usr/bin/redis-server /etc/redis/node-6.conf
+autostart=true
+autorestart=true
+user=root
+
+

+ 14 - 0
docker/jammy/etc/supervisor/supervisord.conf

@@ -0,0 +1,14 @@
+[inet_http_server]         
+port=127.0.0.1:10001     
+
+[supervisord]
+logfile=/var/log/supervisord.log                 
+pidfile=/tmp/supervisord.pid 
+loglevel=debug
+user=root
+
+[supervisorctl]
+serverurl=unix:///tmp/supervisor.sock 
+
+[include]
+files = conf.d/*.conf

+ 11 - 0
docker/jammy/start.sh

@@ -0,0 +1,11 @@
+#!/bin/sh
+
+export CODE="palm-jammy"
+export NAME="$CODE-$USER"
+
+if podman container exists $NAME
+then
+    podman start -i -a $NAME
+else
+    podman run --name $NAME -it --events-backend=file --hostname=palm --network host -v $PWD:/workspace:z $CODE
+fi