https://github.com/s-matyukevich/sample-k8s-app
https://github.com/s-matyukevich/sample-k8s-app
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/s-matyukevich/sample-k8s-app
- Owner: s-matyukevich
- Created: 2018-10-25T01:42:28.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-25T14:13:32.000Z (almost 7 years ago)
- Last Synced: 2024-12-29T06:42:04.437Z (10 months ago)
- Language: Go
- Size: 144 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## sample-k8s-app
### Running localy
1. Build the application image
```
IMAGE=/sample-k8s-app
docker build . -t $IMAGE
```1. Start the DB
```
docker run --rm --name db -e MYSQL_ROOT_PASSWORD=root -d mysql
```1. Run the backend
```
docker run --rm --name backend --link db:mysql -p 8081:8081 -d $IMAGE app -port=8081 -db-host=db -db-password=root
```1. Run the frontend
```
docker run --rm --name frontend --link backend -p 8080:8080 -d $IMAGE app -frontend=true -backend-service=http://backend:8081
```1. Verify that db, backend and frontend containers are running
```
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6ed930149bff smatyukevich/sample-k8s-app "app -frontend=true …" 46 seconds ago Up 43 seconds 0.0.0.0:8080->8080/tcp frontend
4903f99a4727 smatyukevich/sample-k8s-app "app -port=8081 -db-…" About a minute ago Up About a minute 0.0.0.0:8081->8081/tcp backend
ca1f75c19239 mysql "docker-entrypoint.s…" 3 minutes ago Up 3 minutes 3306/tcp db
```1. Open in your browser 'http://localhost:8080' and check that the app is working
1. Cleanup
```
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
```