Skip to content

Commit

Permalink
being updating for smartbrain
Browse files Browse the repository at this point in the history
  • Loading branch information
mosabami committed Mar 27, 2023
1 parent 2e8a7f4 commit 58651e6
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 18 deletions.
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ If there are other AKS features you'd like to see here that help with developer
## Prerequisites
It is assumed you have basic knowledge of Containers, Kubernetes and Azure. You would also require Contributor and User Access Admin access to an Azure subscription and an AAD tenant where you have User Admin access. On your computer you will need to have the following installed
* git,
* [Bicep](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/install),
* [jq](https://stedolan.github.io/jq/download/),
* [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/),
* [Bicep](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/install)
* [jq](https://stedolan.github.io/jq/download/)
* [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/)
* [sed](https://gnuwin32.sourceforge.net/packages/sed.htm) (optional)
* [node and npm](https://nodejs.org/en/download/) for the Bridge to Kubernetes step
* Azure CLI
Expand All @@ -46,16 +46,24 @@ You will also require visual studio code with the following extensions installed
You can install these by searching for them in the Extensions tab.

## Test the app on your computer (optional)
If you have docker desktop install on your computer and you have some experience with docker-compose you can run the application on your local computer.
If you have docker desktop install and started on your computer, and you have some experience with docker-compose you can run the application on your local computer.
Introduce a bug in the code so that we can correct it later
> :warning: If you are using a mac you will need to change the command to `sed -i "s/Sign In/Signing In/" smartbrain/smartbrain/smartbrainclient/src/components/Signin/Signin.js`.
> :bulb: If these sed commands don't work for any reason or if you don't have sed installed, you will need to update these files manually by replacing the placeholders in the files mentioned below.
```bash
sed -i "s/Sign In/Signing In/" smartbrain/smartbrain/smartbrainclient/src/components/Signin/Signin.js
```
Run the application using docker-compose.
```bash
cd fib-calculator
cd smartbrain/smartbrain
docker-compose up
```
You can access the website at port 3050 on your local computer using NGINX as an ingress controller. Check out the docker-compose.yaml file for more details.
![App running on local computer](./media/running-local.png)
You can test the app by entering a number under 40, clicking submit and refreshing the page.
> :bulb: You might find that there is a bug in the fibonacci number calculation. This bug will be fixed in the **Testing & Debugging individual microservices using Bridge to Kubernetes** section of the workshop.
You can test the app by clicking on register and providing the required information.

> :bulb: You might find that there is a bug in the spelling of Password. This bug will be fixed in the **Testing & Debugging individual microservices using Bridge to Kubernetes** section of the workshop.
Here is what the architecture of the app looks like
![App architecture](./media/service-architecture.png)
Expand Down
25 changes: 14 additions & 11 deletions fib-calculator/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ services:
image: 'postgres:latest'
environment:
- POSTGRES_PASSWORD=postgres_password
- POSTGRES_USER=pguser
redis:
image: 'redis:latest'
nginx:
Expand All @@ -12,16 +13,18 @@ services:
- client
restart: always
build:
dockerfile: Dockerfile.dev
dockerfile: Dockerfile
context: ./nginx
ports:
- '3050:80'
api:
depends_on:
- postgres
- redis
- worker
build:
dockerfile: Dockerfile.dev
context: ./server
dockerfile: Dockerfile
context: ./smartbrainapi
ports:
- "5000:5000"
# volumes:
Expand All @@ -30,7 +33,7 @@ services:
environment:
- REDIS_HOST=redis
- REDIS_PORT=6379
- PGUSER=postgres
- PGUSER=pguser
- PGHOST=postgres
- PGDATABASE=postgres
- PGPASSWORD=postgres_password
Expand All @@ -47,21 +50,21 @@ services:
stdin_open: true
container_name: client
build:
context: ./client
context: ./smartbrainclient
dockerfile: Dockerfile
# volumes:
# - '.:/app'
# - '/app/node_modules'
volumes:
- /app/src
- ./smartbrainclient/src:/app/src
ports:
- 3000:3000
environment:
- CHOKIDAR_USEPOLLING=true
worker:
build:
dockerfile: Dockerfile.dev
context: ./worker
dockerfile: Dockerfile
context: ./smartbrainml
ports:
- 5001:5001
- 2000:2000
# volumes:
# - /app/node_modules
# - ./worker:/app
Expand Down
Binary file modified media/running-local.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/service-architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 58651e6

Please sign in to comment.