admingolangorg: move to symbolic-datum-552 on admin.go.dev

This way nothing in the golang-org project needs IAP.
Leave behind a redirect on admin.golang.org to admin.go.dev.

Also rename app to adminapp; add new redirector adminredirect.

Change-Id: I062d92db31e39a7f58fd3aad77fc5eef64e3f0dd
Reviewed-on: https://go-review.googlesource.com/c/website/+/495275
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
Russ Cox 2023-05-16 12:14:14 -04:00
Родитель 53bf622d51
Коммит 4fc81e6d7c
11 изменённых файлов: 79 добавлений и 17 удалений

Просмотреть файл

@ -1,4 +1,4 @@
# The admingolangorg program needs a fairly short list of things
# The adminapp program needs a fairly short list of things
# from the golang.org/x/website repository that probably doesn't
# change often. Filter everything else out implicitly as long as
# this approach needs less maintenance.
@ -6,7 +6,7 @@
!go.mod
!go.sum
!cmd/
!cmd/admingolangorg/**
!cmd/adminapp/**
!internal/
!internal/short/**
!internal/memcache/**

13
cmd/adminapp/README.md Normal file
Просмотреть файл

@ -0,0 +1,13 @@
# adminapp
This app serves as the [admin interface](https://admin.go.dev/) for the go.dev/s link shortener. It can also remove unwanted playground snippets.
## Deployment:
To update the public site, run:
```
gcloud app --project=symbolic-datum-552 deploy --promote app.yaml
```
We used to use admin.golang.org. Now we run a redirector there. See ../adminredirect.

Просмотреть файл

@ -1,11 +1,11 @@
service: admin
service: default
runtime: go119
main: ./cmd/admingolangorg
main: ./cmd/adminapp
env_variables:
GOLANGORG_REDIS_ADDR: 10.0.0.4:6379 # instance "gophercache"
DATASTORE_PROJECT_ID: golang-org
IAP_AUDIENCE: /projects/397748307997/apps/golang-org
IAP_AUDIENCE: /projects/872405196845/apps/symbolic-datum-552
handlers:
- url: .*
@ -13,4 +13,4 @@ handlers:
secure: always
vpc_access_connector:
name: 'projects/golang-org/locations/us-central1/connectors/golang-vpc-connector'
name: 'projects/symbolic-datum-552/locations/us-central1/connectors/app-engine-vpc'

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -1,11 +0,0 @@
# admingolangorg
This app serves as the [admin interface](https://admin-dot-golang-org.appspot.com) for the go.dev/s link shortener. It can also remove unwanted playground snippets.
## Deployment:
To update the public site, run:
```
gcloud app --project=golang-org deploy --promote app.yaml
```

Просмотреть файл

@ -0,0 +1,9 @@
# The adminredirect program needs nothing else from the golang.org/x/website repository.
# Filter everything else out to avoid maintenance.
**
!go.mod
!go.sum
!cmd/
!cmd/adminredirect/**
.gcloudignore

Просмотреть файл

@ -0,0 +1,9 @@
This app redirects traffic at https://admin.golang.org/ to the new admin app.
## Deployment
To update the redirector, run:
```
gcloud app --project=golang-org deploy --promote app.yaml
```

Просмотреть файл

@ -0,0 +1,11 @@
service: admin
runtime: go119
main: ./cmd/adminredirect
env_variables:
REDIRECT: https://admin.go.dev/
handlers:
- url: .*
script: auto
secure: always

31
cmd/adminredirect/main.go Normal file
Просмотреть файл

@ -0,0 +1,31 @@
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// The adminredirect app redirects traffic to the new admin host.
package main
import (
"log"
"net/http"
"os"
)
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "8080"
log.Printf("Defaulting to port %s", port)
}
redirect := os.Getenv("REDIRECT")
if redirect == "" {
log.Fatalf("redirect not set")
}
h := func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, redirect, http.StatusSeeOther)
}
log.Printf("Listening on port %s", port)
log.Fatal(http.ListenAndServe(":"+port, http.HandlerFunc(h)))
}