Skip to content

Commit dec67a6

Browse files
committed
Add localhost endpoints and add jobs to support local games and services
Add http localhost endpoints and add job to print hosts Add ability to proxy local services into the cluster Add job to update faf featured mod files with the existing files to launch games Fix faf_data_dir being None Add reloader auto to each pod Allow alternative name for ergochat server Undo ergochat servername change Fix tiltfile Support proxying services with no ingress Add default data directory for linux Make base domain configurable for local setup with tilt
1 parent 72f3370 commit dec67a6

File tree

11 files changed

+237
-92
lines changed

11 files changed

+237
-92
lines changed

README.MD

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,21 @@ This repository aims to provide a ready-to-go [Tilt](https://docs.tilt.dev/) set
6969
## Prerequisites
7070
* [Tilt](https://docs.tilt.dev/install.html)
7171
* Kubernetes ([Docker Desktop](https://docs.docker.com/desktop/kubernetes/) or [Minikube](https://minikube.sigs.k8s.io/docs/) are recommended for those new to kubernetes) [Tilt cluster setup](https://docs.tilt.dev/choosing_clusters)
72-
* For Windows users a bash program. By default git bash is used with an assumed installation directory of C:/Program Files/Git
7372
* [helm](https://helm.sh/docs/intro/install/) must be installed to generate the k8s from the helm charts in the gitops repo
73+
* For Windows users:
74+
* A bash program. By default git bash is used with an assumed installation directory of C:/Program Files/Git
7475

7576
## Startup Services
7677
In the root directory of the repository run `tilt up`. This will start all the faf services in the correct order. The status of each service can be viewed in the tilt UI by visiting <http://localhost:10350>. This is the control server for tilt where you can restart services or disable them for substitution by services you would like to run from source code as you actively develop them.
7778

7879
## Development
79-
To develop against the FAF infrastructure you should disable the service in tilt that you are actively developing. Once disabled you can start up your developed version. Some tweaks may need to be made to the default configuration parameters in the source code. The proper values can be found in the configMaps in each of the services kubernetes deploy yaml files.
80+
To develop against the FAF infrastructure you can insert the service in tilt that you are actively developing by adding it to the local_services list in your tilt_config.json file or as --local_services when you run tilt up. This will proxy the connections in the cluster to that service to your locally running instance. Some tweaks may need to be made to the default configuration parameters in the source code. The proper values can be found in the configMaps in each of the services kubernetes deploy yaml files. You may need to specify your host-ip in the config or arguments in order to get the proxied connections to work
8081

8182
## Test Data
82-
The default test data that is loaded can be found in [faf-db](https://github.com/FAForever/db/blob/develop/test-data.sql)
83+
The default test data that is loaded can be found in [faf-db](https://github.com/FAForever/db/blob/develop/test-data.sql).
84+
You can load the data at anytime by manually triggering the popualte-db resource under the Database label. This needs to be done the first time for data to exist.
85+
86+
## Endpoints
87+
Locally traefik uses the same ingress routes as we do in production just with a default base domain of faforever.localhost. So accessible domains will be api.faforever.localhost, hydra.faforever.localhost etc. By default these should resolve to 127.0.0.1. If they do not you can manually modify your hosts file to add the local dns records. For convenience the resource create-hosts-file-content
88+
will output the necessary lines for the hosts file when run after every service has started.
8389

Tiltfile

Lines changed: 163 additions & 78 deletions
Large diffs are not rendered by default.

apps/nodebb/templates/local-secret.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ stringData:
99
OAUTH_SECRET: "banana"
1010
"config.json": |
1111
{
12-
"url": "https://forum.localhost",
12+
"url": "https://forum.{{ .Values.baseDomain }}",
1313
"secret": "banana",
1414
"database": "mongo",
1515
"port": 4567,

cluster/traefik/values-local.yaml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@ traefik:
22
deployment:
33
enabled: true
44

5+
ingressRoute:
6+
dashboard:
7+
enabled: true
8+
matchRule: Host(`traefik.faforever.localhost`)
9+
entryPoints: ["websecure", "web"]
10+
511
additionalArguments:
612
- "--entrypoints.websecure.http.encodequerysemicolons=true"
13+
- "--entrypoints.web.http.encodequerysemicolons=true"
714

815
updateStrategy:
916
type: Recreate
1017

11-
hostNetwork: true
18+
hostNetwork: false
1219

1320
ports:
1421
metrics:
@@ -17,11 +24,9 @@ traefik:
1724
port: 9101
1825

1926
web:
20-
redirections:
21-
entryPoint:
22-
to: websecure
23-
scheme: https
24-
permanent: true
27+
transport:
28+
respondingTimeouts:
29+
readTimeout: 60
2530

2631
websecure:
2732
transport:
@@ -33,7 +38,7 @@ traefik:
3338

3439
# HostNetwork
3540
service:
36-
enabled: false
41+
enabled: true
3742

3843
logs:
3944
general:
@@ -43,3 +48,9 @@ traefik:
4348
# By default, the level is set to ERROR.
4449
# -- Alternative logging levels are DEBUG, PANIC, FATAL, ERROR, WARN, and INFO.
4550
level: INFO
51+
access:
52+
enabled: true
53+
54+
providers:
55+
kubernetesCRD:
56+
allowExternalNameServices: true

config/local.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
hostName: "localhost"
22
environment: "local"
3-
baseDomain: "localhost"
3+
baseDomain: "faforever.localhost"
44
infisical-secret:
55
enabled: false
66
traefik: {}

tilt/helm/host-proxy/Chart.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
apiVersion: v2
2+
name: host-proxy
3+
version: 1.0.0
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{- if .Values.hostIP }}
2+
apiVersion: v1
3+
kind: Endpoints
4+
metadata:
5+
name: {{.Values.name}}
6+
subsets:
7+
- addresses:
8+
- ip: {{.Values.hostIP}}
9+
ports:
10+
- port: {{.Values.port}}
11+
{{- end }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{.Values.name}}
5+
spec:
6+
{{- if .Values.hostIP }}
7+
clusterIP: None
8+
ports:
9+
- protocol: "TCP"
10+
port: {{.Values.port}}
11+
targetPort: {{.Values.port}}
12+
{{ else }}
13+
type: ExternalName
14+
externalName: {{.Values.hostname}}
15+
{{- end }}

tilt/scripts/helm-with-cache.sh

100644100755
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#!/bin/bash
22

3-
cache_dir=$1
3+
chart_cache_dir=$1
44
shift
55

66
chart=$1
7-
chart_cache_dir="$cache_dir/$chart"
87

98
mkdir -p "$chart_cache_dir"
109

tilt/scripts/print-hosts.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
kubectl get IngressRoute -A -o yaml | grep -Po 'Host\(`(.*?)`\)' | sed 's/^.\{6\}\(.*\).\{2\}$/127.0.0.1 \1/' | uniq

0 commit comments

Comments
 (0)