From c7dab214cd4437465570376e66d1726a053dd679 Mon Sep 17 00:00:00 2001
From: "Carol (Nichols || Goulding)" <carol.nichols@gmail.com>
Date: Mon, 4 Apr 2022 14:19:09 -0400
Subject: [PATCH 1/4] Move crates.io removal instructions to crates.io ops
 guide

Merge docs.rs instructions into the docs.rs page.
---
 src/SUMMARY.md                 |  1 -
 src/crates-io/crate-removal.md | 48 ----------------------------------
 src/docs-rs/maintenance.md     | 15 ++++++++---
 3 files changed, 12 insertions(+), 52 deletions(-)
 delete mode 100644 src/crates-io/crate-removal.md

diff --git a/src/SUMMARY.md b/src/SUMMARY.md
index 722004242..bf6846787 100644
--- a/src/SUMMARY.md
+++ b/src/SUMMARY.md
@@ -30,7 +30,6 @@
         - [How to run the planning meeting](./compiler/steering-meeting/how-to-run-planning.md)
         - [How to run a design meeting](./compiler/steering-meeting/how-to-run-design.md)
 - [crates.io](./crates-io/README.md)
-    - [Crate removal](./crates-io/crate-removal.md)
     - [Database maintenance](./crates-io/db-maintenance.md)
 - [docs.rs](./docs-rs/README.md)
   - [Adding dependencies to the build environment](./docs-rs/add-dependencies.md)
