This repository is a collection of resources for post-disaster communications. It is a work in progress and will be updated as the project progresses.
Flutter is an open-source UI software development kit created by Google.
This will be used for the mobile application development.
Supabase is an open source Firebase alternative. It is a service that provides a Postgres database with a RESTful API and real-time capabilities. It is used as the backend for the project.
For this project, we will be utilizing the community supabase kubernetes helm chart. The helm chart can be found in supabase-community/supabase-kubernetes.
Deploying supabase via Kubernetes allows for a cloud agnostic deployment as long as a Kubernetes cluster is available.
To run this app locally, follow these steps:
-
Install Pixi: https://github.com/prefix-dev/pixi?tab=readme-ov-file#installation
-
In the package's directory, run the following to install both
frontend
andbackend
tools# Install frontend tools pixi run -e frontend install-tools # install backend tools pixi run -e backend install-tools
-
Run the Docker daemon
-
Set up the infrastructure. You should have a Supabase instance running at http://localhost
pixi run -e backend setup-infra
After the setup, when prompted to log in, enter your Supabase project credentials (Username and Password) for successful authentication. The credentials can be found in
deployment/values.dev.yaml
. -
Optional: If you want to add sample entries in your local Supabase Instance. Run the following command in a new terminal session.
pixi run setup-db-data-via-k8s-job
-
Run the API server locally by running the following command in a new terminal session.
Note: the argumentfast-api-server-dev
in the command below runs the server in editable mode, where each change in the source file triggers the restart of the fastapi local server.
For production: replacefast-api-server-dev
withfast-api-server-run
.pixi run fast-api-server-dev
At this point your backend is now ready to go! Now off to frontend
-
Install Android Studio
-
Run Android Studio, which will help you install the Android toolchain. Be sure to include all required components
- Android SDK Platform
- Android SDK Command-line tools
- Android SDK Build-Tools
- Android SDK Platform-Tools
- Android Emulator
-
Accept the Android licenses (or check that you have already done so) and get frontend dependencies by running the command below. There may be an issue indicated with XCode -- that is okay and can be ignored
pixi run -e frontend setup-infra
-
Run Flutter. This will open the Android app in a new Chrome window
To ensure the app connects to Supabase, set the
SUPABASE_URL
andSUPABASE_ANON_KEY
with:pixi run -e frontend flutter-run --dart-define=SUPABASE_ANON_KEY=secret.jwt.anonKeyValue --dart-define=SUPABASE_URL=http://localhost
The credentials can be found in
deployment/values.dev.yaml
.At this point your frontend is now ready to go! You are all set.
It's in ./deployment/cloud
and we're using OpenTofu
Please see our information here
(Optional) To open the file with VSCode, run the following first
export EDITOR="code --wait"
Then run the following. Save and close the file when you're done editing for all of your new values to be re-encrypted.
pixi run edit-cloud-values
If you run into an issue like gpg: decryption failed: Inappropriate ioctl for device
, run the following command and retry
export GPG_TTY=$(tty)
The following commands will allow you to do what you gotta do to update and deploy the infrastructure
From the tofu init
docs
This is the first command that should be run for any new or existing OpenTofu configuration per machine. This sets up all the local data necessary to run OpenTofu that is typically not committed to version control.
pixi run cloud-init
pixi run cloud-plan
pixi run cloud-deploy
pixi run cloud-destroy
This will start up the development server and populate it with sample data.
pixi run cloud-server-run
The server will stop daily at 01:00 UTC (6PM PDT/5PM PST), but if you wanna be a good citizen and stop it when you're done, run the following
pixi run cloud-server-stop
This command uses AWS's Session Manager to access the development server without needing to distribute ssh keys. Assuming you have access to the IAM roles needed for everything else related to the cloud here, this command should just work!
pixi run cloud-server-access
You can contribute to this project by creating issues or forking this repository and opening a pull request.
Please review our Code of Conduct before contributing.