Skip to content

Commit

Permalink
avniproject/avni-product#1445 | JasperServer based on docker/nginx fo…
Browse files Browse the repository at this point in the history
…r RWB
  • Loading branch information
1t5j0y committed Jan 12, 2024
1 parent 36c8c68 commit 6a77079
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 2 deletions.
3 changes: 3 additions & 0 deletions configure/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ etl-rwb-staging: check-app-zip-path check-vault-pwd-file
metabase-onpremise:
ansible-playbook onpremise_metabase_servers.yml -i inventory/onpremise --vault-password-file ${VAULT_PASSWORD_FILE}

jasper-rwb-staging: check-vault-pwd-file
ansible-playbook rwb_jasperserver_servers.yml -i inventory/rwb_staging --vault-password-file ${VAULT_PASSWORD_FILE}

deploy-etl-staging: check-app-zip-path check-vault-pwd-file
APPLICATION_ZIP_PATH=$(app_zip_path) APPLICATION_ZIP_FILE_NAME=etl-1.0.0-SNAPSHOT.jar ansible-playbook deploy_app_to_servers.yml -i inventory/staging --vault-password-file ${VAULT_PASSWORD_FILE} \
--extra-vars '{"deploy_app_name":"etl","deploy_app_hosts":"etlservers","deploy_app_remote_user":"avni-etl-user","deploy_app_env":"staging","deploy_app_role":"etl_appserver","deploy_app_env_vars_file":"group_vars/staging_vars.yml","deploy_app_env_secret_vars_file":"group_vars/staging-secret-vars.yml.enc"}'
Expand Down
16 changes: 16 additions & 0 deletions configure/group_vars/jasperserver_docker_vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---

jasperserver_container_name: jasperserver
jasperserver_container_image: bitnami/jasperreports:8.2.0
jasperserver_hostname: jasperserver
jasperserver_container_healthcheck_cmd: "curl --fail -I http://0.0.0.0:8080/jasperserver/rest_v2/serverInfo || exit 1"
jasperserver_container_ports_mapping: "8080:8080"
jasperserver_container_env_file: "/root/jasperserver_docker.env"
jasperserver_container_env_template_file: jasperserver.docker.env.template.j2

update_apt_cache: yes
# Application settings.
application_name: jasperserver
app_description: Avni Jasper server
application_user: jasperserver
application_group: jasperserver
9 changes: 9 additions & 0 deletions configure/group_vars/rwb_jasper-secret-vars.yml.enc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$ANSIBLE_VAULT;1.1;AES256
36353535333235633364393639393032356538366234396366373031666436343065303535373535
6336353037613266623136353463666434663463633632360a343864643231666432653831626362
65373962366639376237666334633830633661373364366136623236376564653465393039396534
6565373461336436650a366561363964363633363666343437393938386530633461656664663265
33383139663833333865616632373131393635373037333566383864326139646233353166343331
36393635373661643763616661323464333866616634623665663464383766383134353961396533
35316266623234663732643737383837313038366135373035316330306333323132303231326665
66636435636434356335
21 changes: 21 additions & 0 deletions configure/group_vars/rwb_jasper_vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---

jasperserver_db_type: postgresql
jasperserver_allow_empty_password: no
jasperserver_skip_bootstrap: no
jasperserver_use_root_url: true

public_url: jasper.rwb.avniproject.org
etl_appserver_port: 8080
int_appserver_port: 8080

jasperserver_db_host: stagingdb.rwb.avniproject.org
jasperserver_db_port: 5432
jasperserver_db_user: jasperreports
jasperserver_db_name: jasperreports
jasperserver_username: jasperadmin

ufw_allowed_ports:
- "22"
- "80"
- "443"
3 changes: 3 additions & 0 deletions configure/inventory/rwb_staging
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ ssh.staging.rwb.avniproject.org ansible_user=ubuntu ansible_port=22 ansible_ssh_

[etlservers]
etl-staging.rwb.avniproject.org ansible_user=ubuntu ansible_port=22 ansible_ssh_private_key_file=~/.ssh/rwb-infra.pem

[jasperservers]
jasper.rwb.avniproject.org ansible_user=ubuntu ansible_port=22 ansible_ssh_private_key_file=~/.ssh/rwb-infra.pem
3 changes: 1 addition & 2 deletions configure/roles/docker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
pip:
name: docker

- name: Pull default Docker image
- name: Pull Docker image
community.docker.docker_image:
name: "{{ docker_container_image }}"
source: pull
Expand All @@ -65,7 +65,6 @@
state: started
restart: true
ports:
# Publish container port 3000 as host port 3000
- "{{ docker_container_ports_mapping }}"
env_file: "{{ docker_container_env_file }}"
healthcheck:
Expand Down
9 changes: 9 additions & 0 deletions configure/roles/jasperserver/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---

app_container_name: "{{ jasperserver_container_name }}"
app_container_image: "{{ jasperserver_container_image }}"
app_hostname: "{{ jasperserver_hostname }}"
app_container_healthcheck_cmd: "{{ jasperserver_container_healthcheck_cmd }}"
app_container_ports_mapping: "{{ jasperserver_container_ports_mapping }}"
app_container_env_file: "{{ jasperserver_container_env_file }}"
app_container_env_template_file: "{{ jasperserver_container_env_template_file }}"
5 changes: 5 additions & 0 deletions configure/roles/jasperserver/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---

- name: "Deploy Jasperserver Docker Container"
include_role:
name: docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
JASPERREPORTS_DATABASE_TYPE={{ jasperserver_db_type }}
JASPERREPORTS_DATABASE_HOST={{ jasperserver_db_host }}
JASPERREPORTS_DATABASE_PORT_NUMBER={{ jasperserver_db_port }}
JASPERREPORTS_DATABASE_USER={{ jasperserver_db_user }}
JASPERREPORTS_DATABASE_NAME={{ jasperserver_db_name }}
JASPERREPORTS_DATABASE_PASSWORD={{ jasperserver_db_password }}

ALLOW_EMPTY_PASSWORD={{ jasperserver_allow_empty_password }}
JASPERREPORTS_USERNAME={{ jasperserver_username }}
JASPERREPORTS_PASSWORD={{ jasperserver_password }}
JASPERREPORTS_SKIP_BOOTSTRAP={{ jasperserver_skip_bootstrap }}
JASPERREPORTS_USE_ROOT_URL={{ jasperserver_use_root_url }}
22 changes: 22 additions & 0 deletions configure/rwb_jasperserver_servers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---

- name: Configure Jasperserver server
hosts: jasperservers
become: yes
become_user: root
remote_user: "{{ application_user }}"
tags:
- jasper
# vars:
vars_files:
- group_vars/basic_docker_vars.yml
- group_vars/jasperserver_docker_vars.yml
- group_vars/rwb_jasper_vars.yml
- group_vars/rwb_jasper-secret-vars.yml.enc
roles:
# - base
# - security
# - nginx
# - certbot
# - jasperserver
- nginx_appserver

0 comments on commit 6a77079

Please sign in to comment.