Skip to content

Commit

Permalink
adding the Tilt dev mode in the readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
leoporoli committed Aug 27, 2024
1 parent f7a7a14 commit 1d61b27
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 80 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.direnv
branch-name.nix
.idea
.DS_Store
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

17 changes: 0 additions & 17 deletions .idea/dataSources.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

17 changes: 0 additions & 17 deletions .idea/new-obd.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

30 changes: 11 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ minikube tunnel

## Development Guide

This doc explains how to build and run the OnlineBoutique source code locally using the `skaffold` command-line tool.
This doc explains how to build and run the OnlineBoutique source code locally using the `tilt` command-line tool.

### Prerequisites

- [Docker for Desktop](https://www.docker.com/products/docker-desktop).
- [Docker for Desktop](https://www.docker.com/products/docker-desktop)
- kubectl (can be installed via `gcloud components install kubectl`)
- [skaffold **1.27+**](https://skaffold.dev/docs/install/) (latest version recommended), a tool that builds and deploys Docker images in bulk.
- [tilt **0.22.2+**](https://docs.tilt.dev/install.html) (latest version recommended)
- [Minikube](https://minikube.sigs.k8s.io/docs/start/) (optional - see Local Cluster)

### Local Cluster
Expand All @@ -78,22 +78,14 @@ This doc explains how to build and run the OnlineBoutique source code locally us

2. Run `kubectl get nodes` to verify you're connected to the respective control plane.
3. Run `skaffold run` (first time will be slow, it can take ~20 minutes).
This will build and deploy the application. If you need to rebuild the images
automatically as you refactor the code, run `skaffold dev` command.
4. Run `kubectl get pods` to verify the Pods are ready and running.
5. Access the web frontend through your browser
- **Minikube** requires you to run a command to access the frontend service:
```shell
minikube service frontend-external
```
- **Docker For Desktop** should automatically provide the frontend at http://localhost:80
3. Two options:
1. Run `sudo tilt up`.
To deploy the app using the `./release/obd-kardinal.yaml` file, with Kardinal annotations, in the cluster. Take into account that it will use the container images defined in the YAML, it will try to pull them from the cloud. The sudo privileges are necessary in order to port-forward the port "80"
2. Run `sudo tilt up -- --build frontend --build productcatalogservice`.
To deploy the app using the `./release/obd-kardinal.yaml` file and also create a new 'dev' flow with dev images version for the services specified with the `build` flag (valid values: 'frontend', 'cartservice', 'productcatalogservice', convine these as you want).
Edit the source code and check the changes in the dev URL, `Tilt` will trigger the hot-reload for it
## Cleanup
If you've deployed the application with `skaffold run` command, you can run
`skaffold delete` to clean up the deployed resources.
If you've deployed the application with `tilt up` command, you can run
`tilt down --delete-namespaces` to clean up the deployed resources, the `--delete-namespaces` flas is important because otherwise it won't delete the namespace.
2 changes: 0 additions & 2 deletions src/cartservice/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ var (
func main() {
logrus.Info("Running REST API server...")

logrus.Info("[KARDINAL-DEBUG] demo demo 3")

// This is how you set up a basic Echo router
echoRouter := echo.New()
echoRouter.Use(middleware.Logger())
Expand Down
2 changes: 1 addition & 1 deletion src/frontend.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ COPY ./frontend/templates ./templates
COPY ./frontend/static ./static
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

ENTRYPOINT ["/hipstershop/frontend"]
ENTRYPOINT ["/hipstershop/frontend"]
3 changes: 1 addition & 2 deletions src/frontend/static/styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ header .h-control :-moz-placeholder {

header .navbar.sub-navbar {
height: 60px;
background-color: #bd9898;
background-color: white;
font-size: 15px;
color: #b4b2bb;
padding-top: 0;
Expand Down Expand Up @@ -333,7 +333,6 @@ main {
.hot-product-card-name {
margin-top: 8px;
font-size: 18px;
color: #2c0878;
}

.hot-product-card-brand {
Expand Down

0 comments on commit 1d61b27

Please sign in to comment.