diff --git a/.gitignore b/.gitignore index 655a719..024a24d 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,5 @@ target Cargo.lock .idea target -*.csv \ No newline at end of file +*.csv +/spring-data-examples diff --git a/backend_java/.github/workflows/frontend_spa.yml b/backend_java/.github/workflows/frontend_spa.yml new file mode 100644 index 0000000..899361c --- /dev/null +++ b/backend_java/.github/workflows/frontend_spa.yml @@ -0,0 +1,102 @@ +# https://developer.okta.com/blog/2022/04/22/github-actions-graalvm +name: Native CI +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * *' +permissions: + contents: read +jobs: + pipeline: + name: flickr2 native pipeline + runs-on: ${{ matrix.os }} + if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.pull_request.title, '[skip ci]') && !contains(github.event.pull_request.title, '[ci skip]')" + timeout-minutes: 90 + env: + SPRING_OUTPUT_ANSI_ENABLED: DETECT + SPRING_JPA_SHOW_SQL: false + JHI_DISABLE_WEBPACK_LOGS: true + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-2019] + graalvm-version: ['22.0.0.2'] + java-version: ['11'] + include: + - os: ubuntu-latest + executable-suffix: '' + native-build-args: --verbose -J-Xmx10g + - os: macos-latest + executable-suffix: '' + native-build-args: --verbose -J-Xmx13g + - os: windows-2019 + executable-suffix: '.exe' + # e2e is disabled due to unstable docker step + e2e: false + native-build-args: --verbose -J-Xmx10g + steps: + # OS customizations that allow the builds to succeed on Linux and Windows. + # Using hash for better security due to third party actions. + - name: Set up swap space + if: runner.os == 'Linux' + # v1.0 (49819abfb41bd9b44fb781159c033dba90353a7c) + uses: pierotofy/set-swap-space@49819abfb41bd9b44fb781159c033dba90353a7c + with: + swap-size-gb: 10 + - name: + Configure pagefile + # v1.2 (7e234852c937eea04d6ee627c599fb24a5bfffee) + uses: al-cheb/configure-pagefile-action@7e234852c937eea04d6ee627c599fb24a5bfffee + if: runner.os == 'Windows' + with: + minimum-size: 10GB + maximum-size: 12GB + - name: Set up pagefile + if: runner.os == 'Windows' + run: | + (Get-CimInstance Win32_PageFileUsage).AllocatedBaseSize + shell: pwsh + - name: 'SETUP: docker' + run: | + HOMEBREW_NO_AUTO_UPDATE=1 brew install --cask docker + sudo /Applications/Docker.app/Contents/MacOS/Docker --unattended --install-privileged-components + open -a /Applications/Docker.app --args --unattended --accept-license + #echo "We are waiting for Docker to be up and running. It can take over 2 minutes..." + #while ! /Applications/Docker.app/Contents/Resources/bin/docker info &>/dev/null; do sleep 1; done + if: runner.os == 'macOS' + + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.14.0 + - name: Set up GraalVM (Java ${{ matrix.java-version }}) + uses: graalvm/setup-graalvm@v1 + with: + version: '${{ matrix.graalvm-version }}' + java-version: '${{ matrix.java-version }}' + components: 'native-image' + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Cache Maven dependencies + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-maven + - name: Cache npm dependencies + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + - name: Install node.js packages + run: npm install + - name: 'E2E: Package' + run: npm run native-package -- -B -ntp "-Dnative-build-args=${{ matrix.native-build-args }}" + - name: 'E2E: Prepare' + if: matrix.e2e != false + run: npm run ci:e2e:prepare + - name: 'E2E: Run' + if: matrix.e2e != false + run: npm run native-e2e \ No newline at end of file diff --git a/backend_java/.github/workflows/golang_cli.yml b/backend_java/.github/workflows/golang_cli.yml new file mode 100644 index 0000000..ece22ab --- /dev/null +++ b/backend_java/.github/workflows/golang_cli.yml @@ -0,0 +1,33 @@ +# on: [push] +# name: test-docker + +on: + push: + branches: [ develop ] + pull_request: + branches: [ develop ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + file: ./Dockerfile_Github + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/rust_template:latest \ No newline at end of file diff --git a/backend_java/.github/workflows/java.yml b/backend_java/.github/workflows/java.yml new file mode 100644 index 0000000..dd53b2b --- /dev/null +++ b/backend_java/.github/workflows/java.yml @@ -0,0 +1,33 @@ +# https://github.com/marketplace/actions/github-action-for-graalvm +name: GraalVM Native Image builds +on: [push, pull_request] +jobs: + build: + name: FoodTrucksBackend on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, windows-latest, ubuntu-latest] + steps: + - uses: actions/checkout@v4 + - uses: graalvm/setup-graalvm@v1 + with: + java-version: '21' + distribution: 'graalvm' + github-token: ${{ secrets.GITHUB_TOKEN }} + native-image-job-reports: 'true' + - name: Step Show Envs + run: | + echo "GRAALVM_HOME: $GRAALVM_HOME" + echo "JAVA_HOME: $JAVA_HOME" + java --version + native-image --version + - name: Example step using Maven plugin # https://graalvm.github.io/native-build-tools/latest/maven-plugin.html + run: mvn -Pnative package +# - name: Example step using Gradle plugin # https://graalvm.github.io/native-build-tools/latest/gradle-plugin.html +# run: gradlew nativeCompile + - name: Upload binary + uses: actions/upload-artifact@v2 + with: + name: foodTruck-${{ matrix.os }} + path: foodTruck* \ No newline at end of file diff --git a/backend_java/.github/workflows/rust_cli.yml b/backend_java/.github/workflows/rust_cli.yml new file mode 100644 index 0000000..071ae14 --- /dev/null +++ b/backend_java/.github/workflows/rust_cli.yml @@ -0,0 +1,33 @@ +# on: [push] +# name: test-docker + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v4 + - + name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + file: ./Dockerfile_Github + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/rust_template:latest \ No newline at end of file diff --git a/backend_java/.gitignore b/backend_java/.gitignore index fedd5ce..1c48696 100644 --- a/backend_java/.gitignore +++ b/backend_java/.gitignore @@ -32,4 +32,7 @@ build/ ### VS Code ### .vscode/ target -meilisearch-react-demo \ No newline at end of file +meilisearch-react-demo + + +todo.md \ No newline at end of file diff --git a/backend_java/DockerfilePythonBase b/backend_java/DockerfilePythonBase new file mode 100644 index 0000000..92999da --- /dev/null +++ b/backend_java/DockerfilePythonBase @@ -0,0 +1,27 @@ +FROM gakaki/base + +RUN apt-get install -y wget bzip2 +RUN wget https://repo.anaconda.com/archive/Anaconda3-2023.09-0-Linux-x86_64.sh +RUN bash Anaconda3-2023.09-0-Linux-x86_64.sh -b +RUN rm Anaconda3-5.0.1-Linux-x86_64.sh +ENV PATH /root/anaconda3/bin:$PATH + +RUN conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/ \ +&& conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/ \ +&& conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/ \ +&& conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/ \ +&& conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/ \ +&& conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/ \ +&& conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/ + +RUN conda update conda +RUN conda update anaconda +RUN conda update --all + +RUN mkdir /opt/notebooks +RUN jupyter notebook --generate-config --allow-root +RUN echo "c.NotebookApp.password = u'sha1:6a3f528eec40:6e896b6e4828f525a6e20e5411cd1c8075d68619'" >> /root/.jupyter/jupyter_notebook_config.py + +EXPOSE 8888 + +CMD ["jupyter", "notebook", "--allow-root", "--notebook-dir=/opt/notebooks", "--ip='*'", "--port=8888", "--no-browser"] \ No newline at end of file diff --git a/backend_java/DockerfileUbuntuBase b/backend_java/DockerfileUbuntuBase new file mode 100644 index 0000000..b906cef --- /dev/null +++ b/backend_java/DockerfileUbuntuBase @@ -0,0 +1,44 @@ +FROM ubuntu:latest +# ubuntu 安装 php 依赖 +# ubuntu 安装 python 依赖 +# Docker 时区调整方案 + +RUN sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list \ +&& sed -i 's/cn.archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list \ +&& sed -i 's/security.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list \ +&& sed -i 's/ports.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list + +## locales +RUN apt-get update -y && apt upgrade -y && apt-get dist-upgrade -y && apt-get install -y tzdata locales && rm -rf /var/lib/apt/lists/* \ + && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 +ENV LANG en_US.utf8 +# Docker 时区调整方案 +## timezone +ENV TZ=Asia/Shanghai \ + DEBIAN_FRONTEND=noninteractive + +RUN apt-get install -y tzdata \ + && ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime \ + && echo ${TZ} > /etc/timezone \ + && dpkg-reconfigure --frontend noninteractive tzdata \ + && rm -rf /var/lib/apt/lists/* + +RUN apt-get update -y && apt-get install -y build-essential \ + automake git make bison flex gcc patch autoconf subversion locate vim \ + libncursesw5-dev libgdbm-dev libc6-dev \ + libsqlite3-dev tk-dev \ + libssl-dev openssl libcurl4-openssl-dev \ + libffi-dev \ + libxpm-dev libxext-dev \ + zlib1g-dev libbz2-dev libssl-dev libncurses5-dev libsqlite3-dev \ + libreadline-dev tk-dev libgdbm-dev libdb-dev libpcap-dev xz-utils libexpat1-dev \ + liblzma-dev libffi-dev libc6-dev \ + libxml2-dev libpcre3-dev \ + libjpeg-dev libpng-dev libmhash-dev libmhash2 \ + libmcrypt-dev libxslt1-dev \ + libpq-dev libpq5 \ + libglib2.0-0 +# glib2.0 not find in current ubunt docer latest +CMD ["/bin/bash"] + + diff --git a/backend_java/README.md b/backend_java/README.md index 9149e66..b7ca422 100644 --- a/backend_java/README.md +++ b/backend_java/README.md @@ -1,6 +1,20 @@ -## -redission 配置 -redisson常用配置 +## Docker-Compose 使用 +### 设置 mac orbstack docker hub镜像加速 +来自[阿里云](https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors) +{ +"registry-mirrors": ["https://xi1udf2u.mirror.aliyuncs.com"] +} +### +docker-compose up -d + + +## GitHub Action for GraalVM and Maven Dependencies Cache + + + + +## Redis库 Redission 配置 + https://github.com/redisson/redisson/wiki/2.-%E9%85%8D%E7%BD%AE%E6%96%B9%E6%B3%95#23-%E5%B8%B8%E7%94%A8%E8%AE%BE%E7%BD%AE ## csv show diff --git a/backend_java/docker-compose.yml b/backend_java/docker-compose.yml index c32f947..d5e004c 100644 --- a/backend_java/docker-compose.yml +++ b/backend_java/docker-compose.yml @@ -1,16 +1,58 @@ +# https://docs.docker.com/compose/compose-file/compose-file-v3/ +# docker-compose build --no-cache --progress=plain app services: +# base: +# platform: linux/x86_64 +# image: gakaki/base +## restart: on-failure +# container_name: base +# environment: +# TZ: Asia/Shanghai +# build: +# context: . +# dockerfile: DockerfileUbuntuBase +# args: +# progress: plain +## entrypoint: [ "/bin/sh","-c" ] +# tty: true +# stdin_open: true +## command: +## - | +## echo a +## echo b +## echo c +# +## docker-compose build --no-cache base +## docker-compose up -d base +## docker-compose exec base bash +# +# python: +# platform: linux/x86_64 +# image: gakaki/python +# container_name: python +# build: +# context: . +# dockerfile: DockerfilePythonBase +# args: +# progress: plain +# tty: true +# stdin_open: true + qdrant: image: qdrant/qdrant:v1.3.0 restart: on-failure ports: - "6333:6333" - "6334:6334" - - + baseimage: platform: linux/x86_64 build: context: . dockerfile: DockerfileBellSoftGraalVM + args: + progress: plain + image: baseimage:0.0.1 app: diff --git a/backend_java/pom.xml b/backend_java/pom.xml index 8a7fb0d..25c0d26 100644 --- a/backend_java/pom.xml +++ b/backend_java/pom.xml @@ -121,13 +121,24 @@ org.springframework.boot spring-boot-starter-data-elasticsearch - + + org.springframework.boot + spring-boot-starter-data-elasticsearch + io.qdrant client 1.7.1 + + + org.slf4j + slf4j-api + 2.0.11 + + + diff --git a/backend_java/src/main/java/com/food/trucks/repository/FoddTruckQdrantRepo.java b/backend_java/src/main/java/com/food/trucks/repository/FoddTruckQdrantRepo.java new file mode 100644 index 0000000..3bf1aff --- /dev/null +++ b/backend_java/src/main/java/com/food/trucks/repository/FoddTruckQdrantRepo.java @@ -0,0 +1,18 @@ +package com.food.trucks.repository; + +import io.qdrant.client.grpc.Points; +import org.springframework.stereotype.Repository; +import static io.qdrant.client.ConditionFactory.geoRadius; + +@Repository +public class FoddTruckQdrantRepo { + + + public void getRadius(){ + Points.Condition condition = geoRadius("location", + 52.520711, 13.403683, 1000.0f); + + + + } +} \ No newline at end of file diff --git a/backend_java/todo.md b/backend_java/todo.md new file mode 100644 index 0000000..7ce8e33 --- /dev/null +++ b/backend_java/todo.md @@ -0,0 +1,11 @@ +github action 制作 rust 二进制包 包括windows linux macos +github action 制作 golang 二进制包 包括windows linux macos +github action 打包nodejs 并且push到cdnjs上 +github action 打包 graavl 二进制包 直接到docker 镜像 推送到docker hub 并且让第三方服务器拉取 重启 +spring boot qdrant and elasticsearch + +spring boot webflux redis mongodb elasticsearch + +write github action for common usage + +中文情况下的全文检索增加 ik 插件 \ No newline at end of file