Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions scripts/install_postgres17.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

#!/usr/bin/env python3
import subprocess
import sys

def run(cmd, check=True):
print(f"$ {cmd}")
result = subprocess.run(cmd, shell=True, check=check)
return result

def main():
print("==> Installing dependencies...")
run("apt install -y curl ca-certificates")

print("\n==> Setting up PostgreSQL signing key...")
run("install -d /usr/share/postgresql-common/pgdg")
run(
"curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail "
"https://www.postgresql.org/media/keys/ACCC4CF8.asc"
)

print("\n==> Detecting Ubuntu codename...")
codename = subprocess.check_output("lsb_release -cs", shell=True).decode().strip()
print(f" Detected: {codename}")

print("\n==> Adding PGDG apt repository...")
repo_line = (
f"deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] "
f"https://apt.postgresql.org/pub/repos/apt {codename}-pgdg main"
)
with open("/etc/apt/sources.list.d/pgdg.list", "w") as f:
f.write(repo_line + "\n")
print(f" Written: {repo_line}")

print("\n==> Updating apt package lists...")
run("apt update")

print("\n==> Installing PostgreSQL 17...")
run("apt install -y postgresql-17")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we installing PostgreSQL when we have a PostgreSQL container already?


print("\n✅ PostgreSQL 17 installed successfully.")

if __name__ == "__main__":
if subprocess.run("id -u", shell=True, capture_output=True).stdout.strip() != b"0":
print("This script must be run as root. Try: sudo python3 install_postgres17.py")
sys.exit(1)
main()
2 changes: 1 addition & 1 deletion wcoa/migrations/0030_ohidashboard_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='ohidashboard',
name='body',
field=wagtail.fields.StreamField([('content', wagtail.blocks.RichTextBlock(required=False))], default='{"blocks":[{"key":"j9bes","text":"one","type":"ordered-list-item","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}},{"key":"e9r3j","text":"","type":"ordered-list-item","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}', use_json_field=True),
field=wagtail.fields.StreamField([('content', wagtail.blocks.RichTextBlock(required=False))], default=list, use_json_field=True),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks MUCH cleaner! Why did we need all the old gibberish, and/or what changed so we don't need it now?

preserve_default=False,
),
]