diff --git a/src/crates-io/crate-removal.md b/src/crates-io/crate-removal.md
deleted file mode 100644
index 0bd451044..000000000
--- a/src/crates-io/crate-removal.md
+++ /dev/null
@@ -1,48 +0,0 @@
-# Crate removal procedure
-
-If we get a DMCA takedown notice, here's what needs to happen:
-
-## Contact Legal
-
-Before removing the crates, get in touch with legal support, currently by
-emailing the Core team, and ask an opinion from them on the received request and
-whether we have to comply with it.
-
-## Remove relevant version(s) and/or entire crates from crates.io
-
-* Remove it from the database:
-
-      heroku run -a crates-io -- target/release/crates-admin delete-crate [crate-name]
-
-  or
-
-      heroku run -a crates-io -- target/release/crates-admin delete-version [crate-name] [version-number]
-
-* Remove the crate or version from the index. To remove an entire crate, remove
-  the entire crate file. For a version, remove the line corresponding to the
-  relevant version.
-
-* Remove the crate archive(s) and readme file(s) from S3.
-
-* Invalidate the CloudFront cache:
-
-  ```
-  aws cloudfront create-invalidation --distribution-id EJED5RT0WA7HA --paths '/*'
-  ```
-
-## Remove entire crates from docs.rs
-
-The docs.rs application supports deleting all the documentation ever published
-of a crate, by running a CLI command. The people who currently have permissions
-to access the server and run it are:
-
-* docs.rs Team:
-  * [@pietroalbini](https://github.com/pietroalbini)
-  * [@jyn514](https://github.com/jyn514)
-* Infrastructure Team:
-  * [@Mark-Simulacrum](https://github.com/Mark-Simulacrum)
-* People with elevated 1password access
-
-You can find the documentation on how to run the command [here][docsrs-howto].
-
-[docsrs-howto]: https://forge.rust-lang.org/infra/docs/docs-rs.html#removing-a-crate-from-the-website
diff --git a/src/docs-rs/maintenance.md b/src/docs-rs/maintenance.md
index 2f473cb0a..fe5cd01f9 100644
--- a/src/docs-rs/maintenance.md
+++ b/src/docs-rs/maintenance.md
@@ -122,9 +122,18 @@ UPDATE queue SET attempt = 0 WHERE attempt >= 5 AND build_time > 'YYYY-MM-DD HH:
 
 ## Removing a crate from the website
 
-Sometimes it might be needed to remove all the content related to a crate from
-docs.rs (for example after receiving a DMCA). To do that, log into the server
-and run:
+The docs.rs application supports deleting all the documentation ever published
+of a crate (for example after receiving a DMCA), by running a CLI command. The
+people who currently have permissions to access the server and run it are:
+
+* docs.rs Team:
+  * [@pietroalbini](https://github.com/pietroalbini)
+  * [@jyn514](https://github.com/jyn514)
+* Infrastructure Team:
+  * [@Mark-Simulacrum](https://github.com/Mark-Simulacrum)
+* People with elevated 1password access
+
+If you are one of these people, log into the server and run:
 
 ```
 cratesfyi database delete-crate CRATE_NAME

From 9cdbd00bcc74c6a9e851c180c86921040ead6e0e Mon Sep 17 00:00:00 2001
From: "Carol (Nichols || Goulding)" <carol.nichols@gmail.com>
Date: Fri, 6 May 2022 16:20:28 -0400
Subject: [PATCH 2/4] Remove obsolete crates.io database maintenance page

The instructions in the crates.io ops guide are newer.
---
 src/SUMMARY.md                  |   1 -
 src/crates-io/db-maintenance.md | 203 --------------------------------
 2 files changed, 204 deletions(-)
 delete mode 100644 src/crates-io/db-maintenance.md

diff --git a/src/SUMMARY.md b/src/SUMMARY.md
index bf6846787..cccab594d 100644
--- a/src/SUMMARY.md
+++ b/src/SUMMARY.md
@@ -30,7 +30,6 @@
         - [How to run the planning meeting](./compiler/steering-meeting/how-to-run-planning.md)
         - [How to run a design meeting](./compiler/steering-meeting/how-to-run-design.md)
 - [crates.io](./crates-io/README.md)
-    - [Database maintenance](./crates-io/db-maintenance.md)
 - [docs.rs](./docs-rs/README.md)
   - [Adding dependencies to the build environment](./docs-rs/add-dependencies.md)
   - [Self-hosting a docs.rs instance](./docs-rs/self-hosting.md)
diff --git a/src/crates-io/db-maintenance.md b/src/crates-io/db-maintenance.md
deleted file mode 100644
index c548cfc0d..000000000
--- a/src/crates-io/db-maintenance.md
+++ /dev/null
@@ -1,203 +0,0 @@
-# Database maintenance
-
-There are times when Heroku needs to perform a maintenance on our database
-instances, for example to apply system updates or upgrade to a newer database
-server.
-
-We must **not** let Heroku run maintenances during the maintenance window to
-avoid disrupting production users (move the maintenance window if necessary).
-This page contains the instructions on how to perform the maintenance with the
-minimum amount of disruption.
-
-# Primary database
-
-Performing maintenance on the primary database requires us to temporarily put
-the application in read-only mode. Heroku performs maintenances by creating a
-hidden database follower and switching over to it, so we need to prevent writes
-on the primary to let the follower catch up.
-
-Maintenance should take less than 5 minutes of read-only time, but we should
-still announce it ahead of time on our status page. This is a sample message we
-can use:
-
-> The crates.io team will perform a database maintenance on YYYY-MM-DD from
-> hh:mm to hh:mm UTC.
->
-> We expect this to take less than 5 minutes to complete. During maintenance
-> crates.io will only be available in read-only mode: downloading crates and
-> visiting the website will still work, but logging in, publishing crates,
-> yanking crates or changing owners will not work.
-
-## Primary database checklist
-
-**1 hour before the maintenance**
-
-1. Go into the Heroku Scheduler and disable the job enqueueing the downloads
-   count updater. You can "disable" it by changing its schedule not to run
-   during the maintenance window. The job uses a lot of database resources, and
-   we should not run it during maintenance.
-
-**5 minutes before the maintenance**
-
-2. Scale the background worker to 0 instances:
-
-   ```
-   heroku ps:scale -a crates-io background_worker=0
-   ```
-
-**At the start of the maintenance**
-
-3. Update the status page with this message:
-
-   > Scheduled maintenance on our database is starting.
-   >
-   > We expect this to take less than 5 minutes to complete. During maintenance
-   > crates.io will only be available in read-only mode: downloading crates and
-   > visiting the website will still work, but logging in, publishing crates,
-   > yanking crates or changing owners will not work.
-
-3. Configure the application to be in read-only mode without the follower:
-
-   ```
-   heroku config:set -a crates-io READ_ONLY_MODE=1 DB_OFFLINE=follower
-   ```
-
-   The follower is removed because while Heroku tries to prevent connections to
-   the primary database from failing during maintenance we observed that the
-   same does not apply to the follower database, and there could be brief
-   periods while the follower is not available.
-
-3. Wait for the application to be redeployed with the new configuration:
-
-    ```
-    heroku ps:wait -a crates-io
-    ```
-
-3. Run the database maintenance:
-
-   ```
-   heroku pg:maintenance:run --force -a crates-io
-   ```
-
-1. Wait for the maintenance to finish:
-
-    ```
-    heroku pg:wait -a crates-io
-    ```
-
-3. Confirm all the databases are online:
-
-   ```
-   heroku pg:info -a crates-io
-   ```
-
-3. Confirm the primary database fully recovered (should output `false`):
-
-   ```
-   echo "SELECT pg_is_in_recovery();" | heroku pg:psql -a crates-io DATABASE
-   ```
-
-3. Switch off read-only mode:
-
-   ```
-   heroku config:unset -a crates-io READ_ONLY_MODE
-   ```
-
-   **WARNING:** the Heroku Dashboard's UI is misleading when removing an
-   environment variable. A red badge with a "-" (minus) in it means the
-   variable was *successfully removed*, it doesn't mean removing the variable
-   failed.  Failures are indicated with a red badge with a "x" (cross) in it.
-
-3. Wait for the application to be redeployed with the new configuration:
-
-    ```
-    heroku ps:wait -a crates-io
-    ```
-
-3. Update the status page and mark the maintenance as completed with this
-   message:
-
-   > Scheduled maintenance finished successfully.
-
-   The message is posted right now and not at the end because this is when
-   production users are not impacted by the maintenance anymore.
-
-3. Scale the background worker up again:
-
-   ```
-   heroku ps:scale -a crates-io background_worker=1
-   ```
-
-3. Confirm the follower database is available:
-
-   ```
-   echo "SELECT 1;" | heroku pg:psql -a crates-io READ_ONLY_REPLICA
-   ```
-
-3. Enable connections to the follower:
-
-   ```
-   heroku config:unset -a crates-io DB_OFFLINE
-   ```
-
-3. Re-enable the background job disabled during step 1.
-
-# Follower database
-
-Performing maintenance on the follower database doesn’t require any external
-communication nor putting the application in read-only mode, as we can just
-redirect all of the follower’s traffic to the primary database. It shouldn’t be
-done during peak traffic periods though, as we’ll increase the primary database
-load by doing this.
-
-## Follower database checklist
-
-**At the start of the maintenance**
-
-1. Configure the application to operate without the follower:
-
-    ```
-    heroku config:set -a crates-io DB_OFFLINE=follower
-    ```
-
-1. Wait for the application to be redeployed with the new configuration:
-
-    ```
-    heroku ps:wait -a crates-io
-    ```
-
-1. Start the database maintenance:
-
-    ```
-    heroku pg:maintenance:run --force -a crates-io READ_ONLY_REPLICA
-    ```
-
-1. Wait for the maintenance to finish:
-
-    ```
-    heroku pg:wait -a crates-io READ_ONLY_REPLICA
-    ```
-
-1. Confirm the follower database is ready:
-
-    ```
-    heroku pg:info -a crates-io
-    ```
-
-1. Confirm the follower database is responding to queries:
-
-    ```
-    echo "SELECT 1;" | heroku pg:psql -a crates-io READ_ONLY_REPLICA
-    ```
-
-1. Enable connections to the follower:
-
-    ```
-    heroku config:unset -a crates-io DB_OFFLINE
-    ```
-
-1. Wait for the application to be redeployed with the new configuration.
-
-    ```
-    heroku ps:wait -a crates-io
-    ```

From 76e6c1973a94f39e94f873ea03e816ccc0c1607f Mon Sep 17 00:00:00 2001
From: "Carol (Nichols || Goulding)" <carol.nichols@gmail.com>
Date: Fri, 6 May 2022 16:21:03 -0400
Subject: [PATCH 3/4] Point to the crates.io ops guide on the crates.io page

---
 src/crates-io/README.md | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/crates-io/README.md b/src/crates-io/README.md
index ca189a0ce..6f5dc37da 100644
--- a/src/crates-io/README.md
+++ b/src/crates-io/README.md
@@ -1,3 +1,8 @@
 # crates.io
 
-This section documents the processes of the crates.io team.
+The crates.io team has [its own operations guide][ops] in [a private repo][repo]. Contact [a member
+of the crates.io team][team] if you need access to the crates.io ops guide.
+
+[ops]: https://ops-guide.crates.io/
+[repo]: https://github.com/rust-lang/crates-io-ops-guide
+[team]: https://www.rust-lang.org/governance/teams/crates-io

From d0b9b7ebbc6666c4d5992a997085bad0a0e192ae Mon Sep 17 00:00:00 2001
From: Denis Cornehl <denis@cornehl.org>
Date: Wed, 18 May 2022 19:10:49 +0200
Subject: [PATCH 4/4] docs.rs maintenance: fix delete crate command, update
 users with server access

---
 src/docs-rs/maintenance.md | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/docs-rs/maintenance.md b/src/docs-rs/maintenance.md
index fe5cd01f9..713191f7d 100644
--- a/src/docs-rs/maintenance.md
+++ b/src/docs-rs/maintenance.md
@@ -129,6 +129,8 @@ people who currently have permissions to access the server and run it are:
 * docs.rs Team:
   * [@pietroalbini](https://github.com/pietroalbini)
   * [@jyn514](https://github.com/jyn514)
+  * [@syphar](github.com/syphar)
+  * [@Nemo157](https://github.com/nemo157)
 * Infrastructure Team:
   * [@Mark-Simulacrum](https://github.com/Mark-Simulacrum)
 * People with elevated 1password access
@@ -136,7 +138,7 @@ people who currently have permissions to access the server and run it are:
 If you are one of these people, log into the server and run:
 
 ```
-cratesfyi database delete-crate CRATE_NAME
+cratesfyi database delete crate CRATE_NAME
 ```
 
 The command will remove all the data from the database, and then remove the