From cd17ef04006b9a65ecb46fd25851c799d107dff6 Mon Sep 17 00:00:00 2001 From: Jashandeep Sohi Date: Tue, 11 Feb 2025 14:10:52 -0800 Subject: [PATCH 1/9] update to use shared devenv-k8s cluster for local dev --- .envrc | 13 + .gitignore | 1 + README.md | 45 +- develop.sh | 6 + flake.lock | 576 +++--------------- flake.nix | 20 +- k8s/envs/local-deps/ing-minio/Kptfile | 20 + k8s/envs/local-deps/ing-minio/README.md | 40 ++ k8s/envs/local-deps/ing-minio/ing.yaml | 31 + .../local-deps/ing-minio/kustomization.yaml | 11 + .../remove-kpt-internal-annotations/Kptfile | 20 + .../remove-kpt-internal-annotations/README.md | 25 + .../kustomization.yaml | 13 + k8s/envs/local-deps/kustomization.yaml | 1 + k8s/envs/local/ing-server/Kptfile | 20 + k8s/envs/local/ing-server/README.md | 40 ++ k8s/envs/local/ing-server/ing.yaml | 20 + k8s/envs/local/ing-server/kustomization.yaml | 11 + .../remove-kpt-internal-annotations/Kptfile | 20 + .../remove-kpt-internal-annotations/README.md | 25 + .../kustomization.yaml | 13 + k8s/envs/local/kustomization.yaml | 12 + k8s/envs/local/settings.env | 2 +- local-cluster.yaml | 6 - local-registry.yaml | 4 - mop/settings.py | 2 + skaffold.yaml | 4 - 27 files changed, 479 insertions(+), 522 deletions(-) create mode 100644 .envrc create mode 100755 develop.sh create mode 100644 k8s/envs/local-deps/ing-minio/Kptfile create mode 100644 k8s/envs/local-deps/ing-minio/README.md create mode 100644 k8s/envs/local-deps/ing-minio/ing.yaml create mode 100644 k8s/envs/local-deps/ing-minio/kustomization.yaml create mode 100644 k8s/envs/local-deps/ing-minio/remove-kpt-internal-annotations/Kptfile create mode 100644 k8s/envs/local-deps/ing-minio/remove-kpt-internal-annotations/README.md create mode 100644 k8s/envs/local-deps/ing-minio/remove-kpt-internal-annotations/kustomization.yaml create mode 100644 k8s/envs/local/ing-server/Kptfile create mode 100644 k8s/envs/local/ing-server/README.md create mode 100644 k8s/envs/local/ing-server/ing.yaml create mode 100644 k8s/envs/local/ing-server/kustomization.yaml create mode 100644 k8s/envs/local/ing-server/remove-kpt-internal-annotations/Kptfile create mode 100644 k8s/envs/local/ing-server/remove-kpt-internal-annotations/README.md create mode 100644 k8s/envs/local/ing-server/remove-kpt-internal-annotations/kustomization.yaml delete mode 100644 local-cluster.yaml delete mode 100644 local-registry.yaml diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..f829fbc --- /dev/null +++ b/.envrc @@ -0,0 +1,13 @@ +if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM=" +fi + +watch_file flake.nix +watch_file flake.lock + +DEVENV_ROOT_FILE="$(mktemp)" +printf %s "$PWD" > "$DEVENV_ROOT_FILE" +if ! use flake . --override-input devenv-root "file+file://$DEVENV_ROOT_FILE" +then + echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2 +fi diff --git a/.gitignore b/.gitignore index 9a51c68..d696f1e 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ data/*ogle* .devenv .pre-commit-config.yaml local-kubeconfig +.direnv diff --git a/README.md b/README.md index 1760ae8..684f191 100644 --- a/README.md +++ b/README.md @@ -5,52 +5,55 @@ To join the team, please contact etibachelet@gmail.com and/or rstreet@lco.global ## Development (w/ Kuberentes) -Install [Nix](https://github.com/LCOGT/public-wiki/wiki/Install-Nix) and then -enter the development environment: +Always enter the development shell before doing anything else. This will make +sure everyone is using the same version of tools, to avoid any system discrepancies. -```shell -nix develop --impure +Install [Nix](https://github.com/LCOGT/public-wiki/wiki/Install-Nix) if you have +not already. + +If you have [direnv](https://github.com/LCOGT/public-wiki/wiki/Install-direnv) +installed, the shell will automatically activate and deactive anytime you change +directories. You may have to grant permissions initially with: + +```sh +direnv allow ``` -Start a local development K8s cluster and container registry: +Otherwise, you can manually enter the shell with: -```shell -ctlptl apply -f ./local-registry.yaml -f ./local-cluster.yaml +```sh +./develop.sh ``` Spin up dependencies: -```shell +```sh skaffold -m mop-deps run ``` Start development loop: -```shell +```sh skaffold -m mop dev ``` This will watch source-code files for any changes and re-deploy automatically when they are modified. -The application will be port-forwarded to a port listed in the logs: +If you don't want that behaviour, you can also just have it run in the background: +```sh +skaffold -m mop run ``` -... -Deployments stabilized in 13.077 seconds -Port forwarding Service/server in namespace mop, remote port http -> http://127.0.0.1:4503 -Listing files to watch... - - mop -Press Ctrl+C to exit -... -``` + +MOP should be running at https://mop.local.lco.earth ### Clean-up -You can simply delete the application specific development cluster to clean everything up: +You can delete all resources deployed by skaffold with: -```shell -ctlptl delete -f ./local-cluster.yaml +```sh +skaffold -m mop,mop-deps delete ``` ## Build diff --git a/develop.sh b/develop.sh new file mode 100755 index 0000000..31ba88a --- /dev/null +++ b/develop.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +DEVENV_ROOT_FILE="$(mktemp)" +printf %s "$PWD" > "$DEVENV_ROOT_FILE" + +nix develop --override-input devenv-root "file+file://$DEVENV_ROOT_FILE" diff --git a/flake.lock b/flake.lock index 8a071b5..e9d55c4 100644 --- a/flake.lock +++ b/flake.lock @@ -2,72 +2,31 @@ "nodes": { "cachix": { "inputs": { - "devenv": "devenv_2", - "flake-compat": [ - "devenv-k8s", - "devenv", - "flake-compat" - ], - "git-hooks": [ + "devenv": [ "devenv-k8s", - "devenv", - "pre-commit-hooks" + "devenv" ], - "nixpkgs": [ - "devenv-k8s", - "devenv", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1724232775, - "narHash": "sha256-6u2DycIEgrgNYlLxyGqdFVmBNiKIitnQKJ1pbRP5oko=", - "owner": "cachix", - "repo": "cachix", - "rev": "03b6cb3f953097bff378fb8b9ea094bd091a4ec7", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "cachix", - "type": "github" - } - }, - "cachix_2": { - "inputs": { - "devenv": "devenv_3", "flake-compat": [ "devenv-k8s", - "devenv", - "cachix", - "devenv", - "flake-compat" + "devenv" ], - "nixpkgs": [ + "git-hooks": [ "devenv-k8s", - "devenv", - "cachix", - "devenv", - "nixpkgs" + "devenv" ], - "pre-commit-hooks": [ - "devenv-k8s", - "devenv", - "cachix", - "devenv", - "pre-commit-hooks" - ] + "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1712055811, - "narHash": "sha256-7FcfMm5A/f02yyzuavJe06zLa9hcMHsagE28ADcmQvk=", + "lastModified": 1728672398, + "narHash": "sha256-KxuGSoVUFnQLB2ZcYODW7AVPAh9JqRlD5BrfsC/Q4qs=", "owner": "cachix", "repo": "cachix", - "rev": "02e38da89851ec7fec3356a5c04bc8349cae0e30", + "rev": "aac51f698309fd0f381149214b7eee213c66ef0a", "type": "github" }, "original": { "owner": "cachix", + "ref": "latest", "repo": "cachix", "type": "github" } @@ -91,17 +50,17 @@ "devenv": { "inputs": { "cachix": "cachix", - "flake-compat": "flake-compat_2", - "nix": "nix_3", - "nixpkgs": "nixpkgs_3", - "pre-commit-hooks": "pre-commit-hooks_2" + "flake-compat": "flake-compat", + "git-hooks": "git-hooks", + "nix": "nix", + "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1726232533, - "narHash": "sha256-rhho/HLlDkJ/d3k6oQivgCSdVz4C1LLklPtO/aBhC2I=", + "lastModified": 1734441494, + "narHash": "sha256-/SZXjdKlo6NgVR+/RT0eYCUUJLcQndy7lIl2Bc0qjlY=", "owner": "cachix", "repo": "devenv", - "rev": "199a23e3bcfbfacaec3836d1c884918e13239b50", + "rev": "bdc1a2cefdda8f89e31b1a0f3771786ba9e5d052", "type": "github" }, "original": { @@ -114,6 +73,7 @@ "inputs": { "deploy-repo-template": "deploy-repo-template", "devenv": "devenv", + "devenv-root": "devenv-root", "flake-parts": "flake-parts_2", "kpt": "kpt", "mk-shell-bin": "mk-shell-bin", @@ -123,11 +83,11 @@ "skaffold": "skaffold" }, "locked": { - "lastModified": 1726680323, - "narHash": "sha256-B4VhmNViAfDcHTLqZN6oXHf08KPgMr3ay5e/mpTeRBw=", + "lastModified": 1739299574, + "narHash": "sha256-Kzi13V6afOsx59bEggJhYwWEwSvxd4B/vK4/tv5kjS0=", "owner": "LCOGT", "repo": "devenv-k8s", - "rev": "7e2c3009c466955411f63e9a3955539c10b8a7b3", + "rev": "dcef77f1ffce2c36abbb77a65d3fd5e842b38328", "type": "github" }, "original": { @@ -136,97 +96,31 @@ "type": "github" } }, - "devenv_2": { - "inputs": { - "cachix": "cachix_2", - "flake-compat": [ - "devenv-k8s", - "devenv", - "cachix", - "flake-compat" - ], - "nix": "nix_2", - "nixpkgs": [ - "devenv-k8s", - "devenv", - "cachix", - "nixpkgs" - ], - "pre-commit-hooks": [ - "devenv-k8s", - "devenv", - "cachix", - "git-hooks" - ] - }, - "locked": { - "lastModified": 1723156315, - "narHash": "sha256-0JrfahRMJ37Rf1i0iOOn+8Z4CLvbcGNwa2ChOAVrp/8=", - "owner": "cachix", - "repo": "devenv", - "rev": "ff5eb4f2accbcda963af67f1a1159e3f6c7f5f91", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "devenv", - "type": "github" - } - }, - "devenv_3": { - "inputs": { - "flake-compat": [ - "devenv-k8s", - "devenv", - "cachix", - "devenv", - "cachix", - "flake-compat" - ], - "nix": "nix", - "nixpkgs": "nixpkgs", - "poetry2nix": "poetry2nix", - "pre-commit-hooks": [ - "devenv-k8s", - "devenv", - "cachix", - "devenv", - "cachix", - "pre-commit-hooks" - ] - }, + "devenv-root": { + "flake": false, "locked": { - "lastModified": 1708704632, - "narHash": "sha256-w+dOIW60FKMaHI1q5714CSibk99JfYxm0CzTinYWr+Q=", - "owner": "cachix", - "repo": "devenv", - "rev": "2ee4450b0f4b95a1b90f2eb5ffea98b90e48c196", - "type": "github" + "narHash": "sha256-d6xi4mKdjkX2JFicDIv5niSzpyI0m/Hnm8GGAIU04kY=", + "type": "file", + "url": "file:///dev/null" }, "original": { - "owner": "cachix", - "ref": "python-rewrite", - "repo": "devenv", - "type": "github" + "type": "file", + "url": "file:///dev/null" } }, - "flake-compat": { + "devenv-root_2": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" + "narHash": "sha256-d6xi4mKdjkX2JFicDIv5niSzpyI0m/Hnm8GGAIU04kY=", + "type": "file", + "url": "file:///dev/null" }, "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" + "type": "file", + "url": "file:///dev/null" } }, - "flake-compat_2": { + "flake-compat": { "flake": false, "locked": { "lastModified": 1696426674, @@ -288,11 +182,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1689068808, - "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -302,30 +196,15 @@ } }, "flake-utils_2": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_3": { "inputs": { "systems": "systems_2" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", "type": "github" }, "original": { @@ -334,21 +213,34 @@ "type": "github" } }, - "flake-utils_4": { + "git-hooks": { "inputs": { - "systems": "systems_3" + "flake-compat": [ + "devenv-k8s", + "devenv" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "devenv-k8s", + "devenv", + "nixpkgs" + ], + "nixpkgs-stable": [ + "devenv-k8s", + "devenv" + ] }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "lastModified": 1730302582, + "narHash": "sha256-W1MIJpADXQCgosJZT8qBYLRuZls2KSiKdpnTVdKBuvU=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "af8a16fe5c264f5e9e18bcee2859b40a656876cf", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "cachix", + "repo": "git-hooks.nix", "type": "github" } }, @@ -357,7 +249,7 @@ "nixpkgs": [ "devenv-k8s", "devenv", - "pre-commit-hooks", + "git-hooks", "nixpkgs" ] }, @@ -377,7 +269,7 @@ }, "gomod2nix": { "inputs": { - "flake-utils": "flake-utils_4", + "flake-utils": "flake-utils_2", "nixpkgs": [ "devenv-k8s", "skaffold", @@ -476,74 +368,55 @@ }, "nix": { "inputs": { - "flake-compat": "flake-compat", - "nixpkgs": [ + "flake-compat": [ "devenv-k8s", - "devenv", - "cachix", - "devenv", - "cachix", - "devenv", - "nixpkgs" + "devenv" + ], + "flake-parts": "flake-parts", + "libgit2": "libgit2", + "nixpkgs": "nixpkgs_2", + "nixpkgs-23-11": [ + "devenv-k8s", + "devenv" ], - "nixpkgs-regression": "nixpkgs-regression" + "nixpkgs-regression": [ + "devenv-k8s", + "devenv" + ], + "pre-commit-hooks": [ + "devenv-k8s", + "devenv" + ] }, "locked": { - "lastModified": 1712911606, - "narHash": "sha256-BGvBhepCufsjcUkXnEEXhEVjwdJAwPglCC2+bInc794=", + "lastModified": 1727438425, + "narHash": "sha256-X8ES7I1cfNhR9oKp06F6ir4Np70WGZU5sfCOuNBEwMg=", "owner": "domenkozar", "repo": "nix", - "rev": "b24a9318ea3f3600c1e24b4a00691ee912d4de12", + "rev": "f6c5ae4c1b2e411e6b1e6a8181cc84363d6a7546", "type": "github" }, "original": { "owner": "domenkozar", - "ref": "devenv-2.21", + "ref": "devenv-2.24", "repo": "nix", "type": "github" } }, - "nix-github-actions": { - "inputs": { - "nixpkgs": [ - "devenv-k8s", - "devenv", - "cachix", - "devenv", - "cachix", - "devenv", - "poetry2nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1688870561, - "narHash": "sha256-4UYkifnPEw1nAzqqPOTL2MvWtm3sNGw1UTYTalkTcGY=", - "owner": "nix-community", - "repo": "nix-github-actions", - "rev": "165b1650b753316aa7f1787f3005a8d2da0f5301", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nix-github-actions", - "type": "github" - } - }, "nix2container": { "inputs": { - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils", "nixpkgs": [ "devenv-k8s", "nixpkgs" ] }, "locked": { - "lastModified": 1724996935, - "narHash": "sha256-njRK9vvZ1JJsP8oV2OgkBrpJhgQezI03S7gzskCcHos=", + "lastModified": 1730479402, + "narHash": "sha256-79NLeNjpCa4mSasmFsE3QA6obURezF0TUO5Pm+1daog=", "owner": "nlewo", "repo": "nix2container", - "rev": "fa6bb0a1159f55d071ba99331355955ae30b3401", + "rev": "5fb215a1564baa74ce04ad7f903d94ad6617e17a", "type": "github" }, "original": { @@ -552,100 +425,22 @@ "type": "github" } }, - "nix_2": { - "inputs": { - "flake-compat": [ - "devenv-k8s", - "devenv", - "cachix", - "devenv", - "flake-compat" - ], - "nixpkgs": [ - "devenv-k8s", - "devenv", - "cachix", - "devenv", - "nixpkgs" - ], - "nixpkgs-regression": "nixpkgs-regression_2" - }, - "locked": { - "lastModified": 1712911606, - "narHash": "sha256-BGvBhepCufsjcUkXnEEXhEVjwdJAwPglCC2+bInc794=", - "owner": "domenkozar", - "repo": "nix", - "rev": "b24a9318ea3f3600c1e24b4a00691ee912d4de12", - "type": "github" - }, - "original": { - "owner": "domenkozar", - "ref": "devenv-2.21", - "repo": "nix", - "type": "github" - } - }, - "nix_3": { - "inputs": { - "flake-compat": [ - "devenv-k8s", - "devenv", - "flake-compat" - ], - "flake-parts": "flake-parts", - "libgit2": "libgit2", - "nixpkgs": "nixpkgs_2", - "nixpkgs-23-11": "nixpkgs-23-11", - "nixpkgs-regression": "nixpkgs-regression_3", - "pre-commit-hooks": "pre-commit-hooks" - }, - "locked": { - "lastModified": 1725980365, - "narHash": "sha256-uDwWyizzlQ0HFzrhP6rVp2+2NNA+/TM5zT32dR8GUlg=", - "owner": "domenkozar", - "repo": "nix", - "rev": "1e61e9f40673f84c3b02573145492d8af581bec5", - "type": "github" - }, - "original": { - "owner": "domenkozar", - "ref": "devenv-2.24", - "repo": "nix", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1692808169, - "narHash": "sha256-x9Opq06rIiwdwGeK2Ykj69dNc2IvUH1fY55Wm7atwrE=", + "lastModified": 1730531603, + "narHash": "sha256-Dqg6si5CqIzm87sp57j5nTaeBbWhHFaVyG7V6L8k3lY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9201b5ff357e781bf014d0330d18555695df7ba8", + "rev": "7ffd9ae656aec493492b44d0ddfb28e79a1ea25d", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-unstable", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, - "nixpkgs-23-11": { - "locked": { - "lastModified": 1717159533, - "narHash": "sha256-oamiKNfr2MS6yH64rUn99mIZjc45nGJlj9eGth/3Xuw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446", - "type": "github" - } - }, "nixpkgs-lib": { "locked": { "lastModified": 1725233747, @@ -658,70 +453,6 @@ "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" } }, - "nixpkgs-regression": { - "locked": { - "lastModified": 1643052045, - "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - } - }, - "nixpkgs-regression_2": { - "locked": { - "lastModified": 1643052045, - "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - } - }, - "nixpkgs-regression_3": { - "locked": { - "lastModified": 1643052045, - "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - } - }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1720386169, - "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-24.05", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs_2": { "locked": { "lastModified": 1717432640, @@ -756,11 +487,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1726142289, - "narHash": "sha256-Jks8O42La+nm5AMTSq/PvM5O+fUAhIy0Ce1QYqLkyZ4=", + "lastModified": 1734126203, + "narHash": "sha256-0XovF7BYP50rTD2v4r55tR5MuBLet7q4xIz6Rgh3BBU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "280db3decab4cbeb22a4599bd472229ab74d25e1", + "rev": "71a6392e367b08525ee710a93af2e80083b5b3e2", "type": "github" }, "original": { @@ -796,106 +527,10 @@ "type": "github" } }, - "poetry2nix": { - "inputs": { - "flake-utils": "flake-utils", - "nix-github-actions": "nix-github-actions", - "nixpkgs": [ - "devenv-k8s", - "devenv", - "cachix", - "devenv", - "cachix", - "devenv", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1692876271, - "narHash": "sha256-IXfZEkI0Mal5y1jr6IRWMqK8GW2/f28xJenZIPQqkY0=", - "owner": "nix-community", - "repo": "poetry2nix", - "rev": "d5006be9c2c2417dafb2e2e5034d83fabd207ee3", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "poetry2nix", - "type": "github" - } - }, - "pre-commit-hooks": { - "inputs": { - "flake-compat": [ - "devenv-k8s", - "devenv", - "nix" - ], - "flake-utils": "flake-utils_2", - "gitignore": [ - "devenv-k8s", - "devenv", - "nix" - ], - "nixpkgs": [ - "devenv-k8s", - "devenv", - "nix", - "nixpkgs" - ], - "nixpkgs-stable": [ - "devenv-k8s", - "devenv", - "nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1712897695, - "narHash": "sha256-nMirxrGteNAl9sWiOhoN5tIHyjBbVi5e2tgZUgZlK3Y=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "40e6053ecb65fcbf12863338a6dcefb3f55f1bf8", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, - "pre-commit-hooks_2": { - "inputs": { - "flake-compat": [ - "devenv-k8s", - "devenv", - "flake-compat" - ], - "gitignore": "gitignore", - "nixpkgs": [ - "devenv-k8s", - "devenv", - "nixpkgs" - ], - "nixpkgs-stable": "nixpkgs-stable" - }, - "locked": { - "lastModified": 1725513492, - "narHash": "sha256-tyMUA6NgJSvvQuzB7A1Sf8+0XCHyfSPRx/b00o6K0uo=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "7570de7b9b504cfe92025dd1be797bf546f66528", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, "root": { "inputs": { "devenv-k8s": "devenv-k8s", + "devenv-root": "devenv-root_2", "flake-parts": [ "devenv-k8s", "flake-parts" @@ -961,21 +596,6 @@ "repo": "default", "type": "github" } - }, - "systems_3": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 2f8a7f8..b4b0e85 100644 --- a/flake.nix +++ b/flake.nix @@ -8,6 +8,11 @@ nixpkgs.follows = "devenv-k8s/nixpkgs"; flake-parts.follows = "devenv-k8s/flake-parts"; + + devenv-root = { + url = "file+file:///dev/null"; + flake = false; + }; }; nixConfig = { @@ -38,6 +43,13 @@ # https://devenv.sh/basics/ # Enter using `nix develop --impure` config.devenv.shells.default = { + + devenv.root = let + devenvRootFileContent = builtins.readFile inputs.devenv-root.outPath; + in pkgs.lib.mkIf (devenvRootFileContent != "") devenvRootFileContent; + + devenv-k8s.local-cluster.enable = true; + languages.python = { enable = true; package = pkgs.python310; @@ -58,14 +70,6 @@ # https://devenv.sh/reference/options/#entershell enterShell = '' - export KUBECONFIG="`pwd`/local-kubeconfig" - - echo "Setting KUBECONFIG=$KUBECONFIG" - echo - echo "This is done to sandbox Kuberenetes tools (kubectl, skaffold, etc) to the local K8s cluster for this project." - echo "If you would like to use a local K8s cluster across multiple projects, then set 'KUBECONFIG' to a common path" - echo "in both projects before running the command to create the local cluster." - cp --no-clobber $DEVENV_ROOT/k8s/envs/local/secrets.env.changeme $DEVENV_ROOT/k8s/envs/local/secrets.env echo echo "Configure application environment variables in '$DEVENV_ROOT/k8s/envs/local/secrets.env'" diff --git a/k8s/envs/local-deps/ing-minio/Kptfile b/k8s/envs/local-deps/ing-minio/Kptfile new file mode 100644 index 0000000..d292fed --- /dev/null +++ b/k8s/envs/local-deps/ing-minio/Kptfile @@ -0,0 +1,20 @@ +apiVersion: kpt.dev/v1 +kind: Kptfile +metadata: + name: ing-minio + annotations: + config.kubernetes.io/local-config: "true" +upstream: + type: git + git: + repo: https://github.com/LCOGT/kpt-pkg-catalog + directory: /ingress + ref: main + updateStrategy: resource-merge +upstreamLock: + type: git + git: + repo: https://github.com/LCOGT/kpt-pkg-catalog + directory: /ingress + ref: main + commit: c58213d7a52130c977fdff0a51f4bd4fb5ca73a3 diff --git a/k8s/envs/local-deps/ing-minio/README.md b/k8s/envs/local-deps/ing-minio/README.md new file mode 100644 index 0000000..97e5308 --- /dev/null +++ b/k8s/envs/local-deps/ing-minio/README.md @@ -0,0 +1,40 @@ +# ingress + +## Description + +This package provides a bare-bones [`networking.k8s.io/v1.Ingress`](https://kubernetes.io/docs/concepts/services-networking/ingress/) +that you can build upon and use in other packages. + +## Usage + +Clone this package: + +```shell +kpt pkg get https://github.com/LCOGT/kpt-pkg-catalog/ingress ing-myname +``` + +Customize `ingress.yaml`: + +```yaml +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: example +... +``` + +And then render to update resources: + +```shell +kpt fn render +``` + +This package is also a Kustomization, so it can also be referenced by other +Kustomizations: + +```yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ./ing-myname/ +``` diff --git a/k8s/envs/local-deps/ing-minio/ing.yaml b/k8s/envs/local-deps/ing-minio/ing.yaml new file mode 100644 index 0000000..64ed8fe --- /dev/null +++ b/k8s/envs/local-deps/ing-minio/ing.yaml @@ -0,0 +1,31 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master-standalone/ingress-networking-v1.json +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: # kpt-merge: /example + name: minio + annotations: + internal.kpt.dev/upstream-identifier: 'networking.k8s.io|Ingress|default|example' + nginx.ingress.kubernetes.io/proxy-body-size: "50m" +spec: + ingressClassName: "nginx" + rules: + - host: "minio-mop.local.lco.earth" + http: + paths: + - pathType: "Prefix" + path: "/" + backend: + service: + name: "minio" + port: + name: "minio-api" + - host: "console-minio-mop.local.lco.earth" + http: + paths: + - pathType: "Prefix" + path: "/" + backend: + service: + name: "minio" + port: + name: "minio-console" diff --git a/k8s/envs/local-deps/ing-minio/kustomization.yaml b/k8s/envs/local-deps/ing-minio/kustomization.yaml new file mode 100644 index 0000000..5fc2ba0 --- /dev/null +++ b/k8s/envs/local-deps/ing-minio/kustomization.yaml @@ -0,0 +1,11 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +metadata: # kpt-merge: /ing + name: ing + annotations: + config.kubernetes.io/local-config: "true" + internal.kpt.dev/upstream-identifier: 'kustomize.config.k8s.io|Kustomization|default|ing' +resources: + - ./ing.yaml +components: + - ./remove-kpt-internal-annotations/ diff --git a/k8s/envs/local-deps/ing-minio/remove-kpt-internal-annotations/Kptfile b/k8s/envs/local-deps/ing-minio/remove-kpt-internal-annotations/Kptfile new file mode 100644 index 0000000..5bb95eb --- /dev/null +++ b/k8s/envs/local-deps/ing-minio/remove-kpt-internal-annotations/Kptfile @@ -0,0 +1,20 @@ +apiVersion: kpt.dev/v1 +kind: Kptfile +metadata: + name: remove-kpt-internal-annotations + annotations: + config.kubernetes.io/local-config: "true" +upstream: + type: git + git: + repo: https://github.com/LCOGT/kpt-pkg-catalog + directory: /remove-kpt-internal-annotations + ref: main + updateStrategy: resource-merge +upstreamLock: + type: git + git: + repo: https://github.com/LCOGT/kpt-pkg-catalog + directory: /remove-kpt-internal-annotations + ref: main + commit: 55ef6ccd0dcdcc1dd80940110bfec4ea1a49e4fe diff --git a/k8s/envs/local-deps/ing-minio/remove-kpt-internal-annotations/README.md b/k8s/envs/local-deps/ing-minio/remove-kpt-internal-annotations/README.md new file mode 100644 index 0000000..4ffea9f --- /dev/null +++ b/k8s/envs/local-deps/ing-minio/remove-kpt-internal-annotations/README.md @@ -0,0 +1,25 @@ +# remove-kpt-internal-annotations + +## Description + +This package provides a [Kustomize `Component`](https://github.com/kubernetes/enhancements/tree/master/keps/sig-cli/1802-kustomize-components) +that can be used to remove `internal.kpt.dev/upstream-identifier` annotations from all rendered KRM objects. + +## Usage + +Clone this package: + +```shell +kpt pkg get https://github.com/LCOGT/kpt-pkg-catalog/remove-kpt-internal-annotations +``` + +And then reference it from another Kustomization: + + +```yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +components: + - ./remove-kpt-internal-annotations/ +``` diff --git a/k8s/envs/local-deps/ing-minio/remove-kpt-internal-annotations/kustomization.yaml b/k8s/envs/local-deps/ing-minio/remove-kpt-internal-annotations/kustomization.yaml new file mode 100644 index 0000000..f11ff1a --- /dev/null +++ b/k8s/envs/local-deps/ing-minio/remove-kpt-internal-annotations/kustomization.yaml @@ -0,0 +1,13 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component +metadata: # kpt-merge: /remove-kpt-internal-annotations + name: remove-kpt-internal-annotations + annotations: + config.kubernetes.io/local-config: "true" + internal.kpt.dev/upstream-identifier: 'kustomize.config.k8s.io|Component|default|remove-kpt-internal-annotations' +patches: + - target: + annotationSelector: internal.kpt.dev/upstream-identifier + patch: |- + - op: remove + path: /metadata/annotations/internal.kpt.dev~1upstream-identifier diff --git a/k8s/envs/local-deps/kustomization.yaml b/k8s/envs/local-deps/kustomization.yaml index 36128e3..1205fb0 100644 --- a/k8s/envs/local-deps/kustomization.yaml +++ b/k8s/envs/local-deps/kustomization.yaml @@ -7,3 +7,4 @@ resources: - ./ns/ - ./postgres/ - ./minio/ + - ./ing-minio/ diff --git a/k8s/envs/local/ing-server/Kptfile b/k8s/envs/local/ing-server/Kptfile new file mode 100644 index 0000000..0fe952f --- /dev/null +++ b/k8s/envs/local/ing-server/Kptfile @@ -0,0 +1,20 @@ +apiVersion: kpt.dev/v1 +kind: Kptfile +metadata: + name: ing-server + annotations: + config.kubernetes.io/local-config: "true" +upstream: + type: git + git: + repo: https://github.com/LCOGT/kpt-pkg-catalog + directory: /ingress + ref: main + updateStrategy: resource-merge +upstreamLock: + type: git + git: + repo: https://github.com/LCOGT/kpt-pkg-catalog + directory: /ingress + ref: main + commit: c58213d7a52130c977fdff0a51f4bd4fb5ca73a3 diff --git a/k8s/envs/local/ing-server/README.md b/k8s/envs/local/ing-server/README.md new file mode 100644 index 0000000..97e5308 --- /dev/null +++ b/k8s/envs/local/ing-server/README.md @@ -0,0 +1,40 @@ +# ingress + +## Description + +This package provides a bare-bones [`networking.k8s.io/v1.Ingress`](https://kubernetes.io/docs/concepts/services-networking/ingress/) +that you can build upon and use in other packages. + +## Usage + +Clone this package: + +```shell +kpt pkg get https://github.com/LCOGT/kpt-pkg-catalog/ingress ing-myname +``` + +Customize `ingress.yaml`: + +```yaml +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: example +... +``` + +And then render to update resources: + +```shell +kpt fn render +``` + +This package is also a Kustomization, so it can also be referenced by other +Kustomizations: + +```yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ./ing-myname/ +``` diff --git a/k8s/envs/local/ing-server/ing.yaml b/k8s/envs/local/ing-server/ing.yaml new file mode 100644 index 0000000..fbd9fa9 --- /dev/null +++ b/k8s/envs/local/ing-server/ing.yaml @@ -0,0 +1,20 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master-standalone/ingress-networking-v1.json +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: # kpt-merge: /example + name: server + annotations: + internal.kpt.dev/upstream-identifier: 'networking.k8s.io|Ingress|default|example' +spec: + ingressClassName: "nginx" + rules: + - host: "mop.local.lco.earth" + http: + paths: + - pathType: "Prefix" + path: "/" + backend: + service: + name: "server" + port: + name: "http" diff --git a/k8s/envs/local/ing-server/kustomization.yaml b/k8s/envs/local/ing-server/kustomization.yaml new file mode 100644 index 0000000..5fc2ba0 --- /dev/null +++ b/k8s/envs/local/ing-server/kustomization.yaml @@ -0,0 +1,11 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +metadata: # kpt-merge: /ing + name: ing + annotations: + config.kubernetes.io/local-config: "true" + internal.kpt.dev/upstream-identifier: 'kustomize.config.k8s.io|Kustomization|default|ing' +resources: + - ./ing.yaml +components: + - ./remove-kpt-internal-annotations/ diff --git a/k8s/envs/local/ing-server/remove-kpt-internal-annotations/Kptfile b/k8s/envs/local/ing-server/remove-kpt-internal-annotations/Kptfile new file mode 100644 index 0000000..5bb95eb --- /dev/null +++ b/k8s/envs/local/ing-server/remove-kpt-internal-annotations/Kptfile @@ -0,0 +1,20 @@ +apiVersion: kpt.dev/v1 +kind: Kptfile +metadata: + name: remove-kpt-internal-annotations + annotations: + config.kubernetes.io/local-config: "true" +upstream: + type: git + git: + repo: https://github.com/LCOGT/kpt-pkg-catalog + directory: /remove-kpt-internal-annotations + ref: main + updateStrategy: resource-merge +upstreamLock: + type: git + git: + repo: https://github.com/LCOGT/kpt-pkg-catalog + directory: /remove-kpt-internal-annotations + ref: main + commit: 55ef6ccd0dcdcc1dd80940110bfec4ea1a49e4fe diff --git a/k8s/envs/local/ing-server/remove-kpt-internal-annotations/README.md b/k8s/envs/local/ing-server/remove-kpt-internal-annotations/README.md new file mode 100644 index 0000000..4ffea9f --- /dev/null +++ b/k8s/envs/local/ing-server/remove-kpt-internal-annotations/README.md @@ -0,0 +1,25 @@ +# remove-kpt-internal-annotations + +## Description + +This package provides a [Kustomize `Component`](https://github.com/kubernetes/enhancements/tree/master/keps/sig-cli/1802-kustomize-components) +that can be used to remove `internal.kpt.dev/upstream-identifier` annotations from all rendered KRM objects. + +## Usage + +Clone this package: + +```shell +kpt pkg get https://github.com/LCOGT/kpt-pkg-catalog/remove-kpt-internal-annotations +``` + +And then reference it from another Kustomization: + + +```yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +components: + - ./remove-kpt-internal-annotations/ +``` diff --git a/k8s/envs/local/ing-server/remove-kpt-internal-annotations/kustomization.yaml b/k8s/envs/local/ing-server/remove-kpt-internal-annotations/kustomization.yaml new file mode 100644 index 0000000..f11ff1a --- /dev/null +++ b/k8s/envs/local/ing-server/remove-kpt-internal-annotations/kustomization.yaml @@ -0,0 +1,13 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component +metadata: # kpt-merge: /remove-kpt-internal-annotations + name: remove-kpt-internal-annotations + annotations: + config.kubernetes.io/local-config: "true" + internal.kpt.dev/upstream-identifier: 'kustomize.config.k8s.io|Component|default|remove-kpt-internal-annotations' +patches: + - target: + annotationSelector: internal.kpt.dev/upstream-identifier + patch: |- + - op: remove + path: /metadata/annotations/internal.kpt.dev~1upstream-identifier diff --git a/k8s/envs/local/kustomization.yaml b/k8s/envs/local/kustomization.yaml index f0b0e20..0a9782f 100644 --- a/k8s/envs/local/kustomization.yaml +++ b/k8s/envs/local/kustomization.yaml @@ -3,6 +3,7 @@ kind: Kustomization resources: - ../../base/ + - ./ing-server namespace: mop @@ -18,6 +19,17 @@ secretGenerator: - ./secrets.env patches: + # suspend all cronjobs + - target: + kind: CronJob + patch: |- + apiVersion: ignored + kind: Cronjob + metadata: + name: ignored + spec: + suspend: true + - target: kind: Deployment name: server diff --git a/k8s/envs/local/settings.env b/k8s/envs/local/settings.env index fa2f8c9..40562c5 100644 --- a/k8s/envs/local/settings.env +++ b/k8s/envs/local/settings.env @@ -10,7 +10,7 @@ DB_PORT=5432 LCO_PROPOSAL_ID=KEY2023B-004 -AWS_S3_ENDPOINT_URL=http://minio.mop.svc:9000 +AWS_S3_ENDPOINT_URL=https://minio-mop.local.lco.earth AWS_S3_REGION_NAME=us-east-1 AWS_ACCESS_KEY_ID=rootroot AWS_SECRET_ACCESS_KEY=rootroot diff --git a/local-cluster.yaml b/local-cluster.yaml deleted file mode 100644 index 1dea2f9..0000000 --- a/local-cluster.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: ctlptl.dev/v1alpha1 -kind: Cluster -name: kind-mop -product: kind -registry: lco-local -kubernetesVersion: v1.25 diff --git a/local-registry.yaml b/local-registry.yaml deleted file mode 100644 index f5de791..0000000 --- a/local-registry.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: ctlptl.dev/v1alpha1 -kind: Registry -name: lco-local -port: 12315 diff --git a/mop/settings.py b/mop/settings.py index 0895ff2..9c19ed3 100644 --- a/mop/settings.py +++ b/mop/settings.py @@ -15,6 +15,7 @@ import ast import tempfile + # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -28,6 +29,7 @@ DEBUG = ast.literal_eval(os.getenv('DJANGO_DEBUG', 'False')) ALLOWED_HOSTS = ['*'] +SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") TOM_NAME = 'MOP' diff --git a/skaffold.yaml b/skaffold.yaml index 68f3c43..6ccf4ea 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -21,10 +21,6 @@ deploy: kubectl: {} logs: prefix: podAndContainer -portForward: - - resourceType: Service - resourceName: server - port: http --- apiVersion: skaffold/v4beta10 kind: Config From 88ab2c61476bf0816c35a7f9ce10c0f7e7f5027b Mon Sep 17 00:00:00 2001 From: Jashandeep Sohi Date: Wed, 12 Feb 2025 11:59:34 -0800 Subject: [PATCH 2/9] constrain devenv-k8s to v1 branch --- flake.lock | 7 ++++--- flake.nix | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index e9d55c4..f9a76e0 100644 --- a/flake.lock +++ b/flake.lock @@ -83,15 +83,16 @@ "skaffold": "skaffold" }, "locked": { - "lastModified": 1739299574, - "narHash": "sha256-Kzi13V6afOsx59bEggJhYwWEwSvxd4B/vK4/tv5kjS0=", + "lastModified": 1739389657, + "narHash": "sha256-AR3G16IGuIR21BIdREFin/2gkpPOrAGS6pfGnedNKOk=", "owner": "LCOGT", "repo": "devenv-k8s", - "rev": "dcef77f1ffce2c36abbb77a65d3fd5e842b38328", + "rev": "50fae694aec61251405bbb22cfd13375595e5fa0", "type": "github" }, "original": { "owner": "LCOGT", + "ref": "v1", "repo": "devenv-k8s", "type": "github" } diff --git a/flake.nix b/flake.nix index b4b0e85..d230be4 100644 --- a/flake.nix +++ b/flake.nix @@ -4,7 +4,7 @@ inputs = { nixpkgs.url = "github:cachix/devenv-nixpkgs/rolling"; flake-parts.url = "github:hercules-ci/flake-parts"; - devenv-k8s.url = "github:LCOGT/devenv-k8s"; + devenv-k8s.url = "github:LCOGT/devenv-k8s/v1"; nixpkgs.follows = "devenv-k8s/nixpkgs"; flake-parts.follows = "devenv-k8s/flake-parts"; From dd8b701589b93b305474d0df429a0f4a4c311de1 Mon Sep 17 00:00:00 2001 From: Jashandeep Sohi Date: Wed, 12 Feb 2025 14:55:55 -0800 Subject: [PATCH 3/9] ignore local_settings.py etc --- .dockerignore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.dockerignore b/.dockerignore index f0c43db..888c89a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -17,3 +17,10 @@ **/*__pycache__ **/*.pyc **/*.pyo + +# Django files +local_settings* + +# Any local datafiles +data/star*csv +data/*ogle* From f48d5dbe1b7a836ac8e461331c62b19bd7c8c48b Mon Sep 17 00:00:00 2001 From: Jashandeep Sohi Date: Wed, 12 Feb 2025 15:28:42 -0800 Subject: [PATCH 4/9] add codespaces/devcontainer support --- .devcontainer.json | 12 ++++++++++++ flake.nix | 2 ++ 2 files changed, 14 insertions(+) create mode 100644 .devcontainer.json diff --git a/.devcontainer.json b/.devcontainer.json new file mode 100644 index 0000000..2f69206 --- /dev/null +++ b/.devcontainer.json @@ -0,0 +1,12 @@ +{ + "customizations": { + "vscode": { + "extensions": [ + "mkhl.direnv" + ] + } + }, + "image": "ghcr.io/cachix/devenv:latest", + "overrideCommand": false, + "updateContentCommand": "devenv test" +} diff --git a/flake.nix b/flake.nix index d230be4..f282795 100644 --- a/flake.nix +++ b/flake.nix @@ -61,6 +61,8 @@ }; }; + devcontainer.enable = true; + # https://devenv.sh/packages/ packages = [ # Needed to build psycopg2 From 2363e2c7893443f7e7cbecdf8cba6b1ac9737ad4 Mon Sep 17 00:00:00 2001 From: Jashandeep Sohi Date: Wed, 12 Feb 2025 15:44:48 -0800 Subject: [PATCH 5/9] enter devshell in devcontainer --- .devcontainer.json | 1 + flake.nix | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.devcontainer.json b/.devcontainer.json index 2f69206..fd2d187 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -7,6 +7,7 @@ } }, "image": "ghcr.io/cachix/devenv:latest", + "onCreateCommand": "./develop.sh", "overrideCommand": false, "updateContentCommand": "devenv test" } diff --git a/flake.nix b/flake.nix index f282795..940a152 100644 --- a/flake.nix +++ b/flake.nix @@ -61,7 +61,10 @@ }; }; - devcontainer.enable = true; + devcontainer = { + enable = true; + settings.onCreateCommand = "./develop.sh"; + }; # https://devenv.sh/packages/ packages = [ From 5ed8d6e0681556fa3d7675bd02b829aa4f992e57 Mon Sep 17 00:00:00 2001 From: Jashandeep Sohi Date: Wed, 12 Feb 2025 16:38:41 -0800 Subject: [PATCH 6/9] accept flake config --- develop.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/develop.sh b/develop.sh index 31ba88a..c33b7a0 100755 --- a/develop.sh +++ b/develop.sh @@ -3,4 +3,4 @@ DEVENV_ROOT_FILE="$(mktemp)" printf %s "$PWD" > "$DEVENV_ROOT_FILE" -nix develop --override-input devenv-root "file+file://$DEVENV_ROOT_FILE" +nix develop --accept-flake-config --override-input devenv-root "file+file://$DEVENV_ROOT_FILE" From 7a6cc64597b371acd9d36062d936c441c00ae291 Mon Sep 17 00:00:00 2001 From: Jashandeep Sohi Date: Wed, 12 Feb 2025 17:12:05 -0800 Subject: [PATCH 7/9] remove AWS_ env vars from template --- k8s/envs/local/secrets.env.changeme | 5 ----- 1 file changed, 5 deletions(-) diff --git a/k8s/envs/local/secrets.env.changeme b/k8s/envs/local/secrets.env.changeme index 81e1467..0e492fd 100644 --- a/k8s/envs/local/secrets.env.changeme +++ b/k8s/envs/local/secrets.env.changeme @@ -7,11 +7,6 @@ LCO_API_KEY=changeme IRSA_USERNAME=changeme IRSA_PASSWORD=changeme -AWS_ACCESS_KEY_ID=changeme -AWS_SECRET_ACCESS_KEY=changeme - -AWS_S3_BUCKET=changeme - GEMINI_USERNAME=changeme GEMINI_N_API_KEY=changeme GEMINI_S_API_KEY=changeme From 91966a56c8b2d627373f6d282be7c3d0de75554f Mon Sep 17 00:00:00 2001 From: Jashandeep Sohi Date: Fri, 14 Feb 2025 13:58:06 -0800 Subject: [PATCH 8/9] nix flake update devenv-k8s --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index f9a76e0..3d21ece 100644 --- a/flake.lock +++ b/flake.lock @@ -83,11 +83,11 @@ "skaffold": "skaffold" }, "locked": { - "lastModified": 1739389657, - "narHash": "sha256-AR3G16IGuIR21BIdREFin/2gkpPOrAGS6pfGnedNKOk=", + "lastModified": 1739567912, + "narHash": "sha256-aujTXDKahAtAet7R9xAJkR+Jo444CDxDvOKRZBcgwc0=", "owner": "LCOGT", "repo": "devenv-k8s", - "rev": "50fae694aec61251405bbb22cfd13375595e5fa0", + "rev": "88a78f46f17cce686877ed383226fb642a574536", "type": "github" }, "original": { From 1a7a68143c78f302690daa41b54b4ddcb2368450 Mon Sep 17 00:00:00 2001 From: Jashandeep Sohi Date: Fri, 14 Feb 2025 16:10:18 -0800 Subject: [PATCH 9/9] disable devcontainer --- .devcontainer.json | 13 ------------- flake.nix | 5 ----- 2 files changed, 18 deletions(-) delete mode 100644 .devcontainer.json diff --git a/.devcontainer.json b/.devcontainer.json deleted file mode 100644 index fd2d187..0000000 --- a/.devcontainer.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "customizations": { - "vscode": { - "extensions": [ - "mkhl.direnv" - ] - } - }, - "image": "ghcr.io/cachix/devenv:latest", - "onCreateCommand": "./develop.sh", - "overrideCommand": false, - "updateContentCommand": "devenv test" -} diff --git a/flake.nix b/flake.nix index 940a152..d230be4 100644 --- a/flake.nix +++ b/flake.nix @@ -61,11 +61,6 @@ }; }; - devcontainer = { - enable = true; - settings.onCreateCommand = "./develop.sh"; - }; - # https://devenv.sh/packages/ packages = [ # Needed to build psycopg2