Skip to content

Commit 2a39a95

Browse files
moda-bot[bot]heiskrrachmari
authored
Moda components setup (#53563)
Co-authored-by: moda-bot[bot] <56174108+moda-bot[bot]@users.noreply.github.com> Co-authored-by: Kevin Heis <[email protected]> Co-authored-by: Rachael Sewell <[email protected]>
1 parent aba7fa0 commit 2a39a95

File tree

8 files changed

+194
-1
lines changed

8 files changed

+194
-1
lines changed

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
version: 2
2+
registries:
3+
ghcr: # Define access for a private registry
4+
type: docker-registry
5+
url: ghcr.io
6+
username: PAT
7+
password: ${{secrets.CONTAINER_BUILDER_TOKEN}}
28
updates:
39
- package-ecosystem: npm
410
directory: '/'
@@ -23,11 +29,18 @@ updates:
2329
- dependency-name: '*'
2430
update-types:
2531
['version-update:semver-patch', 'version-update:semver-minor']
32+
- dependency-name: 'github/internal-actions'
2633

2734
- package-ecosystem: 'docker'
35+
registries:
36+
- ghcr
2837
directory: '/'
2938
schedule:
3039
interval: weekly
3140
day: thursday
41+
groups:
42+
baseImages:
43+
patterns:
44+
- '*'
3245
ignore:
3346
- dependency-name: 'node'

.github/workflows/moda-ci.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: docs-internal Moda CI
2+
3+
# More info on CI actions setup can be found here:
4+
# https://github.com/github/ops/blob/master/docs/playbooks/build-systems/moving-moda-apps-from-bp-to-actions.md
5+
6+
on:
7+
workflow_dispatch:
8+
push:
9+
branches-ignore:
10+
- 'gh-readonly-queue/**'
11+
merge_group:
12+
types: [checks_requested]
13+
14+
jobs:
15+
moda-config-bundle:
16+
if: ${{ github.repository == 'github/docs-internal' }}
17+
name: ${{ matrix.ci_job.job }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
ci_job: [{ 'job': 'docs-internal-moda-config-bundle' }]
22+
uses: github/internal-actions/.github/workflows/moda.yml@main
23+
with:
24+
ci-formatted-job-name: ${{ matrix.ci_job.job }}
25+
vault-keys: ${{ vars.VAULT_KEYS }}
26+
secrets:
27+
dx-bot-token: ${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}
28+
datadog-api-key: ${{ secrets.DATADOG_API_KEY }}
29+
30+
docker-image:
31+
if: ${{ github.repository == 'github/docs-internal' }}
32+
name: ${{ matrix.ci_job.job }}
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
ci_job: [{ 'job': 'docs-internal-docker-image' }]
37+
uses: github/internal-actions/.github/workflows/kube.yml@main
38+
with:
39+
ci-formatted-job-name: ${{ matrix.ci_job.job }}
40+
vault-keys: ${{ vars.VAULT_KEYS }}
41+
secrets:
42+
dx-bot-token: ${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}
43+
datadog-api-key: ${{ secrets.DATADOG_API_KEY }}
44+
45+
docker-security:
46+
if: ${{ github.repository == 'github/docs-internal' }}
47+
name: ${{ matrix.ci_job.job }}
48+
strategy:
49+
fail-fast: false
50+
matrix:
51+
ci_job: [{ 'job': 'docs-internal-docker-security' }]
52+
uses: github/internal-actions/.github/workflows/docker_security.yml@main
53+
with:
54+
ci-formatted-job-name: ${{ matrix.ci_job.job }}
55+
vault-keys: ${{ vars.VAULT_KEYS }}
56+
secrets:
57+
dx-bot-token: ${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}
58+
datadog-api-key: ${{ secrets.DATADOG_API_KEY }}
59+
60+
permissions:
61+
actions: read
62+
checks: read
63+
contents: read
64+
statuses: read
65+
id-token: write

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ FROM node:22-alpine@sha256:c13b26e7e602ef2f1074aef304ce6e9b7dd284c419b35d89fcf3c
1010
# This directory is owned by the node user
1111
ARG APP_HOME=/home/node/app
1212

13+
# Make sure there's a translations directory available to not error the COPY command
14+
RUN mkdir -p translations && chown -R node:node translations
15+
1316
# Make sure we don't run anything as the root user
1417
USER node
1518

@@ -109,4 +112,4 @@ FROM preview AS production
109112
ENV ENABLED_LANGUAGES "en,zh,es,pt,ru,ja,fr,de,ko"
110113

111114
# Copy in all translations
112-
COPY --chown=node:node translations ./translations
115+
COPY --chown=node:node --from=base translations ./translations
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: webapp
5+
spec:
6+
replicas: 2
7+
selector:
8+
matchLabels:
9+
app: webapp
10+
template:
11+
metadata:
12+
labels:
13+
app: webapp
14+
annotations:
15+
# If you emit structured logs, you can specify a parser to use so your logs are parsed
16+
# properly and are much nicer to query in splunk. For more details, see
17+
# https://thehub.github.com/engineering/development-and-ops/observability/logging/fluent-bit/
18+
# fluentbit.io/parser: logfmt
19+
spec:
20+
dnsPolicy: Default
21+
containers:
22+
- name: webapp
23+
image: docs-internal
24+
resources:
25+
requests:
26+
cpu: 4000m
27+
memory: 5Gi
28+
limits:
29+
cpu: 4000m
30+
memory: 14Gi
31+
ports:
32+
- name: http
33+
containerPort: 4000
34+
protocol: TCP
35+
envFrom:
36+
- secretRef:
37+
name: vault-secrets
38+
- configMapRef:
39+
name: kube-cluster-metadata
40+
# Zero-downtime deploys
41+
# https://thehub.github.com/engineering/products-and-services/internal/moda/feature-documentation/pod-lifecycle/#required-prestop-hook
42+
# https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks
43+
lifecycle:
44+
preStop:
45+
exec:
46+
command: ['sleep', '5']
47+
readinessProbe:
48+
initialDelaySeconds: 5
49+
httpGet:
50+
# WARNING: This should be updated to a meaningful endpoint for your application which will return a 200 once the app is fully started.
51+
# See: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-readiness-probes
52+
path: /healthz
53+
port: http
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: webapp
5+
labels:
6+
service: webapp
7+
annotations:
8+
moda.github.net/domain-name: 'docs-internal.github.com'
9+
moda.github.net/dns-registration-enabled: 'false'
10+
moda.github.net/load-balancer-type:
11+
public-external-http
12+
# moda.github.net/allowed-ips: '23.235.32.0/20,43.249.72.0/22,103.244.50.0/24,103.245.222.0/23,103.245.224.0/24,104.156.80.0/20,140.248.64.0/18,140.248.128.0/17,146.75.0.0/17,151.101.0.0/16,157.52.64.0/18,167.82.0.0/17,167.82.128.0/20,167.82.160.0/20,167.82.224.0/20,172.111.64.0/18,185.31.16.0/22,199.27.72.0/21,199.232.0.0/1'
13+
# ipv6 addresses not included
14+
# curl -i "https://api.fastly.com/public-ip-list"
15+
spec:
16+
ports:
17+
- name: http
18+
port: 4000
19+
protocol: TCP
20+
targetPort: http
21+
selector:
22+
app: webapp
23+
type: LoadBalancer

config/moda/deployment.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
required_builds:
2+
- docs-internal-moda-config-bundle / docs-internal-moda-config-bundle
3+
- docs-internal-docker-image / docs-internal-docker-image
4+
- docs-internal-docker-security / docs-internal-docker-security
5+
environments:
6+
- name: production
7+
auto_deploy: true
8+
cluster_selector:
9+
profile: general
10+
region: iad
11+
notifications:
12+
slack_channels:
13+
- '#docs-ops'

ownership.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
version: 1
3+
ownership:
4+
- team: github/docs-engineering
5+
repo: https://github.com/github/docs-internal
6+
name: docs-internal
7+
kind: moda
8+
long_name: Docs on Moda
9+
description: Please use <https://catalog.githubapp.com/services/docs> instead.
10+
exec_sponsor: nerdneha
11+
product_manager: docs-bot
12+
qos: best_effort
13+
tier: 2
14+
sev1:
15+
pagerduty: https://github.pagerduty.com/escalation_policies#PN57VQ1
16+
tta: 30m
17+
sev2:
18+
issue: https://github.com/github/docs-engineering/issues
19+
tta: 1d
20+
sev3:
21+
issue: https://github.com/github/docs-engineering/issues
22+
tta: 1w

src/workflows/tests/actions-workflows.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const workflowsDir = path.join(__dirname, '../../../.github/workflows')
2727
const workflows: WorkflowMeta[] = fs
2828
.readdirSync(workflowsDir)
2929
.filter((filename) => filename.endsWith('.yml') || filename.endsWith('.yaml'))
30+
.filter((filename) => filename !== 'moda-ci.yaml') // Skip moda-ci
3031
.map((filename) => {
3132
const fullpath = path.join(workflowsDir, filename)
3233
const data = yaml.load(fs.readFileSync(fullpath, 'utf8')) as WorkflowMeta['data']

0 commit comments

Comments
 (0)