Skip to content

Commit 1f04d05

Browse files
heschigopherbot
authored andcommitted
vcs-test: move to GKE
We currently run vcs-test as a VM image. Build it out as a GKE service. We run a pod with two containers, one for Apache serving SVN and one for the vcweb server. Because it needs to serve HTTP, not just HTTPS, we use a new ingress that doesn't force HTTPS redirects. Remove /tls, which will be useless now that it's behind a load balancer. AFAICT it's not used anywhere. The server is up and running at 34.110.184.62. $ tail -n1 /etc/hosts 34.110.184.62 vcs-test.golang.org $ git clone https://vcs-test.golang.org/git/gitrepo1 Cloning into 'gitrepo1'... remote: Enumerating objects: 19, done. remote: Counting objects: 100% (19/19), done. remote: Compressing objects: 100% (10/10), done. remote: Total 19 (delta 1), reused 0 (delta 0) Unpacking objects: 100% (19/19), 1.40 KiB | 476.00 KiB/s, done. $ svn co https://vcs-test.golang.org/svn/hello A hello/hello.go Checked out revision 1. For golang/go#53889. Change-Id: I3e3e5078b81867689a8b8dc49dd5914c4a6181f0 Reviewed-on: https://go-review.googlesource.com/c/build/+/418298 Run-TryBot: Heschi Kreinick <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Jenny Rakoczy <[email protected]> Auto-Submit: Heschi Kreinick <[email protected]>
1 parent 7b01ecc commit 1f04d05

14 files changed

+209
-814
lines changed

