diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1d953f4 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use nix diff --git a/.gitea/workflows/backend_build-deploy-prod.yaml b/.gitea/workflows/backend_build-deploy-prod.yaml index 3dfb55a..f9df90e 100644 --- a/.gitea/workflows/backend_build-deploy-prod.yaml +++ b/.gitea/workflows/backend_build-deploy-prod.yaml @@ -10,15 +10,7 @@ jobs: name: Build and push image uses: ./.gitea/workflows/workflow_build-image.yaml with: - tag: stable + # sets the tag to the git tag that triggered the workflow - the deployment (configured in a separate repository) will use this tag and be deployed to production by argocd + tag: ${{ github.ref_name }} secrets: PACKAGE_REGISTRY_ACCESS: ${{ secrets.PACKAGE_REGISTRY_ACCESS }} - - deploy-prod: - name: Deploy to production - uses: ./.gitea/workflows/workflow_deploy-container.yaml - with: - overlay: prod - secrets: - KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} - needs: build-and-push diff --git a/.gitea/workflows/backend_build-deploy-stg.yaml b/.gitea/workflows/backend_build-deploy-stg.yaml index 3d67c44..b99d605 100644 --- a/.gitea/workflows/backend_build-deploy-stg.yaml +++ b/.gitea/workflows/backend_build-deploy-stg.yaml @@ -12,15 +12,7 @@ jobs: name: Build and push image uses: ./.gitea/workflows/workflow_build-image.yaml with: - tag: unstable + # sets a unique tag for each commit in the PR - this gets deployed to a separate application instance using argocd + tag: ${{ github.head_ref }}-{{ github.sha }} secrets: PACKAGE_REGISTRY_ACCESS: ${{ secrets.PACKAGE_REGISTRY_ACCESS }} - - deploy-prod: - name: Deploy to staging - uses: ./.gitea/workflows/workflow_deploy-container.yaml - with: - overlay: stg - secrets: - KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} - needs: build-and-push diff --git a/.gitea/workflows/workflow_deploy-container.yaml b/.gitea/workflows/workflow_deploy-container.yaml deleted file mode 100644 index b4f9527..0000000 --- a/.gitea/workflows/workflow_deploy-container.yaml +++ /dev/null @@ -1,35 +0,0 @@ -on: - workflow_call: - inputs: - overlay: - required: true - type: string - secrets: - KUBE_CONFIG: - required: true - - -name: Deploy the newly built container - - -jobs: - deploy: - name: Deploy - runs-on: ubuntu-latest - steps: - - - uses: https://gitea.com/actions/checkout@v4 - with: - submodules: true - - - name: setup kubectl - uses: https://github.com/azure/setup-kubectl@v4 - - - name: Set kubeconfig - run: | - echo "${{ secrets.KUBE_CONFIG }}" > kubeconfig - - - name: Deploy to k8s - run: | - kubectl apply -k backend/deployment/overlays/${{ inputs.overlay }} --kubeconfig=kubeconfig - kubectl -n anyway-backend rollout restart deployment/anyway-backend-${{ inputs.overlay }} --kubeconfig=kubeconfig diff --git a/.gitignore b/.gitignore index e934adf..8f140c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ cache/ +.direnv/ diff --git a/.vscode/launch.json b/.vscode/launch.json index 4454643..dc2c672 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,9 +9,7 @@ "name": "Backend - debug", "type": "debugpy", "request": "launch", - "env": { - "DEBUG": "true" - }, + "envFile": "${workspaceFolder}/backend/debug.env", "jinja": true, "cwd": "${workspaceFolder}/backend", "module": "fastapi", @@ -25,9 +23,7 @@ "type": "debugpy", "request": "launch", "program": "src/tester.py", - "env": { - "DEBUG": "true" - }, + "envFile": "${workspaceFolder}/backend/debug.env", "cwd": "${workspaceFolder}/backend" }, // frontend - flutter app diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..e982907 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "nixEnvSelector.nixFile": "${workspaceFolder}/default.nix" +} diff --git a/backend/.gitignore b/backend/.gitignore index ac02d06..f98f017 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -1,3 +1,6 @@ +# all .env files +*.env + # osm-cache cache_XML/ @@ -165,4 +168,4 @@ cython_debug/ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ \ No newline at end of file +#.idea/ diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..b183363 --- /dev/null +++ b/default.nix @@ -0,0 +1,17 @@ +{ pkgs ? import { config.android_sdk.accept_license = true; config.allowUnfree = true; } }: + +pkgs.mkShell { + buildInputs = [ + pkgs.flutter + #pkgs.android-tools # for adb + #pkgs.openjdk # required for Android builds + ]; + + # Set up Android SDK paths if needed + shellHook = '' + export ANDROID_SDK_ROOT=${pkgs.androidsdk}/libexec/android-sdk + export PATH=$PATH:${pkgs.androidsdk}/libexec/android-sdk/platform-tools + echo "Flutter dev environment ready. 'adb' and 'flutter' are available." + ''; +} +