@catladder/cli 0.0.0-next-1cd29c1f → 0.0.0-next-52feb889
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles/catenv/index.js +45 -9
- package/dist/bundles/cli/index.js +125 -11
- package/dist/bundles/runner-images/agent-claude/Dockerfile +5 -0
- package/dist/bundles/runner-images/docker-build/Dockerfile +26 -0
- package/dist/bundles/runner-images/docker-build/scripts/ensureMeteorDockerfile +55 -0
- package/dist/bundles/runner-images/docker-build/scripts/ensureNginxDockerfile +85 -0
- package/dist/bundles/runner-images/docker-build/scripts/ensureNodeDockerfile +50 -0
- package/dist/bundles/runner-images/gcloud/Dockerfile +3 -0
- package/dist/bundles/runner-images/jobs-default/Dockerfile +22 -0
- package/dist/bundles/runner-images/jobs-meteor/Dockerfile +7 -0
- package/dist/bundles/runner-images/jobs-testing-chrome/Dockerfile +15 -0
- package/dist/bundles/runner-images/kubernetes/Dockerfile +26 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/Chart.lock +9 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/Chart.yaml +14 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/README.md +24 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/charts/mailhog-5.0.1.tgz +0 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/charts/mongodb-12.1.27.tgz +0 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/myvalues.yaml +15 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/templates/_helpers.tpl +202 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.cloudsql-proxy-credentials.yml +10 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.cronjobs.yml +69 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.deployment.autoscaler.yml +19 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.deployment.yml +103 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.env.configmap.yml +27 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.env.secrets.yml +10 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.ingress.redirects.yaml +91 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.ingress.yaml +48 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.jobs.yml +70 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.service.yaml +31 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.volumes.yml +20 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.worker.deployment.yml +104 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.worker.service.yaml +34 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/templates/mailhog.ingress.yaml +35 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/templates/maintenance.deployment.yml +45 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/templates/maintenance.service.yml +24 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/templates/mongodb.backup.cronjob.yml +120 -0
- package/dist/bundles/runner-images/kubernetes/helm-charts/the-panter-chart/values.yaml +154 -0
- package/dist/bundles/runner-images/kubernetes/scripts/kubernetesCreateSecret +11 -0
- package/dist/bundles/runner-images/kubernetes/scripts/kubernetesDelete +5 -0
- package/dist/bundles/runner-images/kubernetes/scripts/kubernetesDeploy +57 -0
- package/dist/bundles/runner-images/kubernetes/scripts/kubernetesRollback +5 -0
- package/dist/bundles/runner-images/semantic-release/Dockerfile +24 -0
- package/dist/bundles/runner-images/semantic-release/scripts/semanticRelease +67 -0
- package/dist/cli/src/apps/cli/commands/project/setup/ensureGcloudProjectNumbers.d.ts +12 -0
- package/dist/cli/src/apps/cli/commands/project/setup/ensureGcloudProjectNumbers.js +64 -0
- package/dist/cli/src/apps/cli/commands/project/setup/ensureGcloudProjectNumbers.js.map +1 -0
- package/dist/cli/src/apps/cli/commands/project/setup/index.js +3 -0
- package/dist/cli/src/apps/cli/commands/project/setup/index.js.map +1 -1
- package/dist/cli/src/config/getProjectConfig.d.ts +6 -0
- package/dist/cli/src/config/getProjectConfig.js +10 -1
- package/dist/cli/src/config/getProjectConfig.js.map +1 -1
- package/dist/cli/src/gcloud/cloudSql/copyDb.js +6 -2
- package/dist/cli/src/gcloud/cloudSql/copyDb.js.map +1 -1
- package/dist/pipeline/src/constants.js +1 -1
- package/dist/pipeline/src/context/index.d.ts +1 -0
- package/dist/pipeline/src/context/index.js +1 -0
- package/dist/pipeline/src/context/index.js.map +1 -1
- package/dist/pipeline/src/customImages/shippedImages.js +3 -1
- package/dist/pipeline/src/customImages/shippedImages.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/execute/schedules.js +18 -3
- package/dist/pipeline/src/deploy/cloudRun/createJobs/execute/schedules.js.map +1 -1
- package/dist/pipeline/src/deploy/types/googleCloudRun.d.ts +5 -1
- package/dist/pipeline/src/store/index.d.ts +4 -0
- package/dist/pipeline/src/store/index.js +12 -3
- package/dist/pipeline/src/store/index.js.map +1 -1
- package/dist/runner-images/agent-claude/Dockerfile +5 -0
- package/dist/runner-images/docker-build/Dockerfile +26 -0
- package/dist/runner-images/docker-build/scripts/ensureMeteorDockerfile +55 -0
- package/dist/runner-images/docker-build/scripts/ensureNginxDockerfile +85 -0
- package/dist/runner-images/docker-build/scripts/ensureNodeDockerfile +50 -0
- package/dist/runner-images/gcloud/Dockerfile +3 -0
- package/dist/runner-images/jobs-default/Dockerfile +22 -0
- package/dist/runner-images/jobs-meteor/Dockerfile +7 -0
- package/dist/runner-images/jobs-testing-chrome/Dockerfile +15 -0
- package/dist/runner-images/kubernetes/Dockerfile +26 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/Chart.lock +9 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/Chart.yaml +14 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/README.md +24 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/charts/mailhog-5.0.1.tgz +0 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/charts/mongodb-12.1.27.tgz +0 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/myvalues.yaml +15 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/templates/_helpers.tpl +202 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.cloudsql-proxy-credentials.yml +10 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.cronjobs.yml +69 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.deployment.autoscaler.yml +19 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.deployment.yml +103 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.env.configmap.yml +27 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.env.secrets.yml +10 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.ingress.redirects.yaml +91 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.ingress.yaml +48 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.jobs.yml +70 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.service.yaml +31 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.volumes.yml +20 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.worker.deployment.yml +104 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/templates/app.worker.service.yaml +34 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/templates/mailhog.ingress.yaml +35 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/templates/maintenance.deployment.yml +45 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/templates/maintenance.service.yml +24 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/templates/mongodb.backup.cronjob.yml +120 -0
- package/dist/runner-images/kubernetes/helm-charts/the-panter-chart/values.yaml +154 -0
- package/dist/runner-images/kubernetes/scripts/kubernetesCreateSecret +11 -0
- package/dist/runner-images/kubernetes/scripts/kubernetesDelete +5 -0
- package/dist/runner-images/kubernetes/scripts/kubernetesDeploy +57 -0
- package/dist/runner-images/kubernetes/scripts/kubernetesRollback +5 -0
- package/dist/runner-images/semantic-release/Dockerfile +24 -0
- package/dist/runner-images/semantic-release/scripts/semanticRelease +67 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/src/apps/cli/commands/project/setup/ensureGcloudProjectNumbers.ts +61 -0
- package/src/apps/cli/commands/project/setup/index.ts +3 -0
- package/src/config/getProjectConfig.ts +9 -0
- package/src/gcloud/cloudSql/copyDb.ts +7 -2
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
if [ ! -f $APP_DIR/.dockerignore ]; then
|
|
4
|
+
|
|
5
|
+
cat >$APP_DIR/.dockerignore <<EOF
|
|
6
|
+
$APP_DIR/node_modules
|
|
7
|
+
**/__snapshots__/**
|
|
8
|
+
.git
|
|
9
|
+
|
|
10
|
+
EOF
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
if [ ! -f $APP_DIR/Dockerfile ]; then
|
|
14
|
+
echo "Creating Dockerfile"
|
|
15
|
+
if [[ ! -z "$METEOR_OVERRIDE_NODE_VERSION" ]]; then
|
|
16
|
+
NODE_VERSION=$METEOR_OVERRIDE_NODE_VERSION
|
|
17
|
+
else
|
|
18
|
+
NODE_VERSION_FULL=$(cat $APP_DIR/dist/bundle/.node_version.txt)
|
|
19
|
+
NODE_VERSION=${NODE_VERSION_FULL/v/} # remove v
|
|
20
|
+
fi
|
|
21
|
+
if [ "$NODE_VERSION" = "14.21.4" ]; then
|
|
22
|
+
DOCKER_IMAGE="meteor/node:$NODE_VERSION" # meteor maintenance for because of fibers
|
|
23
|
+
else
|
|
24
|
+
DOCKER_IMAGE="node:$NODE_VERSION"
|
|
25
|
+
fi
|
|
26
|
+
cat >$APP_DIR/Dockerfile <<EOF
|
|
27
|
+
FROM $DOCKER_IMAGE
|
|
28
|
+
|
|
29
|
+
# install yarn. new meteor image has no yarn installed
|
|
30
|
+
# only install if it does not exist
|
|
31
|
+
RUN command -v yarn || npm install --global yarn
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
$DOCKERFILE_ADDITIONS
|
|
35
|
+
|
|
36
|
+
# we copy also source code and scripts for commands
|
|
37
|
+
# This is technically not required for meteor, but useful if we have additional scripts
|
|
38
|
+
WORKDIR /src
|
|
39
|
+
$METEOR_INSTALL_SCRIPTS
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# copy the bundle
|
|
43
|
+
COPY $APP_DIR/dist /src/dist
|
|
44
|
+
|
|
45
|
+
# now install meteor deps
|
|
46
|
+
RUN cd /src/dist/bundle/programs/server && npm install
|
|
47
|
+
|
|
48
|
+
$DOCKERFILE_ADDITIONS_END
|
|
49
|
+
|
|
50
|
+
WORKDIR /src/dist/bundle
|
|
51
|
+
|
|
52
|
+
CMD ["node", "main.js"]
|
|
53
|
+
EOF
|
|
54
|
+
|
|
55
|
+
fi
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# ensure nginx config
|
|
4
|
+
echo "ensureNginxDockerfile in $APP_DIR"
|
|
5
|
+
|
|
6
|
+
if [ ! -f $APP_DIR/nginx.conf ]; then
|
|
7
|
+
echo "Creating nginx.conf"
|
|
8
|
+
|
|
9
|
+
cat >$APP_DIR/nginx.conf <<NGINX
|
|
10
|
+
|
|
11
|
+
server {
|
|
12
|
+
listen 8080;
|
|
13
|
+
server_name localhost;
|
|
14
|
+
error_page 404 =200 /index.html;
|
|
15
|
+
|
|
16
|
+
charset utf-8;
|
|
17
|
+
|
|
18
|
+
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
|
|
19
|
+
add_header Referrer-Policy "strict-origin-when-cross-origin";
|
|
20
|
+
add_header X-Content-Type-Options "nosniff";
|
|
21
|
+
add_header X-Frame-Options "SAMEORIGIN";
|
|
22
|
+
|
|
23
|
+
location / {
|
|
24
|
+
root /usr/share/nginx/html;
|
|
25
|
+
index index.html index.htm;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
location /__health {
|
|
29
|
+
access_log off;
|
|
30
|
+
types { } default_type "text/html; charset=utf-8";
|
|
31
|
+
return 200 "ok\n";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
# https://trac.nginx.org/nginx/ticket/2216
|
|
35
|
+
include mime.types;
|
|
36
|
+
types
|
|
37
|
+
{
|
|
38
|
+
application/javascript mjs;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
NGINX
|
|
43
|
+
|
|
44
|
+
fi
|
|
45
|
+
# ensure docker ignore
|
|
46
|
+
if [ ! -f $APP_DIR/.dockerignore ]; then
|
|
47
|
+
|
|
48
|
+
cat >.dockerignore <<EOF
|
|
49
|
+
**/node_modules
|
|
50
|
+
**/__snapshots__/**
|
|
51
|
+
.git
|
|
52
|
+
|
|
53
|
+
EOF
|
|
54
|
+
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
if [ ! -f $APP_DIR/Dockerfile ]; then
|
|
58
|
+
echo "Creating Dockerfile"
|
|
59
|
+
|
|
60
|
+
cat >$APP_DIR/Dockerfile <<EOF
|
|
61
|
+
|
|
62
|
+
$DOCKERFILE_ADDITIONS
|
|
63
|
+
|
|
64
|
+
FROM nginx:stable
|
|
65
|
+
WORKDIR /app
|
|
66
|
+
|
|
67
|
+
RUN sed --in-place "s/^\s*user .*//" /etc/nginx/nginx.conf && \
|
|
68
|
+
chown -R nginx:nginx /app && \
|
|
69
|
+
chmod -R 755 /app && \
|
|
70
|
+
chown -R nginx:nginx /var/cache/nginx && \
|
|
71
|
+
chown -R nginx:nginx /var/log/nginx && \
|
|
72
|
+
chown -R nginx:nginx /etc/nginx/conf.d && \
|
|
73
|
+
touch /var/run/nginx.pid && \
|
|
74
|
+
chown -R nginx:nginx /var/run/nginx.pid
|
|
75
|
+
|
|
76
|
+
COPY $APP_DIR/nginx.conf /etc/nginx/conf.d/default.conf
|
|
77
|
+
COPY $APP_DIR/dist/ /usr/share/nginx/html/
|
|
78
|
+
|
|
79
|
+
$DOCKERFILE_ADDITIONS_END
|
|
80
|
+
|
|
81
|
+
USER nginx
|
|
82
|
+
EXPOSE 8080
|
|
83
|
+
|
|
84
|
+
EOF
|
|
85
|
+
fi
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# the default dockerfile includes node alpine
|
|
4
|
+
|
|
5
|
+
# the dockerignore ignores node_modules as these have to be rebuilt anyway
|
|
6
|
+
# as well as __snapshots__ are used for unitests (if any)
|
|
7
|
+
|
|
8
|
+
if [ ! -f $APP_DIR/.dockerignore ]; then
|
|
9
|
+
|
|
10
|
+
cat >$APP_DIR/.dockerignore <<EOF
|
|
11
|
+
**/node_modules
|
|
12
|
+
**/__snapshots__/**
|
|
13
|
+
.git
|
|
14
|
+
|
|
15
|
+
EOF
|
|
16
|
+
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
if [ -f $APP_DIR/.nvmrc ]; then
|
|
20
|
+
NODE_VERSION="$(cat $APP_DIR/.nvmrc | sed '/^$/d' | sed 's/[a-z-]//g')"
|
|
21
|
+
elif [ -f .nvmrc ]; then
|
|
22
|
+
NODE_VERSION="$(cat .nvmrc | sed '/^$/d' | sed 's/[a-z-]//g')"
|
|
23
|
+
else
|
|
24
|
+
NODE_VERSION=14
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
if [ ! -f $APP_DIR/Dockerfile ]; then
|
|
28
|
+
echo "Creating Dockerfile"
|
|
29
|
+
|
|
30
|
+
cat >$APP_DIR/Dockerfile <<EOF
|
|
31
|
+
FROM node:$NODE_VERSION-alpine
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
$DOCKERFILE_ADDITIONS
|
|
36
|
+
|
|
37
|
+
RUN apk add --no-cache git curl
|
|
38
|
+
USER node
|
|
39
|
+
|
|
40
|
+
$DOCKER_COPY_WORKSPACE_FILES
|
|
41
|
+
|
|
42
|
+
WORKDIR /app/$APP_DIR
|
|
43
|
+
|
|
44
|
+
$DOCKER_COPY_AND_INSTALL_APP
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
$DOCKERFILE_ADDITIONS_END
|
|
48
|
+
|
|
49
|
+
EOF
|
|
50
|
+
fi
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
FROM node:18
|
|
4
|
+
|
|
5
|
+
RUN rm /bin/sh && \
|
|
6
|
+
ln -s /bin/bash /bin/sh && \
|
|
7
|
+
mkdir -p /root/.nvm
|
|
8
|
+
|
|
9
|
+
# set high timeout for yarn, see https://github.com/dhis2/notes/issues/29
|
|
10
|
+
RUN yarn config set network-timeout 600000 -g
|
|
11
|
+
|
|
12
|
+
# install nvm && some common node versions
|
|
13
|
+
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash && \
|
|
14
|
+
source /root/.nvm/nvm.sh && \
|
|
15
|
+
chmod +x /root/.nvm/nvm.sh && \
|
|
16
|
+
/root/.nvm/nvm.sh install 12 && \
|
|
17
|
+
/root/.nvm/nvm.sh install 14 && \
|
|
18
|
+
/root/.nvm/nvm.sh install 16 && \
|
|
19
|
+
/root/.nvm/nvm.sh install 18 && \
|
|
20
|
+
/root/.nvm/nvm.sh install 20 && \
|
|
21
|
+
/root/.nvm/nvm.sh install 22 && \
|
|
22
|
+
/root/.nvm/nvm.sh install 24
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# syntax = docker.io/devthefuture/dockerfile-x
|
|
2
|
+
|
|
3
|
+
INCLUDE ./jobs-default/Dockerfile
|
|
4
|
+
|
|
5
|
+
# add sources
|
|
6
|
+
# Google Chrome (for testing purposes)
|
|
7
|
+
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
|
|
8
|
+
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
|
|
9
|
+
|
|
10
|
+
# install some sources
|
|
11
|
+
# not sure if libxss1 is required
|
|
12
|
+
RUN apt-get update && apt-get install -y \
|
|
13
|
+
libxss1 \
|
|
14
|
+
google-chrome-stable
|
|
15
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
FROM alpine:3.15
|
|
3
|
+
|
|
4
|
+
# add bash curl and git
|
|
5
|
+
RUN apk add --no-cache bash curl git
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# kubernetes & helm
|
|
9
|
+
ENV KUBERNETES_VERSION 1.19.14
|
|
10
|
+
RUN curl -L -o /usr/bin/kubectl "https://storage.googleapis.com/kubernetes-release/release/v${KUBERNETES_VERSION}/bin/linux/amd64/kubectl" ;\
|
|
11
|
+
chmod +x /usr/bin/kubectl ;\
|
|
12
|
+
kubectl version --client
|
|
13
|
+
|
|
14
|
+
# helm 3
|
|
15
|
+
ENV HELM_VERSION 3.10.0
|
|
16
|
+
RUN curl "https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz" | tar zx ;\
|
|
17
|
+
mv linux-amd64/helm /usr/bin/helm ;\
|
|
18
|
+
helm version --client
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
COPY ./scripts/* /scripts/
|
|
22
|
+
RUN chmod +x /scripts/*
|
|
23
|
+
|
|
24
|
+
ENV PATH="/scripts:${PATH}"
|
|
25
|
+
|
|
26
|
+
COPY ./helm-charts /helm-charts
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
dependencies:
|
|
2
|
+
- name: mongodb
|
|
3
|
+
repository: https://charts.bitnami.com/bitnami
|
|
4
|
+
version: 12.1.27
|
|
5
|
+
- name: mailhog
|
|
6
|
+
repository: https://codecentric.github.io/helm-charts
|
|
7
|
+
version: 5.0.1
|
|
8
|
+
digest: sha256:8963e4182d88c519cf73b6c1e18f9993827b7bf7b54432f56b7b8c5d758bcf8e
|
|
9
|
+
generated: "2022-07-25T19:15:40.334548+02:00"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
apiVersion: v2
|
|
2
|
+
description: a chart to rule them all
|
|
3
|
+
name: the-panter-chart
|
|
4
|
+
version: 1.0.0 # should not matter
|
|
5
|
+
|
|
6
|
+
dependencies:
|
|
7
|
+
- name: mongodb
|
|
8
|
+
version: 12.1.27
|
|
9
|
+
condition: mongodb.enabled
|
|
10
|
+
repository: https://charts.bitnami.com/bitnami
|
|
11
|
+
- name: mailhog
|
|
12
|
+
version: 5.0.1
|
|
13
|
+
condition: mailhog.enabled
|
|
14
|
+
repository: https://codecentric.github.io/helm-charts
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# The panter chart
|
|
2
|
+
|
|
3
|
+
**Main chart used in https://git.panter.ch/catladder/gitlab-ci/ **
|
|
4
|
+
|
|
5
|
+
Developing helm charts can be complex and they tend to be very verbose.
|
|
6
|
+
Our goal is therefore to provide a common chart that provides all functionalities that you might need
|
|
7
|
+
and make it configurable by values.yml files in your project.
|
|
8
|
+
|
|
9
|
+
This way we avoid having complexity in the projects and make it easier to share innovations and improvements.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- scalable stateless webapplications, supports any technology
|
|
14
|
+
- ready-to-use but configurable ingress with optional redirects
|
|
15
|
+
- 1 optional worker pod (uses same image as webapp) for continuous background jobs
|
|
16
|
+
- configurable cronjobs
|
|
17
|
+
- configurable helm-hooks (post-install, post-uninstall, etc.)
|
|
18
|
+
- optional in-namespace mongodb. _kindof deprecated, We recommend to use google cloud dbs if possible._
|
|
19
|
+
- optional cloud-sql proxy that is available in webapp, worker, cronjobs and helm-hooks
|
|
20
|
+
- a lot of useful predefined env-vars in all pods.
|
|
21
|
+
- support for namespace secrets and custom env-vars (using catladder-shell and gitlab-ci)
|
|
22
|
+
- optional prisam1 (_deprecated, prisma2 does not need a separate instance anymore_)
|
|
23
|
+
|
|
24
|
+
See https://git.panter.ch/catladder/catladder/ for usage information
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
{{/* vim: set filetype=mustache: */}}
|
|
2
|
+
{{/*
|
|
3
|
+
Expand the name of the chart.
|
|
4
|
+
*/}}
|
|
5
|
+
{{- define "name" -}}
|
|
6
|
+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
|
7
|
+
{{- end -}}
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
{{- define "appImage" -}}
|
|
11
|
+
{{ .Values.image.repository }}/{{ .Values.image.name }}:{{ .Values.image.tag }}
|
|
12
|
+
{{- end -}}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
{{/*
|
|
16
|
+
Create a default fully qualified app name.
|
|
17
|
+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
|
18
|
+
*/}}
|
|
19
|
+
{{- define "fullname" -}}
|
|
20
|
+
{{- default .Release.Name .Values.global.appName | trunc 63 | trimSuffix "-" -}}
|
|
21
|
+
{{- end -}}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
{{/*
|
|
26
|
+
create a prefix for variable names, this is useful in service discovery in review apps
|
|
27
|
+
*/}}
|
|
28
|
+
{{- define "serviceVarPrefix" -}}
|
|
29
|
+
{{ include "fullname" . | snakecase | upper }}
|
|
30
|
+
{{- end -}}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
{{/*
|
|
34
|
+
Create chart name and version as used by the chart label.
|
|
35
|
+
*/}}
|
|
36
|
+
{{- define "chart" -}}
|
|
37
|
+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
|
38
|
+
{{- end -}}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
{{/*
|
|
42
|
+
get the right host
|
|
43
|
+
*/}}
|
|
44
|
+
{{- define "host" -}}
|
|
45
|
+
{{- default .Values.application.hostCanonical .Values.application.host -}}
|
|
46
|
+
{{- end -}}
|
|
47
|
+
|
|
48
|
+
{{- define "MAILHOG_SMTP_URL" -}}
|
|
49
|
+
{{- $namespace := .Release.Namespace -}}
|
|
50
|
+
{{- printf "smtp://%s.%s.svc.cluster.local:1025" .Values.mailhog.fullnameOverride $namespace -}}
|
|
51
|
+
{{- end -}}
|
|
52
|
+
|
|
53
|
+
{{- define "DB_NAME" -}}
|
|
54
|
+
{{ .Values.cloudsql.fullDbName }}
|
|
55
|
+
{{- end -}}
|
|
56
|
+
|
|
57
|
+
{{- define "POSTGRESQL_URL" -}}
|
|
58
|
+
postgresql://{{ .Values.cloudsql.dbUser }}:$(POSTGRESQL_PASSWORD)@localhost/{{ .Values.cloudsql.fullDbName }}?schema=public
|
|
59
|
+
{{- end -}}
|
|
60
|
+
|
|
61
|
+
{{- define "POSTGRESQL_HOST" -}}
|
|
62
|
+
localhost
|
|
63
|
+
{{- end -}}
|
|
64
|
+
|
|
65
|
+
{{- define "DB_USERNAME" -}}
|
|
66
|
+
{{ .Values.cloudsql.dbUser }}
|
|
67
|
+
{{- end -}}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
{{- define "DB_PASSWORD" -}}
|
|
71
|
+
$(POSTGRESQL_PASSWORD)
|
|
72
|
+
{{- end -}}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
{{- define "cloudSqlContainer" -}}
|
|
76
|
+
name: cloudsql-proxy
|
|
77
|
+
image: eu.gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.18.0-alpine
|
|
78
|
+
# see https://github.com/kubernetes/kubernetes/issues/25908#issuecomment-308569672
|
|
79
|
+
# and https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/753-sidecar-containers
|
|
80
|
+
command: ["/bin/sh", "-c"]
|
|
81
|
+
args:
|
|
82
|
+
- |
|
|
83
|
+
/cloud-sql-proxy --auto-ip --credentials-file /secrets/cloudsql/credentials.json "{{ .Values.cloudsql.instanceConnectionName }}" &
|
|
84
|
+
CHILD_PID=$!
|
|
85
|
+
(while true; do if [[ -f "/tmp/pod/main-terminated" ]]; then kill $CHILD_PID; fi; sleep 1; done) &
|
|
86
|
+
wait $CHILD_PID
|
|
87
|
+
if [[ -f "/tmp/pod/main-terminated" ]]; then exit 0; fi
|
|
88
|
+
securityContext:
|
|
89
|
+
runAsUser: 2 # non-root user
|
|
90
|
+
allowPrivilegeEscalation: false
|
|
91
|
+
resources: # each container needs requests, or the auto load balancer does not work
|
|
92
|
+
requests:
|
|
93
|
+
cpu: 50m
|
|
94
|
+
memory: 150Mi
|
|
95
|
+
volumeMounts:
|
|
96
|
+
- name: cloudsql-proxy-credentials
|
|
97
|
+
mountPath: /secrets/cloudsql
|
|
98
|
+
readOnly: true
|
|
99
|
+
|
|
100
|
+
- mountPath: /tmp/pod
|
|
101
|
+
name: tmp-pod
|
|
102
|
+
readOnly: true
|
|
103
|
+
{{- end -}}
|
|
104
|
+
|
|
105
|
+
{{- define "cloudSqlCredentialsVolume" -}}
|
|
106
|
+
name: cloudsql-proxy-credentials
|
|
107
|
+
secret:
|
|
108
|
+
secretName: {{ template "fullname" $ }}-cloudsql-proxy-credentials
|
|
109
|
+
{{- end -}}
|
|
110
|
+
{{/*
|
|
111
|
+
Generate prisma-URL
|
|
112
|
+
*/}}
|
|
113
|
+
{{- define "PRISMA_ENDPOINT" -}}
|
|
114
|
+
{{- $appName := default .Release.Name .Values.global.appName -}}
|
|
115
|
+
{{- $namespace := .Release.Namespace -}}
|
|
116
|
+
{{- printf "http://%s-prisma.%s:4466/default/default" $appName $namespace -}}
|
|
117
|
+
{{- end -}}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
{{/*
|
|
123
|
+
convert value to json-string if its an object
|
|
124
|
+
*/}}
|
|
125
|
+
{{- define "envValue" -}}
|
|
126
|
+
{{- if (kindIs "map" .) -}}
|
|
127
|
+
{{ toJson . | quote}}
|
|
128
|
+
{{- else -}}
|
|
129
|
+
{{ quote . }}
|
|
130
|
+
{{- end -}}
|
|
131
|
+
{{- end -}}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
{{- define "env" -}}
|
|
135
|
+
{{ $context := . }}
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
envFrom:
|
|
140
|
+
- configMapRef:
|
|
141
|
+
name: {{ template "fullname" $ }}-app-env
|
|
142
|
+
env:
|
|
143
|
+
{{- range $key, $val := .Values.env.secret }}
|
|
144
|
+
- name: {{ $key }}
|
|
145
|
+
valueFrom:
|
|
146
|
+
secretKeyRef:
|
|
147
|
+
name: {{ template "fullname" $ }}-app-secrets
|
|
148
|
+
key: {{ $key }}
|
|
149
|
+
{{- end }}
|
|
150
|
+
|
|
151
|
+
{{- range $key, $val := .Values.secretsFromOtherComponent }}
|
|
152
|
+
|
|
153
|
+
- name: {{ $key }}
|
|
154
|
+
valueFrom:
|
|
155
|
+
secretKeyRef:
|
|
156
|
+
name: {{ $.Values.global.appPrefix}}{{ $val }}-app-secrets
|
|
157
|
+
key: {{ $key }}
|
|
158
|
+
optional: true
|
|
159
|
+
{{- end }}
|
|
160
|
+
|
|
161
|
+
{{- range $key, $val := .Values.mapServiceUrlToEnv }}
|
|
162
|
+
{{- $otherServiceFullName := (printf "%s%s" $.Values.global.appPrefix $val) }}
|
|
163
|
+
{{- $variablePrefix := $otherServiceFullName | snakecase | upper }}
|
|
164
|
+
- name: {{ $key }}
|
|
165
|
+
value: "http://$({{ $variablePrefix }}_SERVICE_HOST):$({{ $variablePrefix }}_SERVICE_PORT)"
|
|
166
|
+
{{- end }}
|
|
167
|
+
|
|
168
|
+
# can't have these in app.env.configmap as some values contain $(OTHER_ENV_VAR)
|
|
169
|
+
{{ if .Values.cloudsql.enabled }}
|
|
170
|
+
- name: POSTGRESQL_URL
|
|
171
|
+
value: "{{- template "POSTGRESQL_URL" . -}}"
|
|
172
|
+
- name: DATABASE_URL
|
|
173
|
+
value: "{{- template "POSTGRESQL_URL" . -}}"
|
|
174
|
+
|
|
175
|
+
- name: POSTGRESQL_HOST
|
|
176
|
+
value: "{{- template "POSTGRESQL_HOST" . -}}"
|
|
177
|
+
- name: DB_HOST # alias
|
|
178
|
+
value: "{{- template "POSTGRESQL_HOST" . -}}"
|
|
179
|
+
- name: DB_NAME
|
|
180
|
+
value: "{{- template "DB_NAME" . -}}"
|
|
181
|
+
- name: DB_USERNAME #alias
|
|
182
|
+
value: "{{- template "DB_USERNAME" . -}}"
|
|
183
|
+
- name: DB_PASSWORD #alias
|
|
184
|
+
value: "{{- template "DB_PASSWORD" . -}}"
|
|
185
|
+
- name: POSTGRESQL_DBNAME # alias
|
|
186
|
+
value: "{{- template "DB_NAME" . -}}"
|
|
187
|
+
{{- end -}}
|
|
188
|
+
|
|
189
|
+
{{- end -}}
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
{{- define "visualReviewSnippet" -}}
|
|
194
|
+
<script
|
|
195
|
+
data-project-id='{{.Values.gitlab.projectId}}'
|
|
196
|
+
data-merge-request-id='{{.Values.gitlab.mergeRequestId}}'
|
|
197
|
+
data-mr-url='https://git.panter.ch'
|
|
198
|
+
data-project-path='{{.Values.gitlab.projectPath}}'
|
|
199
|
+
id='review-app-toolbar-script'
|
|
200
|
+
src='https://git.panter.ch/assets/webpack/visual_review_toolbar.js'>
|
|
201
|
+
</script>
|
|
202
|
+
{{- end -}}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{{- if .Values.cloudsql.enabled -}}
|
|
2
|
+
apiVersion: v1
|
|
3
|
+
kind: Secret
|
|
4
|
+
metadata:
|
|
5
|
+
name: {{ template "fullname" . }}-cloudsql-proxy-credentials
|
|
6
|
+
labels:
|
|
7
|
+
app: {{ .Release.Name }}
|
|
8
|
+
data:
|
|
9
|
+
credentials.json: {{ .Values.cloudsql.proxyCredentials | b64enc}}
|
|
10
|
+
{{- end }}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
|
|
2
|
+
{{ $jobs := .Values.cronjobs }}
|
|
3
|
+
{{ if $jobs }}
|
|
4
|
+
{{ $context := . }}
|
|
5
|
+
{{ range $key, $job := $jobs -}}
|
|
6
|
+
|
|
7
|
+
{{- $name := (kindIs "map" $jobs) | ternary $key $job.name -}}
|
|
8
|
+
|
|
9
|
+
apiVersion: batch/v1
|
|
10
|
+
kind: CronJob
|
|
11
|
+
|
|
12
|
+
metadata:
|
|
13
|
+
name: {{ include "fullname" $context | trunc 24}}-{{ $name | trunc 35 | lower }}
|
|
14
|
+
namespace: {{ $context.Release.Namespace }}
|
|
15
|
+
labels:
|
|
16
|
+
app: {{ $context.Release.Name }}
|
|
17
|
+
app.kubernetes.io/managed-by: {{$context.Release.Service | quote }}
|
|
18
|
+
app.kubernetes.io/instance: {{$context.Release.Name | quote }}
|
|
19
|
+
helm.sh/chart: "{{$context.Chart.Name}}-{{$context.Chart.Version}}"
|
|
20
|
+
|
|
21
|
+
spec:
|
|
22
|
+
schedule: {{ $job.schedule | quote}}
|
|
23
|
+
{{if $job.timeZone -}}
|
|
24
|
+
timeZone: {{ $job.timeZone | quote }}
|
|
25
|
+
{{end}}
|
|
26
|
+
# concerning concurreny we also set it to allow as default like in kubernetes i
|
|
27
|
+
# see https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/#concurrency-policy
|
|
28
|
+
concurrencyPolicy: "{{- default "Allow" $job.concurrencyPolicy -}}"
|
|
29
|
+
jobTemplate:
|
|
30
|
+
spec:
|
|
31
|
+
template:
|
|
32
|
+
spec:
|
|
33
|
+
{{- if $context.Values.image.pullSecret }}
|
|
34
|
+
imagePullSecrets:
|
|
35
|
+
- name: {{ $context.Values.image.pullSecret }}
|
|
36
|
+
{{- end }}
|
|
37
|
+
restartPolicy: Never
|
|
38
|
+
containers:
|
|
39
|
+
- name: {{ $name }}-cronjob
|
|
40
|
+
{{include "env" $context | nindent 12}}
|
|
41
|
+
{{if $job.image -}}
|
|
42
|
+
image: "{{ $job.image }}"
|
|
43
|
+
{{else}}
|
|
44
|
+
image: "{{ template "appImage" $context}}"
|
|
45
|
+
{{end}}
|
|
46
|
+
imagePullPolicy: {{ $context.Values.image.pullPolicy }}
|
|
47
|
+
# see https://github.com/kubernetes/kubernetes/issues/25908#issuecomment-308569672
|
|
48
|
+
command: ["/bin/sh", "-c"]
|
|
49
|
+
args:
|
|
50
|
+
- |
|
|
51
|
+
trap "touch /tmp/pod/main-terminated" EXIT
|
|
52
|
+
{{$job.command}}
|
|
53
|
+
volumeMounts:
|
|
54
|
+
- mountPath: /tmp/pod
|
|
55
|
+
name: tmp-pod
|
|
56
|
+
resources:
|
|
57
|
+
{{ toYaml $context.Values.jobDefaults.resources | indent 14 }}
|
|
58
|
+
{{if $context.Values.cloudsql.enabled}}
|
|
59
|
+
- {{- include "cloudSqlContainer" $context | nindent 12 }}
|
|
60
|
+
{{- end }}
|
|
61
|
+
volumes:
|
|
62
|
+
- name: tmp-pod
|
|
63
|
+
emptyDir: {}
|
|
64
|
+
{{if $context.Values.cloudsql.enabled}}
|
|
65
|
+
- {{- include "cloudSqlCredentialsVolume" $context | nindent 14 }}
|
|
66
|
+
{{- end }}
|
|
67
|
+
---
|
|
68
|
+
{{- end }}
|
|
69
|
+
{{- end }}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
{{- if .Values.application.enabled -}}
|
|
3
|
+
{{- if .Values.application.autoscale -}}
|
|
4
|
+
{{ $context := . }}
|
|
5
|
+
|
|
6
|
+
apiVersion: autoscaling/v2
|
|
7
|
+
kind: HorizontalPodAutoscaler
|
|
8
|
+
metadata:
|
|
9
|
+
name: {{ template "fullname" $context }}-app-autoscaler
|
|
10
|
+
spec:
|
|
11
|
+
scaleTargetRef:
|
|
12
|
+
apiVersion: apps/v1
|
|
13
|
+
kind: Deployment
|
|
14
|
+
name: {{ template "fullname" $context }}-app
|
|
15
|
+
{{ toYaml .Values.application.autoscale | indent 2 }}
|
|
16
|
+
|
|
17
|
+
{{- end }}
|
|
18
|
+
{{- end }}
|
|
19
|
+
|