Skip to content
This repository has been archived by the owner on Mar 22, 2018. It is now read-only.

Added Sentry Nulecule application on Docker, Kubernetes. #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions sentry-atomicapp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM projectatomic/atomicapp:0.1.3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this update to :latest?


MAINTAINER Ratnadeep Debnath <rtnpro@redhat.com>

LABEL io.projectatomic.nulecule.specversion="0.0.2" \
io.projectatomic.nulecule.providers="kubernetes,docker"

ADD /Nulecule gpl-3.0.txt /application-entity/
ADD /artifacts /application-entity/artifacts
68 changes: 68 additions & 0 deletions sentry-atomicapp/Nulecule
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
specversion: 0.0.2
id: sentry-atomicapp

metadata:
name: sentry Atomic App
appversion: 1.0.0
description: This is sentry

params:
- name: db_user
description: Database user
default: sentry
- name: db_pass
description: Database password
default: password
- name: db_name
description: Database name
default: sentry

graph:
- name: postgresql
params:
- name: name
description: Container name for postgresql
default: postgres
- name: image
description: Container image name for postgresql
default: postgres
artifacts:
docker:
- file://artifacts/docker/postgres
kubernetes:
- file://artifacts/kubernetes/postgres-pod.yaml
- file://artifacts/kubernetes/postgres-service.yaml

- name: redis
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could some other redis atomicapp be reused?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will give it a shot.

params:
- name: name
description: Container name for redis
default: redis
- name: image
description: Container image name for redis
default: redis
artifacts:
docker:
- file://artifacts/docker/redis
kubernetes:
- file://artifacts/kubernetes/redis-pod.yaml
- file://artifacts/kubernetes/redis-service.yaml

- name: sentry
params:
- name: name
description: Container name for sentry
default: sentry
- name: image
description: Container image name for sentry
default: rtnpro/sentry
- name: nodePort
description: Host port to bind sentry service to
default: 30001
artifacts:
docker:
- file://artifacts/docker/sentry
kubernetes:
- file://artifacts/kubernetes/sentry-pod.yaml
- file://artifacts/kubernetes/sentry-service.yaml
49 changes: 49 additions & 0 deletions sentry-atomicapp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Build

```
[sudo] docker build -t projectatomic/sentry .
```

# Run

- Copy ``answers.conf.sample`` to ``answers.conf`` and customize as needed.

```
[sudo] atomic run projectatomic/sentry
```

## Kubernetes

Run ``kubectl get pods`` to check if the pods for ``redis``, ``postgres``
and ``sentry`` are up and running.

Check info for ``sentry`` service.

```
$ kubectl get services sentry
NAME LABELS SELECTOR IP(S) PORT(S)
sentry name=sentry name=sentry 10.254.131.20 9000/TCP
```

## Docker

Run ``sudo docker ps`` to check if the containers for sentry are running.

```
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e0c500f83ea8 rtnpro/sentry "/docker-entrypoint.s" 2 seconds ago Up 2 seconds 0.0.0.0:30001->9000/tcp sentry
dc6a8ef80731 redis "/entrypoint.sh redis" 3 seconds ago Up 2 seconds 6379/tcp sentry_redis
0b8c51d12644 postgres "/docker-entrypoint.s" 3 seconds ago Up 3 seconds 5432/tcp sentry_postgres
```

# Usage

## Kubernetes

- Setup sentry: ``kubectl exec -ti sentry sentry upgrade``

- Open ``http://10.254.131.20:9000`` in browser to access Sentry.

## Docker
- Setup sentry: ``sudo docker exec -ti sentry sentry upgrade``
- Open ``http://localhost:30001`` in browser to access Sentry.
19 changes: 19 additions & 0 deletions sentry-atomicapp/answers.conf.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[general]
namespace=default
provider=kubernetes
db_user=sentry
db_pass=sentry
db_name=sentry

[postgresql]
name=postgres
image=postgres

[redis]
name=redis
image=redis

[sentry]
name=sentry
image=rtnpro/sentry
nodePort=30001
1 change: 1 addition & 0 deletions sentry-atomicapp/artifacts/docker/postgres
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker run --name=sentry_postgres -e POSTGRES_PASSWORD=$db_pass -d $image
1 change: 1 addition & 0 deletions sentry-atomicapp/artifacts/docker/redis
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker run --name=sentry_redis -d $image
1 change: 1 addition & 0 deletions sentry-atomicapp/artifacts/docker/sentry
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker run --name sentry --link sentry_redis:redis --link sentry_postgres:postgres --publish $nodePort:9000 -d $image
18 changes: 18 additions & 0 deletions sentry-atomicapp/artifacts/kubernetes/postgres-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
id: postgres
spec:
containers:
- name: $name
image: $image
env:
- name: POSTGRES_USER
value: $db_user
- name: POSTGRES_PASSWORD
value: $db_pass
ports:
- containerPort: 5432
metadata:
name: postgres
labels:
name: postgres
kind: Pod
19 changes: 19 additions & 0 deletions sentry-atomicapp/artifacts/kubernetes/postgres-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
kind: Service
apiVersion: v1
metadata:
name: $name
labels:
name: postgres
spec:
ports:
- protocol: TCP
port: 5432
targetPort: 5432
nodePort: 0
selector:
name: postgres
portalIP: None
type: ClusterIP
sessionAffinity: None
status:
loadBalancer: {}
13 changes: 13 additions & 0 deletions sentry-atomicapp/artifacts/kubernetes/redis-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
id: redis
spec:
containers:
- name: $name
image: $image
ports:
- containerPort: 6379
metadata:
name: redis
labels:
name: redis
kind: Pod
19 changes: 19 additions & 0 deletions sentry-atomicapp/artifacts/kubernetes/redis-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
kind: Service
apiVersion: v1
metadata:
name: $name
labels:
name: redis
spec:
ports:
- protocol: TCP
port: 6379
targetPort: 6379
nodePort: 0
selector:
name: redis
portalIP: None
type: ClusterIP
sessionAffinity: None
status:
loadBalancer: {}
18 changes: 18 additions & 0 deletions sentry-atomicapp/artifacts/kubernetes/sentry-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
id: sentry
spec:
containers:
- name: sentry
image: rtnpro/sentry
ports:
- containerPort: 9000
env:
- name: POSTGRES_ENV_POSTGRES_USER
value: $db_user
- name: POSTGRES_ENV_POSTGRES_PASSWORD
value: $db_pass
metadata:
name: sentry
labels:
name: sentry
kind: Pod
15 changes: 15 additions & 0 deletions sentry-atomicapp/artifacts/kubernetes/sentry-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
kind: Service
apiVersion: v1
metadata:
name: sentry
labels:
name: sentry
spec:
ports:
- protocol: TCP
port: 9000
targetPort: 9000
nodePort: $nodePort
selector:
name: sentry
type: "NodePort"
Loading