Skip to content

Commit

Permalink
QOL and Platform
Browse files Browse the repository at this point in the history
  • Loading branch information
ryantanen committed Feb 24, 2025
1 parent fc13773 commit 5eec3f3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 62 deletions.
1 change: 1 addition & 0 deletions docker/waypoint/database-init
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ sudo -u postgres psql -v ON_ERROR_STOP=1 --username "$PG_USER" --dbname "$PG_DAT
BEGIN
IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = 'penn-courses') THEN
CREATE USER "penn-courses" WITH PASSWORD '$PG_PASSWORD';
ALTER USER "penn-courses" WITH SUPERUSER;
END IF;
END
\$\$;
Expand Down
77 changes: 15 additions & 62 deletions docker/waypoint/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
"sha": "723640b1dbb815877c24bb1bc8b729c15e12c87a",
"node_version": "22",
},
"platform": {
"sha": "42c56ff509f60de5389262a9de5e38faf1d9aac2",
"node_version": "22",
}
}

WAYPOINT_DIR = "/opt/waypoint"
Expand Down Expand Up @@ -154,7 +158,8 @@ def init_product(product: str) -> None:
shell=True,
check=True,
)
if (product != "penn-mobile" and product != "penn-courses"):

if product not in ["penn-mobile", "penn-courses", "platform"]:
subprocess.run(
f"bash -c 'source {venv_path} && cd {backend_path} && python manage.py populate'",
shell=True,
Expand All @@ -166,18 +171,13 @@ def init_product(product: str) -> None:
)
sys.exit(1)
# init yarn
if (product != "penn-courses"):
subprocess.run(
f"bash -c 'cd {os.path.join(CODE_DIR, product, 'frontend')} && yarn install'",
shell=True,
check=True,
)
else:

subprocess.run(
f"bash -c 'cd {os.path.join(CODE_DIR, product, 'frontend')} && yarn'",
shell=True,
check=True,
)
if (product is "penn-courses"):
# Yarn install in subfolders, [alert|plan|review]
for folder in ["alert", "plan", "review"]:
subprocess.run(
Expand Down Expand Up @@ -341,31 +341,15 @@ def main() -> None:

init_parser = subparsers.add_parser(
"init",
help="""
-------------Initialize a product environment or all products-----------------
Clones repos, installs dependencies, runs manage.py commands, and yarn install.
If no product is specified, it will initialize all products.
Example: waypoint init office-hours-queue
------------------------------------------------------------------------------
""",
help="Initialize a product environment or all products. Clones repos, installs dependencies, runs manage.py commands, and yarn install. If no product is specified, it will initialize all products."
)
init_parser.add_argument(
"product", help="Product to initialize", nargs="?", default=None
)

switch_parser = subparsers.add_parser(
"switch",
help="""
-------------Switch to a product environment-------------
Starts the uv virtual enviroment assosiated with the product
Opens the product in VSCode if in a dev container.
You can also specify --no-vsc to not open VSCode.
Example: waypoint switch office-hours-queue --no-vsc
---------------------------------------------------------""",
help="Switch to a product environment. Starts the uv virtual environment associated with the product and opens the product in VSCode if in a dev container. Use --no-vsc to not open VSCode."
)
switch_parser.add_argument(
"product", help="Product to switch to, options: " + ", ".join(PRODUCTS.keys())
Expand All @@ -376,53 +360,22 @@ def main() -> None:

subparsers.add_parser(
"start",
help="""
-------------Start both the backend and frontend of the current development environment-------------
Runs `python manage.py runserver` and `yarn dev` in the appropriate directories.
Note: Must be in a dev container to run this command.
Example: waypoint start
----------------------------------------------------------------------------------------------------
""",
help="Start both the backend and frontend of the current development environment. Runs `python manage.py runserver` and `yarn dev` in the appropriate directories."
)

subparsers.add_parser(
"backend",
help="""
-------------Start current product backend-------------------
Runs `python manage.py runserver` in the appropriate directory.
Note: Must be in a dev container to run this command.
Example: waypoint backend
-------------------------------------------------------------
""",
help="Start the current product backend. Runs `python manage.py runserver` in the appropriate directory."
)

subparsers.add_parser(
"frontend",
help="""
-------------Start current product frontend-------------------
Runs `yarn dev` in the appropriate directory.
Note: Must be in a dev container to run this command.
Example: waypoint frontend
-------------------------------------------------------------
"""
help="Start the current product frontend. Runs `yarn dev` in the appropriate directory."
)

services_parser = subparsers.add_parser(
"services",
help="""
-------------Manage background services----------------------
Starts, stop or chec the status of the PostgreSQL and Redis services.
If no mode is specified, it will start the services.
Example: waypoint services start
-------------------------------------------------------------
""",
help="Manage background services. Starts, stops, or checks the status of the PostgreSQL and Redis services. If no mode is specified, it will start the services."
)
services_parser.add_argument(
"mode",
Expand Down
2 changes: 2 additions & 0 deletions docker/waypoint/waypoint-init
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ PRODUCT_TO_SHA=(
["penn-clubs"]="d2e5758f1498b17cd3f20d08c37969d3e8c9c7bd"
["penn-mobile"]="b1a8bfa53a35496c972b880f7e3ab9d93845b614"
["penn-courses"]="723640b1dbb815877c24bb1bc8b729c15e12c87a"
["platform"]="42c56ff509f60de5389262a9de5e38faf1d9aac2"
)

PRODUCT_TO_NODE_VERSION=(
["office-hours-queue"]="22"
["penn-clubs"]="20"
["penn-mobile"]="22"
["penn-courses"]="22"
["platform"]="22"
)


Expand Down

0 comments on commit 5eec3f3

Please sign in to comment.