Explorar el Código

:memo: add github desktop & fix domain name desc

Jeremy Zheng hace 3 años
padre
commit
5da78b557c

+ 2 - 1
docker/alpine/Dockerfile

@@ -3,7 +3,8 @@ LABEL maintainer="Jeremy Zheng"
 
 RUN apk update
 RUN apk upgrade
-RUN apk add vim curl bash zsh pwgen openssl git tmux rsync openssh-client \
+RUN apk add vim curl bash zsh pwgen openssl git tmux rsync \
+    openssh-client sshpass \
     build-base cmake git \
     python3 py3-pip python3-dev \
     openssl-dev 

+ 5 - 0
docker/envoy/Dockerfile

@@ -0,0 +1,5 @@
+FROM docker.io/envoyproxy/envoy:v1.23-latest
+LABEL maintainer="Jeremy Zheng"
+
+COPY envoy.yaml /etc/envoy/envoy.yaml
+RUN chmod go+r /etc/envoy/envoy.yaml

+ 15 - 0
docker/envoy/build.sh

@@ -0,0 +1,15 @@
+#!/bin/bash
+
+set -e
+
+export VERSION=$(date "+%4Y%m%d%H%M%S")
+export CODE="palm-envoy"
+
+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

+ 0 - 0
docker/envoy/envoy.yaml


+ 6 - 0
docker/envoy/start.sh

@@ -0,0 +1,6 @@
+#!/bin/bash
+
+export CODE="palm-envoy"
+export NAME="$CODE-$USER"
+
+podman run -rm --events-backend=file --hostname=palm --network host $CODE

+ 71 - 55
docker/jammy/Dockerfile

@@ -22,14 +22,14 @@ 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 \
+    imagemagick ffmpeg fonts-dejavu-extra \
     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-mysql php-pgsql php-sqlite3 php-redis php-mongodb php-amqp php-zmq \
     php-imagick php-gd \
     nginx rabbitmq-server redis postgresql mariadb-server
 
@@ -62,7 +62,7 @@ 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 echo "deb [arch=amd64] 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
 
@@ -104,40 +104,34 @@ RUN sh -c ". $HOME/.profile \
 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
+RUN wget -q -O $HOME/downloads/composer https://getcomposer.org/installer
+RUN cd $HOME/downloads \
+    && php composer \
+    && mv composer.phar $HOME/.local/bin/composer
+
+# 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/crosstools" >> config.mak \
+    && make \
+    && make install 
+RUN cd $HOME/build/musl-cross-make \
+    && echo "TARGET=aarch64-linux-musl" > config.mak \
+    && echo "OUTPUT=/opt/crosstools" >> config.mak \
+    && make \
+    && make install
+RUN cd $HOME/build/musl-cross-make \
+    && echo "TARGET=arm-linux-musleabihf" > config.mak \
+    && echo "OUTPUT=/opt/crosstools" >> config.mak \
+    && make \
+    && make install
 
 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
@@ -152,13 +146,38 @@ RUN zsh -c "source $HOME/.zshrc \
     && rbenv global ${RUBY_VERSION} \
     && gem install bundler"
 
-ENV GO_VERSION "1.19.1"
+ENV GO_VERSION "1.19.2"
 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
 
+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/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
+
 # 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
@@ -167,23 +186,6 @@ RUN zsh -c "source $HOME/.cargo/env \
     && 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 \
@@ -208,16 +210,27 @@ RUN zsh -c "source $HOME/.zshrc \
         -DCMAKE_INSTALL_PREFIX=$HOME/.local $HOME/downloads/grpc \
     && make -j \
     && make install"
+
+# https://github.com/protocolbuffers/protobuf-javascript
+ENV GRPC_JS_PLUGIN_VERSION "3.21.2"
+RUN wget -P $HOME/downloads \
+    https://github.com/protocolbuffers/protobuf-javascript/releases/download/v${GRPC_JS_PLUGIN_VERSION}/protobuf-javascript-${GRPC_JS_PLUGIN_VERSION}-linux-x86_64.tar.gz
+RUN mkdir -p $HOME/build/protobuf-javascript \
+    cd $HOME/build/protobuf-javascript \
+    && tar xf $HOME/downloads/protobuf-javascript-${GRPC_JS_PLUGIN_VERSION}-linux-x86_64.tar.gz \
+    && cp bin/protoc-gen-js $HOME/.local/bin/
+
+# https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/
+ENV GRPC_JAVA_PLUGIN_VERSION "1.50.0"
+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://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"
@@ -244,7 +257,10 @@ 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
+RUN cd /var/lib \
+    && mkdir redis-s redis-1 redis-2 redis-3 redis-4 redis-5 redis-6 \
+    && chown redis:redis redis-s redis-1 redis-2 redis-3 redis-4 redis-5 redis-6 \
+    && chmod 750 redis-s redis-1 redis-2 redis-3 redis-4 redis-5 redis-6
 ADD etc/redis/* /etc/redis/
 
 RUN mkdir /run/php

+ 6 - 1
docker/jammy/etc/redis/clusters-init.sh

@@ -1,3 +1,8 @@
 #!/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
+set -e
+
+redis-cli --cluster create 127.0.0.1:6371 127.0.0.1:6372 127.0.0.1:6373 127.0.0.1:6374 127.0.0.1:6375 127.0.0.1:6376
+
+echo 'done.'
+exit 0

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

@@ -1,5 +1,5 @@
 bind 0.0.0.0
-port 16371
+port 6371
 daemonize no
 dir /var/lib/redis-1
 

+ 1 - 1
docker/jammy/etc/redis/node-2.conf

@@ -1,5 +1,5 @@
 bind 0.0.0.0
-port 16372
+port 6372
 daemonize no
 dir /var/lib/redis-2
 

+ 1 - 1
docker/jammy/etc/redis/node-3.conf

@@ -1,5 +1,5 @@
 bind 0.0.0.0
-port 16373
+port 6373
 daemonize no
 dir /var/lib/redis-3
 

+ 1 - 1
docker/jammy/etc/redis/node-4.conf

@@ -1,5 +1,5 @@
 bind 0.0.0.0
-port 16374
+port 6374
 daemonize no
 dir /var/lib/redis-4
 

+ 1 - 1
docker/jammy/etc/redis/node-5.conf

@@ -1,5 +1,5 @@
 bind 0.0.0.0
-port 16375
+port 6375
 daemonize no
 dir /var/lib/redis-5
 

+ 1 - 1
docker/jammy/etc/redis/node-6.conf

@@ -1,5 +1,5 @@
 bind 0.0.0.0
-port 16376
+port 6376
 daemonize no
 dir /var/lib/redis-6
 

+ 7 - 0
docker/jammy/etc/redis/node-s.conf

@@ -0,0 +1,7 @@
+bind 0.0.0.0
+port 6379
+daemonize no
+dir /var/lib/redis-s
+
+appendonly yes
+appendfsync everysec

+ 12 - 6
docker/jammy/etc/supervisor/conf.d/redis.conf

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

+ 6 - 1
docker/jammy/start.sh

@@ -7,5 +7,10 @@ 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
+    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