Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

droplets: Allow specifying the region for the droplet.

Alex Vandiver738d21f24b68
diff --git a/tools/droplets/README.md b/tools/droplets/README.md
index c39aa592519..dcd71b55d83 100644
--- a/tools/droplets/README.md
+++ b/tools/droplets/README.md
@@ -139,6 +139,7 @@ so they are notified.
closing the connection and shutting the host down.
1. Go to the Snapshots tab on the image, and "Take a Snapshot".
1. Wait for several minutes for it to complete.
+1. "Add to region" the snapshot into `NYC3`, `SFO3`, `BLR1`, and `FRA1`.
1. `curl -u <API_KEY>: https://api.digitalocean.com/v2/snapshots | jq .`
1. Replace `template_id` in `create.py` in this directory with the
appropriate `id`.
diff --git a/tools/droplets/create.py b/tools/droplets/create.py
index 292417d1f6b..67baaba40c6 100644
--- a/tools/droplets/create.py
+++ b/tools/droplets/create.py
@@ -33,6 +33,7 @@ parser.add_argument("--tags", nargs="+", default=[])
parser.add_argument("-f", "--recreate", action="store_true")
parser.add_argument("-s", "--subdomain")
parser.add_argument("-p", "--production", action="store_true")
+parser.add_argument("-r", "--region", choices=("nyc3", "sfo3", "blr1", "fra1"), default="nyc3")
def get_config() -> configparser.ConfigParser:
@@ -175,12 +176,17 @@ service ssh restart
def create_droplet(
- my_token: str, template_id: str, name: str, tags: List[str], user_data: str
+ my_token: str,
+ template_id: str,
+ name: str,
+ tags: List[str],
+ user_data: str,
+ region: str = "nyc3",
) -> str:
droplet = digitalocean.Droplet(
token=my_token,
name=name,
- region="nyc3",
+ region=region,
image=template_id,
size_slug="s-1vcpu-2gb",
user_data=user_data,
@@ -347,6 +353,7 @@ if __name__ == "__main__":
name=droplet_domain_name,
tags=args.tags + ["dev"],
user_data=user_data,
+ region=args.region,
)
create_dns_record(my_token=api_token, record_name=subdomain, ip_address=ip_address)