-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: .gitignore add docker data fix: 修正發生部分錯誤時,資料應該還是可以正常回傳 fix: 調整 Logger & 其他 Bug ci: add cdk8s fix: ci fix: ci fix: cdk8s fix: ci fix: ci fix: ci fix: ci fix: ci fix: ci fix: ci fix: env fix: ci fix: ci * fix: cdk8s * update(openai): update openai to v3.3.0 fix: changelog
- Loading branch information
Showing
82 changed files
with
75,699 additions
and
1,058 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,3 +42,6 @@ Thumbs.db | |
|
||
# local env files | ||
.env.local | ||
|
||
#docker file | ||
docker-data/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
stages: | ||
- build-image | ||
- cloud-deploy | ||
|
||
variables: | ||
LANG: "en_US.UTF-8" | ||
LC_ALL: "en_US.UTF-8" | ||
GIT_DEPTH: 0 | ||
GIT_SUBMODULE_STRATEGY: normal | ||
# Use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled | ||
DOCKER_HOST: tcp://docker:2376 | ||
DOCKER_TLS_CERTDIR: "/certs" | ||
# These are usually specified by the entrypoint, however the | ||
# Kubernetes executor doesn't run entrypoints | ||
# https://gitlab.com/gitlab-org/gitlab-runner/-/issues/4125 | ||
DOCKER_TLS_VERIFY: 1 | ||
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client" | ||
DOCKER_DRIVER: overlay2 | ||
|
||
build-and-push: &build-and-push | ||
image: | ||
name: gcr.io/kaniko-project/executor:debug | ||
entrypoint: [""] | ||
tags: | ||
- self-docker | ||
stage: build-image | ||
needs: [] | ||
script: | ||
- mkdir -p /kaniko/.docker | ||
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json | ||
- chmod +x ./tools/shell-script/package.sh | ||
- sh ./tools/shell-script/package.sh | ||
rules: | ||
- when: never | ||
retry: | ||
max: 2 | ||
when: | ||
- stuck_or_timeout_failure | ||
- runner_system_failure | ||
|
||
build-and-push:staging: | ||
<<: *build-and-push | ||
stage: build-image | ||
needs: [] | ||
variables: | ||
PROJECT_NAME: yggdrasil-core-engine | ||
rules: | ||
- if: '$CI_COMMIT_BRANCH == "develop"' | ||
retry: | ||
max: 2 | ||
when: | ||
- stuck_or_timeout_failure | ||
- runner_system_failure | ||
|
||
build-and-push-discord-client:staging: | ||
<<: *build-and-push | ||
stage: build-image | ||
needs: [] | ||
variables: | ||
PROJECT_NAME: yggdrasil-discord-client | ||
rules: | ||
- if: '$CI_COMMIT_BRANCH == "develop"' | ||
retry: | ||
max: 2 | ||
when: | ||
- stuck_or_timeout_failure | ||
- runner_system_failure | ||
|
||
cloud-deploy: &cloud-deploy | ||
image: alpine:3.14 | ||
stage: cloud-deploy | ||
tags: | ||
- self-docker | ||
before_script: | ||
- apk update && apk add --no-cache curl nodejs npm | ||
- curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl | ||
- chmod +x ./kubectl && mv ./kubectl /usr/local/bin/kubectl | ||
- mkdir -p $HOME/.kube | ||
- echo -n $KUBE_CONFIG | base64 -d > $HOME/.kube/config | ||
- kubectl config view | ||
script: | ||
- echo $NODE_ENV | ||
- echo $KUBE_NAME_SPACE | ||
- echo $PROJECT_NAME | ||
- kubectl delete jobs --all -n $KUBE_NAME_SPACE | ||
- kubectl delete cronjobs --all -n $KUBE_NAME_SPACE | ||
- chmod +x ./tools/shell-script/build-cdk8s.sh | ||
- sh ./tools/shell-script/build-cdk8s.sh | ||
- kubectl create secret docker-registry gitlab-registry --docker-server="$CI_REGISTRY" --docker-username="$CI_DEPLOY_USER" --docker-password="$CI_DEPLOY_PASSWORD" --docker-email="$GITLAB_USER_EMAIL" -n $KUBE_NAME_SPACE -o yaml --dry-run=client | kubectl apply -f - | ||
- kubectl apply -f ./tools/cdk8s/${PROJECT_NAME}/dist/*.yaml -n $KUBE_NAME_SPACE | ||
rules: | ||
- when: never | ||
artifacts: | ||
name: "${PROJECT_NAME}-$CI_JOB_NAME-$CI_COMMIT_REF_NAME" | ||
paths: | ||
- ./tools/cdk8s/${PROJECT_NAME}/dist/* | ||
expire_in: 3 days | ||
retry: | ||
max: 2 | ||
when: | ||
- stuck_or_timeout_failure | ||
- runner_system_failure | ||
|
||
cloud-deploy:staging: | ||
<<: *cloud-deploy | ||
stage: cloud-deploy | ||
needs: [ | ||
'build-and-push:staging' | ||
] | ||
variables: | ||
NODE_ENV: staging | ||
KUBE_NAME_SPACE: yggdrasil-core-engine-staging | ||
PROJECT_NAME: yggdrasil-core-engine | ||
rules: | ||
- if: '$CI_COMMIT_BRANCH == "develop"' | ||
environment: | ||
name: staging | ||
action: prepare | ||
retry: | ||
max: 2 | ||
when: | ||
- stuck_or_timeout_failure | ||
- runner_system_failure | ||
|
||
cloud-deploy-discord-client:staging: | ||
<<: *cloud-deploy | ||
stage: cloud-deploy | ||
needs: [ | ||
'build-and-push-discord-client:staging' | ||
] | ||
variables: | ||
NODE_ENV: staging | ||
KUBE_NAME_SPACE: yggdrasil-discord-client-staging | ||
PROJECT_NAME: yggdrasil-discord-client | ||
rules: | ||
- if: '$CI_COMMIT_BRANCH == "develop"' | ||
environment: | ||
name: staging | ||
action: prepare | ||
retry: | ||
max: 2 | ||
when: | ||
- stuck_or_timeout_failure | ||
- runner_system_failure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
PACKAGE_NAME=Yggdrasil Core Engine | ||
SERVICE_NAME=yggdrasil-core-engine | ||
OPENAI_API_KEY= | ||
AZURE_OPENAI_API_KEY= | ||
AZURE_OPENAI_ENDPOINT= | ||
AZURE_OPENAI_DEPLOYMENT_NAME= | ||
AZURE_OPENAI_MODEL_NAME= | ||
CORE_ENGINE_API_KEY= | ||
CHATGPT_API_KEY= | ||
CHATGPT_ORG= | ||
OPENAI_API_TYPE= | ||
AZURE_API_BASE_PATH= | ||
AZURE_CHATGPT_API_KEY= | ||
AZURE_DEPLOYMENT_NAME= | ||
AZURE_API_VERSION='2023-03-15-preview' | ||
RPC_API_KEY= | ||
MONGO_DB_URI= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
FROM docker.io/node:18.16 AS development | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY --chown=node:node package*.json ./ | ||
|
||
RUN npm ci | ||
|
||
COPY --chown=node:node . . | ||
|
||
USER node | ||
|
||
FROM node:lts-slim As build | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY --chown=node:node package*.json ./ | ||
COPY --chown=node:node --from=development /usr/src/app/node_modules ./node_modules | ||
COPY --chown=node:node . . | ||
|
||
RUN npx nx run yggdrasil-core-engine:build | ||
RUN npm cache clean --force | ||
|
||
USER node | ||
|
||
FROM docker.io/node:18.16-alpine AS production | ||
|
||
COPY --chown=node:node --from=build /usr/src/app/dist/apps/yggdrasil-core-engine ./yggdrasil-core-engine | ||
COPY --chown=node:node --from=development /usr/src/app/node_modules ./node_modules | ||
|
||
ARG SERVER_VERSION | ||
ENV SERVER_VERSION=${SERVER_VERSION} | ||
|
||
CMD [ "node", "yggdrasil-core-engine" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.