Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flake #3245

Closed
wants to merge 11 commits into from
Closed

Flake #3245

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
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use flake

export DOCKER_HOST_IP=${DOCKER_HOST_IP:-127.0.0.1}
export NETWORK=regtest

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/quickstart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ jobs:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: carvel-dev/setup-action@v1
- uses: cachix/install-nix-action@v22
with:
only: ytt, vendir
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Test quickstart
run: |
cd quickstart
./bin/bump-galoy-git-ref.sh ${{ github.event.pull_request.head.sha }}
./bin/bump-galoy-image-digest.sh local
./bin/bump-mongodb-migrate-image-digest.sh local
make re-render
nix develop -c ./bin/bump-galoy-git-ref.sh ${{ github.event.pull_request.head.sha }}
nix develop -c./bin/bump-galoy-image-digest.sh local
nix develop -c ./bin/bump-mongodb-migrate-image-digest.sh local
nix develop -c make re-render
source .envrc
docker compose up -d
./bin/quickstart.sh
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ generated.gql
junit.xml

.next

.direnv/
53 changes: 46 additions & 7 deletions ci/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
- name: image
params:
CONTEXT: repo
BUILD_ARGS_FILE: repo/.env
BUILD_ARGS_FILE: repo/.build-args
run:
path: build
- put: edge-image
Expand All @@ -137,7 +137,20 @@ jobs:
- name: build-debug-edge-image
serial: true
plan:
- { get: repo, trigger: true }
- in_parallel:
- { get: repo, trigger: true }
- { get: pipeline-tasks }
- task: prepare-docker-build
config:
platform: linux
image_resource: #@ nodejs_task_image_config()
inputs:
- name: pipeline-tasks
- name: repo
outputs:
- name: repo
run:
path: pipeline-tasks/ci/tasks/prepare-docker-build.sh
- task: build
privileged: true
config:
Expand All @@ -152,7 +165,7 @@ jobs:
- name: image
params:
CONTEXT: repo
BUILD_ARGS_FILE: repo/.env
BUILD_ARGS_FILE: repo/.build-args
DOCKERFILE: "repo/Dockerfile-debug"
run:
path: build
Expand All @@ -163,7 +176,20 @@ jobs:
- name: build-migrate-edge-image
serial: true
plan:
- { get: repo, trigger: true }
- in_parallel:
- { get: repo, trigger: true }
- { get: pipeline-tasks }
- task: prepare-docker-build
config:
platform: linux
image_resource: #@ nodejs_task_image_config()
inputs:
- name: pipeline-tasks
- name: repo
outputs:
- name: repo
run:
path: pipeline-tasks/ci/tasks/prepare-docker-build.sh
- task: build
privileged: true
config:
Expand All @@ -178,7 +204,7 @@ jobs:
- name: image
params:
CONTEXT: repo
BUILD_ARGS_FILE: repo/.env
BUILD_ARGS_FILE: repo/.build-args
DOCKERFILE: "repo/Dockerfile-migrate"
run:
path: build
Expand All @@ -189,7 +215,20 @@ jobs:
- name: build-websocket-edge-image
serial: true
plan:
- { get: repo, trigger: true }
- in_parallel:
- { get: repo, trigger: true }
- { get: pipeline-tasks }
- task: prepare-docker-build
config:
platform: linux
image_resource: #@ nodejs_task_image_config()
inputs:
- name: pipeline-tasks
- name: repo
outputs:
- name: repo
run:
path: pipeline-tasks/ci/tasks/prepare-docker-build.sh
- task: build
privileged: true
config:
Expand All @@ -204,7 +243,7 @@ jobs:
- name: image
params:
CONTEXT: repo
BUILD_ARGS_FILE: repo/.env
BUILD_ARGS_FILE: repo/.build-args
DOCKERFILE: "repo/Dockerfile-websocket"
run:
path: build
Expand Down
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
description = "Galoy dev environment";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (system: let
overlays = [
(self: super: {
nodejs = super.nodejs_20;
yarn = super.yarn.override {
nodejs = super.nodejs_20;
};
})
];
pkgs = import nixpkgs {inherit overlays system;};
nativeBuildInputs = with pkgs; [
nodejs
tilt
yarn
alejandra
gnumake
docker-compose
shellcheck
shfmt
vendir
jq
ytt
direnv
nix-direnv
];
in
with pkgs; {
devShells.default = mkShell {
inherit nativeBuildInputs;
};

formatter = alejandra;
});
}
9 changes: 4 additions & 5 deletions quickstart/bin/re-render.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@
set -e

REPO_ROOT=$(git rev-parse --show-toplevel)
GALOY_DEV_DIR=${REPO_ROOT}/quickstart/dev
GALOY_ROOT_DIR=${REPO_ROOT}/quickstart/galoy

pushd ${REPO_ROOT}/quickstart
pushd "${REPO_ROOT}/quickstart"

ytt -f vendir > vendir.yml
vendir sync

ytt -f ./docker-compose.tmpl.yml -f ${GALOY_ROOT_DIR}/docker-compose.yml -f ${GALOY_ROOT_DIR}/docker-compose.override.yml > docker-compose.yml
ytt -f ./docker-compose.tmpl.yml -f "${GALOY_ROOT_DIR}/docker-compose.yml" -f "${GALOY_ROOT_DIR}/docker-compose.override.yml" > docker-compose.yml

pushd ${GALOY_ROOT_DIR}
pushd "${GALOY_ROOT_DIR}"
source .envrc
mkdir -p "${GALOY_ROOT_DIR}/../vendor/galoy-quickstart/env"

export OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-agent:4318
envsubst < .env.ci | grep -v '^LND2' > ${GALOY_ROOT_DIR}/../.env.galoy
envsubst < .env.ci | grep -v '^LND2' > "${GALOY_ROOT_DIR}/../.env.galoy"