aboutsummaryrefslogtreecommitdiff
path: root/internal/config
AgeCommit message (Collapse)Author
2026-03-27all: run go fix -stringsseqHana Kim
Change-Id: Id22b6fbc926c516043a2a9869ce9042dedebc725 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/753433 Reviewed-by: Jonathan Amsterdam <jba@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-04internal/config: reduce default max idle SQL connectionsMichael Pratt
Prior to CL 747620, we used the database/sql.DB default idle connection limit of 2. An increase from 2 to 10 is quite extreme. If there are many instances, the total number of connections can be quite high. Reduce the limit to 6, which is selected as enough to handle the concurrent requests for median instances. Change-Id: I38772cef6f365a65b82842f5a389e50f6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/751540 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Nicholas Husin <nsh@golang.org> Reviewed-by: Nicholas Husin <husin@google.com>
2026-02-23internal/database: set db connection pool limitsHana Kim
Under high-load, the frontend can issue many queries and trigger many connections. This can exceed the Cloud SQL connection limit of 100 per instance enforced by the Cloud Run environment, even if the database itself has remaining global capacity. To prevent this, we introduce limits on the database connection pool. We also include settings for idle connections and connection lifetimes to ensure better resource management and connection rotation. Introduces new env vars: GO_DISCOVERY_DATABASE_MAX_OPEN_CONNS GO_DISCOVERY_DATABASE_MAX_IDLE_CONNS GO_DISCOVERY_DATABASE_CONN_MAX_LIFETIME GO_DISCOVERY_DATABASE_CONN_MAX_IDLE_TIME Updates SetPoolSettings to validate that MaxIdleConns does not exceed MaxOpenConns, providing a warning if it does and capping it. Change-Id: I74edac05c4a23102d64e74a180c661c223e1b757 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/747620 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Nicholas Husin <nsh@golang.org> Reviewed-by: Nicholas Husin <husin@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
2025-11-05internal/config/serverconfig: randomly pick two DBs from same envHongxiang Jiang
Primary and secondary DB will be derived from a single env var GO_DISCOVERY_DATABASE_HOST. The env GO_DISCOVERY_DATABASE_SECONDARY_HOST will be obsolete. Change-Id: I4c5276c1fef7c93f9abbe5878401f22bdbab69dd Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/717800 Reviewed-by: Nicholas Husin <nsh@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2025-10-28all: remove code for the decommissioned beta environmentNicholas S. Husin
The beta environment is no longer in use. This change removes related logic and references, such as the middleware redirect to beta.pkg.go.dev. Change-Id: I0c6ebbe11d5689ccf2abf8c722399d8dc339db89 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/715321 kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-23all: fix some commentscuishuang
Change-Id: Ia70b35ab9aef270692a3892629c3c81208771089 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/713360 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Sean Liao <sean@liao.dev> kokoro-CI: kokoro <noreply+kokoro@google.com> Auto-Submit: Sean Liao <sean@liao.dev> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
2025-09-08cmd/internal/cmdconfig: include Cloud Run instance ID in logsMichael Pratt
This aids in diagnosing per-instance issues. The instance ID seems like it would belong in the MonitoredResource labels (configured in serverconfig), but the top-level instanceId field is the standard name for this field on Cloud Run. Log messages going directly to stderr (before we configure logging) get this label automatically from the Cloud Run infra. When we use stackdriver directly we apparently need to add this ourselves. See https://cloud.google.com/run/docs/logging#service-fields. Change-Id: I6a6a636cb11a2abc00347e0679605ebbdb9995f4 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/700396 Reviewed-by: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
2023-08-25internal/config: separate config initialization into serverconfigMichael Matloob
This change creates a new package that does config initialization and other GCP-specific operations that were previously done in package config, so that config can have no cloud dependencies. For golang/go#61399 Change-Id: I8d78294834e325b47d838892a1cef87003a4b90a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/522516 Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
2023-08-07internal/config: remove dependency on MonitoredResource protoMichael Matloob
For golang/go#61399 Change-Id: I90070de1c2fcde2bb4056c30637d4ff4fdf100f5 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/515376 kokoro-CI: kokoro <noreply+kokoro@google.com> Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2023-08-04all: switch from github.com/ghodss/yaml to gopkg.in/yaml.v3Michael Matloob
yaml.v3 is the more widely used yaml. The main difference between the two is that ghodss converts yaml to JSON as an intermediate to marshalling and unmarshalling. That means we need to add yaml struct tags to use yaml.v3. Add yaml tags to ConfigOverride and QuotaSettings because yaml.v3 lowercases the names of fields by default and the configs have used uppercase names. Change a test experiment config to use lowercase names since that's what's used in most other configs. For golang/go#61399 Change-Id: Id7f09f2635ee013506b1573bfe555ec0348e60e4 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/514522 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> Reviewed-by: Jamal Carvalho <jamal@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com>
2023-05-04internal/worker: allow worker to process dynamic excluded prefix filesJamal Carvalho
For golang/go#59622. Change-Id: I4059df405e248824a3521fcc084568b052fe4380 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/486458 Reviewed-by: Suzy Mueller <suzmue@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Jamal Carvalho <jamal@golang.org>
2023-03-08internal/config: log quota enforcement parametersHana (Hyang-Ah) Kim
Change-Id: I3f53d86ee7f3a3521678101654d495838738681b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/474455 Reviewed-by: Jonathan Amsterdam <jba@google.com> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> Auto-Submit: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: kokoro <noreply+kokoro@google.com>
2022-06-17many: re-enable staticcheck and fix problemsJonathan Amsterdam
Most of the checks were about io/ioutil. There were a couple of other minor ones. I didn't address the check for strings.Title; instead, I turned off that check globally with a staticcheck.conf file. Change-Id: I286a6894fb1fd891818ab9e451c891f52a3828fc Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/412675 Reviewed-by: Jamal Carvalho <jamal@golang.org> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com>
2022-03-07internal/config: reimplement overrideXXX functions with genericsJonathan Amsterdam
Also, comment out unparam because it doesn't work on generic code yet. Change-Id: I821e29e9011781d851b9b468dae56f47695d7450 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/389655 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2022-03-07many: use strings.CutJonathan Amsterdam
Change-Id: I63aff7182ffba765bbd5b104089562b04bff0960 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/388956 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2022-01-31pkgsite/internal/config: parameterize Postgres sslmodeMarwan Sulaiman
This CL adds a new GO_DISCOVERY_DATABASE_SSL environment variable so that the sslmode in a Postgres database can be configured. It defaults to "disable" to ensure backwards compatibility. Fixes golang/go#49977 Change-Id: I399e32f1a7862c55c7923bc55f465e16b9a5659b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/369314 Trust: Jamal Carvalho <jamal@golang.org> Run-TryBot: Jamal Carvalho <jamal@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2022-01-06cmd,internal: add worker endpoint to clear beta cacheJamal Carvalho
Added an endpoint to clear the cache during cloudbuild deployments of the beta frontend. Change-Id: I3fb19c3f1eef6b1b15eda2601b27a403b39b0f8d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/375956 Trust: Jamal Carvalho <jamal@golang.org> Run-TryBot: Jamal Carvalho <jamal@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-11-19internal/frontend: require header value for debug pagesJonathan Amsterdam
Instead of making the debug pages visible based on an experiment, require a "secret" header value instead. This will make them available at all times in all environments, without a config change. Context: debugging the memory creep we observe on Cloud Run the prod frontend. Change-Id: If78798d838ce774f51117668bfb1d4dd91bfa817 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/365654 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-10-20internal/config: get instance ID from metadataJonathan Amsterdam
If the instance ID is not available from an environment variable, query the GCE metadata for it. This is necessary for Cloud Run. Its instance ID isn't available from an environment variable as App Engine's is, and without something to distinguish instances, metrics from multiple instances look the same and cause the StackDriver error "One or more points were written more frequently than the maximum sampling period configured for the metric." Also, log the monitored resource we use for metrics to aid in debugging. Change-Id: I477644572348bc72440c424ba84c2fc378c3fe35 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/357037 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-10-04internal/config: support Cloud RunJonathan Amsterdam
Add support for services on Cloud Run by looking for Cloud-Run-specific environment variables. Change-Id: I0877bc90ab9b8b9d7a960f82d85a015afdf22d2e Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/353809 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com>
2021-09-07many: replace most uses of strings.SplitN with CutJonathan Amsterdam
In most cases Cut(s, sep) is clearer than strings.SplitN(s, sep, 2). Change-Id: I375c15f778e43ff25b5b74c9ad0e96dac4615786 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/347889 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-09-07internal/frontend: display vulnerabilities on package pageJonathan Amsterdam
Under an experiment, look up and display a package's vulnerabilities on its main page using the client provided by the golang.org/x/vulndb module. For golang/go#48223 Change-Id: I310440db16f8ad5fe582fc8ab42999e874f3ca88 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/347949 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org> Reviewed-by: Julie Qiu <julie@golang.org>
2021-08-06all: delete redis HA clientsJulie Qiu
The redis HA was used by search autocomplete and is no longer used by anything. Change-Id: I39a2c81c47da53823d7b668a980159c4726c6b13 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/340393 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-07-19cmd,devtools,internal/config: set log level in config.InitJulie Qiu
log.SetLevel is now called in config.Init, so that it also applies to logs in the Init function. Change-Id: Id552923b4d81bb1678b8ffa72f1b1d858de559c1 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/335257 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-07-14internal/config: use pkgsite internal/log packageJulie Qiu
The pkgsite logger is now used instead of the log package from the standard library. Change-Id: I5083d8cd6bf7a96a9245f848633b8803d0d80483 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/333931 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-07-12cmd,internal: downgrade logs to debugJulie Qiu
Logs related to reading the experiment config file are downgraded to debug level to reduce noise during development, since these logs appear every minute. Change-Id: I80169a30e6eeb3829be0324fb901a9da13bb8300 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/332376 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-06-21internal/config: don't read local override fileJulie Qiu
Fixes this error: readOverrideFile(ctx, "local-override.yaml"): dialing: google: could not find default credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information. Change-Id: I9478707913487c753143df113ac4fba61bde8df3 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/329501 Trust: Julie Qiu <julie@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-06-18config, etc: remove GO_DISCOVERY_DATABASE_DRIVER env varJonathan Amsterdam
Hard-code "pgx". Change-Id: I5787d67704fddbee2f9b2f7b94497906b168a970 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/329170 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-06-18internal/config: remove GO_DISCOVERY_CONFIG_OVERRIDE env varJonathan Amsterdam
The variable didn't do much: it is set to <env>-override.yaml everywhere. Just hardcode that value. Change-Id: Ie50265d020acd57532e07d95ce8663a2dd488a11 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/329169 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-05-14internal/config: lengthen statement timeoutJonathan Amsterdam
Increase the postgres statement timeout for the session to 30 minutes from 10 minutes. Change-Id: Ibbe6764cb50b986aabe94cd53240fe00bb1d8705 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/320209 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-04-06internal/config: change default database driver to pgxBaokun Lee
As CL 304630 merged, we change the database driver to pgx, this CL change the default driver value in config.go. Change-Id: Ic4697dc83ac03b432fbbca3d7d2cd2f6e0167645 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/307629 Run-TryBot: Baokun Lee <bk@golangcn.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Trust: Baokun Lee <bk@golangcn.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-02-17internal/config: delete unused teeproxy configJulie Qiu
Change-Id: Iae7c1ec13b0ceb26352fa8f06f27cdf6cb3f99e9 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/292854 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-02-12internal/middleware: allow bypassing error reportingJonathan Amsterdam
Use a header to communicate to the error-reporting middleware that an error report should not be sent. This can be used to address item (3) on the issue, duplicate error reporting. For golang/go#44231 Change-Id: I33e91fe6b7af39bf2a2221fe20b16100b956a9e6 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/291489 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2020-12-01internal/config: change TRUE to true and FALSE to falseJulie Qiu
Use lowercase "true" and "false" for environment variables for consistency. Change-Id: I18eb4fed52174d7982c1530339ae36c116c36103 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/274246 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-12-01internal: change QuotaSettings.Disable to EnableJulie Qiu
Previously, the quota server was enabled by default, which caused this error: 2020/11/30 15:53:07 Critical: config.Init(ctx): secrets.Get(ctx, "quota-hmac-key"): need GOOGLE_CLOUD_PROJECT environment variable exit status 1 It is now disabled by default and GO_DISCOVERY_ENABLE_QUOTA needs to be set to enable the service. Fixes golang/go#274232 Change-Id: Iba44ae869dea11c1d5d91544072eba04156daaa8 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/274232 Reviewed-by: Jonathan Amsterdam <jba@google.com> Trust: Julie Qiu <julie@golang.org>
2020-12-01internal/{config,queue}: remove queue serviceJonathan Amsterdam
Remove support for the QueueService config and for queuing tasks for an AppEngine service. Change-Id: I05dcdeaef2e378a5261490badd8b11cd68f64429 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/274494 Trust: Jonathan Amsterdam <jba@google.com> Trust: Julie Qiu <julie@golang.org> Run-TryBot: Jonathan Amsterdam <jba@google.com> Run-TryBot: Julie Qiu <julie@golang.org> Reviewed-by: Julie Qiu <julie@golang.org>
2020-11-30internal/config: remove etlJonathan Amsterdam
Remove the last vestiges of the etl app. Change-Id: Idba2a44aa2a8952b5baf8f5c9e0e4d3b9123da9f Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/274122 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2020-11-30internal/middleware: use redis to store quota informationJonathan Amsterdam
Our previous quota middleware stored data in RAM. That meant that it was ineffective when there were multiple instances (processes) running, because the totals were separate. This CL uses the same redis instance we use for caching to hold the data, so it's shared. Also, previously the only way to set some quota parameters was via the override file, which is intended only for emergencies. Allow the important ones to be set by environment variables, like most of our other config. Also, the rate-limiter package we use requires v8 of the redis client, so move all other uses of it to v8. Change-Id: I1804014030db834a30511786f0a7edfd02e279a5 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/269737 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2020-11-24internal/config: add config for database driverJonathan Amsterdam
The worker and frontend get the driver name from the config struct, via an environment variable. The default is "postgres", which was the previous hardcoded value, so this CL on its own has no effect. Change-Id: Ia1ecd39e15ea75f21dc7c94aa5567b870a646bf7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/272787 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2020-11-20internal: rename tc to testJulie Qiu
The variable tc is renamed to test when used to refer to a test case, for consistency throughout the rest of the codebase, which uses the variable test in most cases. Change-Id: I88a87aa020928af98e8579a299f3111718dfa044 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/271809 Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Trust: Julie Qiu <julie@golang.org>
2020-11-16internal/queue: use time-independent task IDsJonathan Amsterdam
The task names we generated for Cloud Tasks included time information, so that we could control how freqeuently tasks were de-duped. We've been using a 3-hour window, meaning that if a module's task finished or was deleted, another task for that module couldn't be added to the queue (would be de-duped) for 3 hours. This scheme has the unintended consequence that if a module is still on the queue after 3 hours, then another task for the same module could be enqueued (since its task ID would be different). That means that if the queue ever gets 3 hours behind, it could get filled with duplicate modules. For example, this morning the queue had about 25,000 tasks, of which about 7,000 were duplicates. This CL sets a task's name to a function of the module path and version. That will prevent a task on the queue from being duplicated. A repeat task can be added about 1 hour after the previous task finishes or is deleted (see the Task De-duplication section of https://cloud.google.com/tasks/docs/reference/rpc/google.cloud.tasks.v2#task), which is fine. It is still possible to add a suffix to the task name to requeue sooner. Change-Id: I34ffce5ea67b9e00b88ca4cf38182e34a6ba8657 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/270337 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2020-11-09internal/config: use correct cluster nameJonathan Amsterdam
Change-Id: I3f3b81699910c24099ddfff64fc355b657c74071 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/268397 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2020-10-20internal/config: support disabling error reportingJonathan Amsterdam
We don't always want to get emails about errors (for instance, for our dev environment). The product doesn't support selectively emailing by service, so disable error reporting in the binary instead. Change-Id: Ia5abc50a86dbdb22d14cddc36c0450d2e505ff1b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/262997 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2020-09-29internal/config: accept GKE versions for reprocessingJonathan Amsterdam
Change-Id: Ibe9b3d299d0a86f8ddd5ea20582ca4bdd7357f11 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257244 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2020-09-29internal/frontend,middleware: add a handler for page statisticsJonathan Amsterdam
If the GO_DISCOVERY_SERVE_STATS env var is true, add a /detail-stats handler that handles any detail page, but instead of serving the page it serves JSON with page statistics, like timings and size. Implemented as middleware that runs the actual detail handler, bypassing the cache. Will be useful for performance work, like forthcoming doc rendering changes. Change-Id: I738f7413a33caaabc4a116235e68ac3932c18f96 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257245 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2020-09-24internal/config: support dynamic config from a fileJonathan Amsterdam
If the environment doesn't specify a bucket, read the dynamic config from file. If neither is provided, don't crash. Fixes golang/go#41608 Change-Id: I5de91f2e394e9d02d238bcfed3f5e13f173321f9 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257098 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2020-09-23internal/config,others: GetEnvInt dies on parse errorJonathan Amsterdam
Have config.GetEnvInt terminate the program if the environment variable's value is non-empty but not an integer. That's clearly a bug. Also, use it in more places. Change-Id: Ibcc192853e4b5fc01dad709de4de2e5db6fff709 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256760 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2020-09-22internal/config/dynconfig: move dynamic config to its own packageJonathan Amsterdam
This lets us use our log package, and internal.Experiment. Change-Id: I48772c2f5d254cfa57c5b791535b9dad9bd3be8d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256518 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2020-09-21internal/cmdconfig: use dynamic config for experiments on env varJonathan Amsterdam
If the GO_DISCOVERY_EXPERIMENTS_FROM_CONFIG env var is "true", read experiments from dynamic config instead of the database. Temporary, until we switch over completely to dynamic config. For golang/go#41483 Change-Id: Icf6038fb9f2322eba24bedf60450cd9fce84bd6c Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256380 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2020-09-21internal/config: support dynamic configJonathan Amsterdam
Add support for "dynamic" configuration, meaning that the config is not tied to deployment. It is read from a (statically!) configured GCS object, and can be re-read at any time. This CL defines the DynamicConfig struct and provides code to read and parse it. (Reading and parsing are provided as separate exported functions to support checking by a separate tool.) Later CLs will hook it up to the experiments framework. For golang/go#41483 Change-Id: Ic37fdfe9e11682d60e9b8863a79ddf73db3f20fc Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256018 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org> Reviewed-by: Julie Qiu <julie@golang.org>