Skip to content

Commit

Permalink
Added deploy files
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleymonte committed Sep 30, 2020
1 parent f6f4024 commit 14c5059
Show file tree
Hide file tree
Showing 9 changed files with 173 additions and 0 deletions.
8 changes: 8 additions & 0 deletions deploy/arrebol/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
spring.jpa.database=POSTGRESQL
spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.platform=postgres
spring.datasource.url=jdbc:postgresql://postgresql:5432/arrebol
spring.datasource.username=
spring.datasource.password=
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=create
17 changes: 17 additions & 0 deletions deploy/arrebol/arrebol.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"poolType":"docker",
"properties": [
{
"key":"workerPoolSize",
"value": 5
},
{
"key": "imageId",
"value": "wesleymonte/simple-worker"
},
{
"key": "resourceAddresses",
"value": ["http://localhost:5555"]
}
]
}
3 changes: 3 additions & 0 deletions deploy/deploy-stack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

sudo docker stack deploy -c $(pwd)/docker-stack.yml lsd
79 changes: 79 additions & 0 deletions deploy/docker-stack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
version: '3.7'
services:
postgresql:
image: postgres
env_file: ./postgres/postgres.env
ports:
- 5432:5432
networks:
- iguassu-net
volumes:
- postgresdata:/var/lib/postgresql/data
- ./postgres/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh

pgadmin:
image: dpage/pgadmin4
env_file: ./pgadmin/pgadmin.env
ports:
- 15432:80
networks:
- iguassu-net

arrebol:
image: ufcglsd/arrebol
ports:
- 8080:8080
networks:
- iguassu-net
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./arrebol/arrebol.json:/service/config/arrebol.json
- ./arrebol/application.properties:/service/config/application.properties
deploy:
mode: global
restart_policy:
condition: on-failure
delay: 30s
max_attempts: 3

iguassu:
image: ufcglsd/iguassu
ports:
- 8081:8081
networks:
- iguassu-net
volumes:
- ./iguassu/iguassu.conf:/service/config/iguassu.conf
- ./iguassu/application.properties:/service/config/application.properties
deploy:
mode: replicated
replicas: 1
restart_policy:
condition: on-failure
delay: 30s
max_attempts: 3

iguassu-dashboard:
image: ufcglsd/iguassu-dashboard
ports:
- 80:80
networks:
- iguassu-net

provider-service:
image: wesleymonte/provider-service:queues
ports:
- 5000:5000
volumes:
- ./provider/keys/pp:/service/keys/pp
- ./provider/keys/pp.pub:/service/keys/pp.pub
networks:
- iguassu-net

volumes:
postgresdata: {}


networks:
iguassu-net:
driver: overlay
12 changes: 12 additions & 0 deletions deploy/iguassu/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
server.servlet.context-path=/api/v2
server.port=8081

## PostgreSQL
spring.jpa.database=POSTGRESQL
spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.platform=postgres
spring.datasource.url=jdbc:postgresql://postgresql:5432/iguassu
spring.datasource.username=
spring.datasource.password=
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=create
2 changes: 2 additions & 0 deletions deploy/pgadmin/pgadmin.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PGADMIN_DEFAULT_EMAIL=
PGADMIN_DEFAULT_PASSWORD=
9 changes: 9 additions & 0 deletions deploy/postgres/init-db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -e

psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE DATABASE iguassu;
CREATE DATABASE arrebol;
GRANT ALL PRIVILEGES ON DATABASE iguassu TO "$POSTGRES_USER";
GRANT ALL PRIVILEGES ON DATABASE arrebol TO "$POSTGRES_USER";
EOSQL
2 changes: 2 additions & 0 deletions deploy/postgres/postgres.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
POSTGRES_USER=
POSTGRES_PASSWORD=
41 changes: 41 additions & 0 deletions deploy/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

# A script to setup a swarm manager environment.
# It expects to be run on Ubuntu 16.04 via 'sudo'

install_docker() {
echo "--> Installing docker"
apt update

apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

apt-key fingerprint 0EBFCD88

add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

apt-get update

apt-get install -y docker-ce
}

run() {
DOCKER_INSTALLED=$(dpkg -l | grep -c docker-ce)

if ! [ $DOCKER_INSTALLED -ne 0 ]; then
install_docker
docker swarm init
else
echo "--> Docker already installed!"
fi
}

run

0 comments on commit 14c5059

Please sign in to comment.