Skip to content

Commit

Permalink
First version
Browse files Browse the repository at this point in the history
  • Loading branch information
pchico83 committed Feb 19, 2020
1 parent 16349ee commit bd5f337
Show file tree
Hide file tree
Showing 27 changed files with 2,100 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.pyc
project.lock.json
bin/
obj/
.vs/
node_modules/
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,34 @@
# stack-getting-started
A sample repo to getting started with Okteto Stacks
# Getting Started on Okteto with Stacks

This example shows how to leverage [Okteto](https://github.com/okteto/okteto) to deploys the Voting App in Kubernetes using Okteto Stacks.

<!-- This is the application used for the [How to Develop and Debug PHP Applications in Kubernetes](https://okteto.com/blog/how-to-develop-php-apps-in-kubernetes/) blog post. -->

The Voting App is a simple distributed application running across multiple containers. Containers are implemented using Python, Node.js and Java, with Redis for messaging and Postgres for storage.

![Architecture diagram](architecture.png)

* A front-end web app in [Python](/vote) which lets you vote between two options.
* A [Redis](https://hub.docker.com/_/redis/) queue which collects new votes.
* A [Java](/worker/src/main) worker which consumes votes and stores them in...
* A [Postgres](https://hub.docker.com/_/postgres/) database backed by a volume.
* A [Node.js](/result) webapp which shows the results of the voting in real time.


## Deploy the Voting App

```
okteto stack deploy
```

## Deploy the Voting App rebuilding containers

```
okteto stack deploy --build
```

## Destroy the Voting App

```
okteto stack destroy
```
Binary file added architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions okteto-stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
okteto: true
services:
vote:
public: true
image: okteto/vote:1
build: vote
replicas: 2
env:
- OPTION_A=Cats
- OPTION_B=Dogs
ports:
- 80

result:
public: true
image: okteto/result:1
build: result
command: node server.js
ports:
- 80

worker:
image: okteto/worker:1
build: worker

db:
image: postgres:9.4
ports:
- 5432
volumes:
- /var/lib/postgresql/data

redis:
image: redis:alpine
ports:
- 6379
1 change: 1 addition & 0 deletions result/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
19 changes: 19 additions & 0 deletions result/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM node:10-slim

WORKDIR /app

RUN npm install -g nodemon

COPY package*.json ./

RUN npm ci \
&& npm cache clean --force \
&& mv /app/node_modules /node_modules

COPY . .

ENV PORT 80

EXPOSE 80

CMD ["node", "server.js"]
Loading

0 comments on commit bd5f337

Please sign in to comment.