vcs-test/Dockerfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Copyright 2022 The Go Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style
3+
# license that can be found in the LICENSE file.
4+
5+
FROM golang:1.18 AS build
6+
LABEL maintainer="[email protected]"
7+
8+
RUN mkdir /gocache
9+
ENV GOCACHE /gocache
10+
11+
COPY go.mod /go/src/golang.org/x/build/go.mod
12+
COPY go.sum /go/src/golang.org/x/build/go.sum
13+
14+
WORKDIR /go/src/golang.org/x/build
15+
16+
# Download module dependencies to improve speed of re-building the
17+
# Docker image during minor code changes.
18+
RUN go mod download
19+
20+
COPY . /go/src/golang.org/x/build/
21+
22+
RUN go install golang.org/x/build/vcs-test/vcweb
23+
24+
FROM debian:stable
25+
LABEL maintainer="[email protected]"
26+
27+
# Commands necessary to run various VCS servers.
28+
# Subversion is handled by the Apache sidecar pod.
29+
RUN apt-get update && apt-get install -y \
30+
--no-install-recommends \
31+
ca-certificates \
32+
mercurial \
33+
fossil \
34+
bzr \
35+
git \
36+
tini \
37+
&& rm -rf /var/lib/apt/lists/*
38+
39+
COPY --from=build /go/bin/vcweb /
40+
ENTRYPOINT ["/usr/bin/tini", "--", "/vcweb"]

vcs-test/Dockerfile.apache

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2022 The Go Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style
3+
# license that can be found in the LICENSE file.
4+
5+
FROM debian:stable
6+
LABEL maintainer="[email protected]"
7+
8+
# For interacting with the Go source & subrepos
9+
RUN apt-get update && apt-get install -y \
10+
--no-install-recommends \
11+
apache2 \
12+
libapache2-mod-svn \
13+
subversion \
14+
&& rm -rf /var/lib/apt/lists/*
15+
16+
RUN sed -i 's/80/8888/' /etc/apache2/ports.conf
17+
18+
COPY vcs-test/dav_svn.conf /etc/apache2/mods-enabled/dav_svn.conf
19+
20+
ENTRYPOINT ["apachectl", "-D", "FOREGROUND"]

vcs-test/Makefile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2022 The Go Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style
3+
# license that can be found in the LICENSE file.
4+
5+
MUTABLE_VERSION ?= latest
6+
VERSION ?= $(shell git rev-parse --short HEAD)
7+
8+
IMAGE_PROD := gcr.io/symbolic-datum-552/vcs-test
9+
IMAGE_PROD_APACHE := gcr.io/symbolic-datum-552/vcs-test-apache
10+
11+
docker-prod: Dockerfile Dockerfile.apache
12+
docker build --force-rm -f Dockerfile --tag=$(IMAGE_PROD):$(VERSION) ../
13+
docker tag $(IMAGE_PROD):$(VERSION) $(IMAGE_PROD):$(MUTABLE_VERSION)
14+
docker build --force-rm -f Dockerfile.apache --tag=$(IMAGE_PROD_APACHE):$(VERSION) ../
15+
docker tag $(IMAGE_PROD_APACHE):$(VERSION) $(IMAGE_PROD_APACHE):$(MUTABLE_VERSION)
16+
17+
push-prod: docker-prod
18+
docker push $(IMAGE_PROD):$(VERSION)
19+
docker push $(IMAGE_PROD):$(MUTABLE_VERSION)
20+
docker push $(IMAGE_PROD_APACHE):$(VERSION)
21+
docker push $(IMAGE_PROD_APACHE):$(MUTABLE_VERSION)
22+
23+
24+
deploy-prod: push-prod
25+
go install golang.org/x/build/cmd/xb
26+
xb --prod kubectl --namespace prod set image deployment/vcs-test-deployment vcs-test=$(IMAGE_PROD):$(VERSION) apache=$(IMAGE_PROD_APACHE):$(VERSION)

vcs-test/README.md

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,6 @@
22

33
We run a version control server for testing at `vcs-test.golang.org`.
44

5-
## Machine initialization
6-
7-
The machine should just run. You should not need these instructions very often.
8-
In particular you do not need them just to make a change to `vcweb`.
9-
Skip ahead to the next section.
10-
11-
The VM runs in the builder project “symbolic-datum-552” in zone `us-central1-a`,
12-
where it has a reserved static IP address named `vcs-test`.
13-
14-
To destroy the current VM (if any) and rebuild a fresh one in its place, run:
15-
16-
./rebuild-server.sh && ./rebuild-systemd.sh && ./redeploy-vcweb.sh
17-
18-
You should not need to do this unless you have changed rebuild-server.sh and want to test it.
19-
20-
To delete the VM's current systemd configuration for `vcweb` and upload the configuration
21-
from the local directory (specifically, `vcweb.service` and `vcweb*.socket`), run:
22-
23-
./rebuild-systemd.sh && ./redeploy-vcweb.sh
24-
25-
You should not need to do this unless you have changed the systemd configuration files.
26-
27-
## vcweb
28-
29-
The Go program that runs the actual server is in the subdirectory `vcweb`.
30-
For local development:
31-
32-
go build -o vcweb.exe ./vcweb && ./vcweb.exe
33-
34-
It maintains files in `/tmp/vcweb` and serves localhost:8088.
35-
36-
Once you are happy with local testing, deploy to the VM by running `./redeploy-vcweb.sh`.
37-
385
## Repositories
396

407
The server can serve Bazaar, Fossil, Git, Mercurial, and Subversion repositories.

vcs-test/dav_svn.conf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Location /svn>
2+
DAV svn
3+
SVNParentPath /home/vcweb/svn
4+
<LimitExcept GET PROPFIND OPTIONS REPORT>
5+
Require all denied
6+
</LimitExcept>
7+
</Location>

vcs-test/deployment.yaml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Copyright 2022 Go Authors All rights reserved.
2+
# Use of this source code is governed by a BSD-style
3+
# license that can be found in the LICENSE file.
4+
5+
apiVersion: apps/v1
6+
kind: Deployment
7+
metadata:
8+
namespace: prod
9+
name: vcs-test-deployment
10+
spec:
11+
# Because of the shared disk there can only be one instance.
12+
replicas: 1
13+
strategy:
14+
type: Recreate
15+
16+
selector:
17+
matchLabels:
18+
app: vcs-test
19+
template:
20+
metadata:
21+
labels:
22+
app: vcs-test
23+
spec:
24+
serviceAccountName: vcs-test
25+
volumes:
26+
- name: vcs-test-cache
27+
persistentVolumeClaim:
28+
claimName: vcs-test-cache-claim
29+
containers:
30+
- name: vcs-test
31+
image: gcr.io/symbolic-datum-552/vcs-test:latest
32+
imagePullPolicy: Always
33+
command: ["/usr/bin/tini", "--", "/vcweb", "-d=/home/vcweb", "-listen-https-autocert=:443", "-autocert-bucket=vcs-test-autocert", "-listen-https-selfsigned=:444"]
34+
volumeMounts:
35+
- mountPath: /home/vcweb
36+
name: vcs-test-cache
37+
ports:
38+
- containerPort: 444
39+
resources:
40+
requests:
41+
cpu: "1"
42+
memory: "2Gi"
43+
- name: apache
44+
image: gcr.io/symbolic-datum-552/vcs-test-apache:latest
45+
imagePullPolicy: Always
46+
volumeMounts:
47+
- mountPath: /home/vcweb
48+
name: vcs-test-cache
49+
ports:
50+
- containerPort: 8888
51+
resources:
52+
requests:
53+
cpu: "1"
54+
memory: "1Gi"
55+
---
56+
apiVersion: v1
57+
kind: PersistentVolumeClaim
58+
metadata:
59+
namespace: prod
60+
name: vcs-test-cache-claim
61+
spec:
62+
storageClassName: standard-rwo
63+
accessModes:
64+
- ReadWriteOnce
65+
resources:
66+
requests:
67+
storage: 10Gi
68+
---
69+
apiVersion: v1
70+
kind: Service
71+
metadata:
72+
namespace: prod
73+
name: vcs-test-internal
74+
annotations:
75+
cloud.google.com/neg: '{"ingress": false}'
76+
cloud.google.com/app-protocols: '{"https":"HTTP2"}'
77+
spec:
78+
ports:
79+
- port: 444
80+
targetPort: 444
81+
name: https
82+
selector:
83+
app: vcs-test
84+
type: NodePort
85+
---
86+
apiVersion: networking.k8s.io/v1
87+
kind: Ingress
88+
metadata:
89+
namespace: prod
90+
name: vcs-test-ingress
91+
annotations:
92+
kubernetes.io/ingress.global-static-ip-name: vcs-test-global
93+
networking.gke.io/managed-certificates: vcs-test-cert
94+
ingress.gcp.kubernetes.io/pre-shared-cert: vcs-test-manual
95+
kubernetes.io/ingress.class: "gce"
96+
spec:
97+
rules:
98+
- host: vcs-test.golang.org
99+
http:
100+
paths:
101+
- pathType: ImplementationSpecific
102+
path: /*
103+
backend:
104+
service:
105+
name: vcs-test-internal
106+
port:
107+
number: 444
108+
---
109+
apiVersion: networking.gke.io/v1
110+
kind: ManagedCertificate
111+
metadata:
112+
namespace: prod
113+
name: vcs-test-cert
114+
spec:
115+
domains:
116+
- vcs-test.golang.org

vcs-test/rebuild-server.sh

Lines changed: 0 additions & 39 deletions
This file was deleted.

vcs-test/rebuild-systemd.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

vcs-test/redeploy-vcweb.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

vcs-test/vcweb-http.socket

Lines changed: 0 additions & 10 deletions
This file was deleted.

vcs-test/vcweb-https.socket

Lines changed: 0 additions & 10 deletions
This file was deleted.

vcs-test/vcweb.service

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)