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
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,10 @@
**/*__pycache__
**/*.pyc
**/*.pyo

# Django files
local_settings*

# Any local datafiles
data/star*csv
data/*ogle*
13 changes: 13 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ data/*ogle*
.devenv
.pre-commit-config.yaml
local-kubeconfig
.direnv
45 changes: 24 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions develop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

DEVENV_ROOT_FILE="$(mktemp)"
printf %s "$PWD" > "$DEVENV_ROOT_FILE"

nix develop --accept-flake-config --override-input devenv-root "file+file://$DEVENV_ROOT_FILE"
Loading