|
| 1 | +# Development Setup |
| 2 | + |
| 3 | +## Requirements |
| 4 | +- Docker or Podman with Compose |
| 5 | +- NET 9.0 SDK |
| 6 | +- git (+ git bash if on Windows) |
| 7 | + |
| 8 | +## Recommendations |
| 9 | +- Jetbrains Rider |
| 10 | + |
| 11 | +## Setup |
| 12 | + |
| 13 | +Open a shell in the `dev` directory. (Git Bash on Windows) |
| 14 | + |
| 15 | +### Postgres, Dragonfly (Redis Compatible Cache), WebUI |
| 16 | + |
| 17 | +Run the following command to start the local development databases. |
| 18 | + |
| 19 | +```bash |
| 20 | +docker-compose up -d |
| 21 | +``` |
| 22 | + |
| 23 | +This starts Postgres and Dragonfly as a container on your local machine. |
| 24 | +Additionally, it starts the OpenShock WebUI in a container for easier access to the localhost backend. |
| 25 | +Its accessible at `http://localhost:8080`. |
| 26 | + |
| 27 | +There shouldn't be any errors in the output. |
| 28 | + |
| 29 | +**Tips:** |
| 30 | +- You can use `docker ps` to check if the containers are running. |
| 31 | +- To update the images you need to run `docker-compose pull` and then `docker-compose up -d` again. |
| 32 | +- To stop the containers, run `docker-compose down`. |
| 33 | + |
| 34 | +### Setting up environment secrets |
| 35 | + |
| 36 | +Make sure you are in the `dev` directory and your terminal is a linux like bash terminal (Git Bash on Windows will work). |
| 37 | + |
| 38 | +Run the `setupUsersecrets.sh` script to setup dotnet user secrets for the projects. |
| 39 | +```bash |
| 40 | +./setupUsersecrets.sh |
| 41 | +``` |
| 42 | + |
| 43 | +It will prompt you for your local machines ipv4 address. You can find this by running `ipconfig` on Windows or `ifconfig` on Mac/Linux. |
| 44 | +We need this to be able to connect hubs to this locally running openshock instance. |
| 45 | + |
| 46 | +### Running API |
| 47 | + |
| 48 | +If not already done, open the OpenShockBackend solution in Rider. |
| 49 | +Give it some time to index and restore nuget. |
| 50 | + |
| 51 | +When everything is done you should be able to select the `API` launch config at the top right and click the green play button to start the API. |
| 52 | +It's important to do this to run the initial migrations against the database. |
| 53 | + |
| 54 | +### Seeding Test Data |
| 55 | + |
| 56 | +Run the `setupTestData.sh` script to create a test user account. |
| 57 | + |
| 58 | +```bash |
| 59 | +./setupTestData.sh |
| 60 | +``` |
| 61 | + |
| 62 | +The user has the following credentials: |
| 63 | + |
| 64 | +Email: `test@openshock.org` |
| 65 | +Username: `OpenShock-Test` |
| 66 | +Password: `OpenShock123!` |
| 67 | + |
| 68 | +PS: The locally started WebUI is available at `http://localhost:8080`. |
| 69 | + |
| 70 | + |
| 71 | +### Running the other projects |
| 72 | + |
| 73 | +### Connecting a Hub to this locally running instance |
| 74 | + |
| 75 | +### Creating migrations |
0 commit comments