freeleaps-pub/devbox/devbox.local/README.md
2025-01-16 08:41:50 +00:00

72 lines
4.8 KiB
Markdown
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

For Apple Chip:
- Choose
![latest:multi](image.png)
- Your local devbox will look like:
![devbox_v3:latest-multi](image-1.png)
In order to use the latest:multi, update the launch.sh (the repo you got from: https://freeleaps.com:3443/freeleaps/freeleaps-pub.git) to use latest:multi instead of latest when pulling image
Issues you may run into aside from following instructions from doc: https://netorgft10898514.sharepoint.com/:w:/r/sites/CoreEngineering/_layouts/15/Doc.aspx?sourcedoc=%7BC6FE820D-FD5B-40CC-AD47-BB8691B3BC39%7D&file=Freeleaps%20Local%20DevBox%20Usage.docx&action=default&mobileredirect=true
acr_login - you may need to re-run this on your devbox_local docker.
And acr_login may not work on Mac:
```
freedev@ca42ea8db43f:~/devbox$ ./acr_login.sh
rosetta error: failed to open elf at /lib64/ld-linux-x86-64.so.2
/usr/bin/az: line 3: 725 Trace/breakpoint trap AZ_INSTALLER=DEB "$bin_dir"/../../opt/az/bin/python3 -Im azure.cli "$@"
rosetta error: failed to open elf at /lib64/ld-linux-x86-64.so.2
/usr/bin/az: line 3: 729 Trace/breakpoint trap AZ_INSTALLER=DEB "$bin_dir"/../../opt/az/bin/python3 -Im azure.cli "$@"
Error: Cannot perform an interactive login from a non TTY device
```
Then, you need to:
```
az ad sp create-for-rbac --name <service-principal-name> --role contributor --scopes /subscriptions/<subscription-id>
```
and:
```
export AZURE_CLIENT_ID=<appId>
export AZURE_SECRET=<password>
export AZURE_TENANT_ID=<tenant>
az login --service-principal --username "$AZURE_CLIENT_ID" --password "$AZURE_SECRET" --tenant "$AZURE_TENANT_ID"
```
QEMU Emulation doesn't work for me
```
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
```
Best practice:
Opening 2 VS Code IDE, one for devbox, one for freeleaps code
Devbox for starting backend/frontend
Freeleaps for coding
Once you started all required containers inside devbox_local, you shall see something like:
```
root@ca42ea8db43f:/# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3b10657107cb mongo:4.4 "docker-entrypoint.s…" 51 minutes ago Up 51 minutes 0.0.0.0:27017->27017/tcp, :::27017->27017/tcp freeleaps2-mongodb
d8327a3717d1 freeleaps.azurecr.io/rabbitmq:3.13 "docker-entrypoint.s…" 59 minutes ago Up 58 minutes 4369/tcp, 0.0.0.0:5672->5672/tcp, :::5672->5672/tcp, 5671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp, :::15672->15672/tcp freeleaps2-rabbitmq
b0f82d5d1772 freeleaps.azurecr.io/gitea:1.20.4 "/usr/bin/entrypoint…" 59 minutes ago Up 59 minutes 22/tcp, 0.0.0.0:3000->3000/tcp, :::3000->3000/tcp
```
Explanation on the set up v.s. local docker
freeleaps2-backend and freeleaps2-frontend are managed differently than the dependency containers (like gitea, mongo, and rabbitmq).
Key Differences in the Setup
1. Dependency Containers (gitea, mongo, rabbitmq):
• These services are started and managed using Docker Compose within the devbox_v3 container. They operate independently and need to be running in the background to support the backend application.
2. Backend and Frontend Code Execution:
• The init_devbox.sh script clones the code for freeleaps2-backend and freeleaps2-frontend into the local directory within the devbox_v3 container.
• Rather than running in isolated containers, the backend (uvicorn) and frontend are directly executed as processes within the devbox_v3 container itself.
3. Direct Execution Inside devbox_v3:
• By running the backend and frontend code directly inside devbox_v3, you avoid the need for additional containers for each of these services. It simplifies local development by consolidating everything into a single container environment.
4. Docker Compose for Dependencies Only:
• docker-compose.dev.yaml is used to manage only the core dependencies (like gitea, mongodb, rabbitmq), which are treated as separate containers. Future dependencies will be added there.
freeleaps2-backend and freeleaps2-frontend dont spin up as containers. Instead, they run as processes within devbox_v3, using the shared environment provided by that container.
Benefits
• Simplified Container Management: By keeping freeleaps2-backend and freeleaps2-frontend as processes in devbox_v3, we avoid - container-to-container communication and reduce the complexity of managing multiple Docker containers.
• Ease of Development: Such backend and frontend files in a unified environment will be just Freeleaps App, this allows for quicker iteration without rebuilding separate containers.