-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kyma infra docker #6
base: main
Are you sure you want to change the base?
Changes from all commits
b49844b
127a800
50587e6
76713f1
af608da
8dda91b
6d51491
71273a7
933b163
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
--- | ||
|
||
|
||
- name: Check if Maven is installed | ||
ansible.builtin.command: | ||
cmd: mvn --version | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
language: python | ||
python: "2.7" | ||
|
||
# Use the new container infrastructure | ||
sudo: false | ||
|
||
# Install ansible | ||
addons: | ||
apt: | ||
packages: | ||
- python-pip | ||
|
||
install: | ||
# Install ansible | ||
- pip install ansible | ||
|
||
# Check ansible version | ||
- ansible --version | ||
|
||
# Create ansible.cfg with correct roles_path | ||
- printf '[defaults]\nroles_path=../' >ansible.cfg | ||
|
||
script: | ||
# Basic role syntax check | ||
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check | ||
|
||
notifications: | ||
webhooks: https://galaxy.ansible.com/api/v1/notifications/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
Role Name | ||
========= | ||
|
||
Installs java11 and java8 on a Fedora server that can be used with Quarkus and EAP app deployment respectively. | ||
|
||
Requirements | ||
------------ | ||
|
||
Provision the fedora server using ./create_infra.sh. Please refer to the [readme](../README.md) | ||
|
||
Dependencies | ||
------------ | ||
* This role is dependent on the following roles | ||
- jboss-eap | ||
- Wildfly utils | ||
- Wildfly driver | ||
- keycloak | ||
|
||
How to deploy the apps | ||
------------- | ||
* For setting up the ec2 instance, refer to [ec2 role](https://github.com/migtools/playpen/tree/main/ec2#readme) | ||
|
||
* Once its setup, make sure the app you want to install has the [correct configuration](./ec2/roles/kyma_infra/defaults/main.yml) | ||
|
||
* Run the role using the script `./setup_kyma_infra.sh` | ||
|
||
Once the run is successful you can access the apps in the following URLs, | ||
|
||
* Kitchensink - https://github.com/tqvarnst/jboss-eap-quickstarts/tree/quarkus-3.2, https://github.com/windup/jboss-eap-quickstarts/tree/7.4.x/kitchensink/src/main/java/org/jboss/as/quickstarts/kitchensink | ||
* eap - http://<ec2 url>:8080/kitchensink | ||
* quarkus - http://<ec2 url>:8085/kitchensink | ||
|
||
* helloworld-mdb - https://github.com/savitharaghunathan/helloworld-mdb | ||
* eap - http://<ec2 url>:8080/helloworld-mdb/HelloWorldMDBServletClient (to send messages to the queue) | ||
* eap - http://<ec2 url>:8080/helloworld-mdb/HelloWorldMDBServletClient?topic ( to send messages to the topic) | ||
* quarkus - http://<ec2 url>:8085/HelloWorldMDBServletClient | ||
* quarkus - http://<ec2 url>:8085/HelloWorldMDBServletClient?topic | ||
|
||
* coolstoredb - https://github.com/mathianasj/eap-coolstore-monolith/tree/quarkus-migration, https://github.com/deewhyweb/eap-coolstore-monolith | ||
* eap - http://<ec2 url>:8080 | ||
* quarkus - http://<ec2 url>:8085 | ||
|
||
|
||
Additional Information | ||
------------- | ||
|
||
Background | ||
------------- | ||
|
||
* Infra setup: | ||
* Server: fedora 38 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should bump this to at least 39 if it doesn't cause problems. I didn't note any going through the process. F40 is well on the way and 38 will be EOL soon after. Better would probably be something with a longer life per release like RHEL/CentOS Stream, but understand if that presents difficulty we don't need to spend time on right now. |
||
* docker-ce | ||
* EAP 7.4 using java 8 | ||
* EAP running on port 8080 | ||
* Quarkus using java 11/17 depending on the app | ||
* Quarkus running on port 8085 | ||
* Java versions and quarkus installations are managed by sdkman | ||
* manual maven install | ||
* uses roles from migtools/playpen repo to create ec2 instance and configure eap | ||
* note: eap should use standalone full config for messaging to work | ||
* created a new role called kyma_infra - https://github.com/migtools/playpen/pull/5 | ||
* run the role using the script ./setup_kyma_infra.sh | ||
|
||
Todo: | ||
------ | ||
* refactor java installation | ||
* Take input of java versions and install that using sdkman | ||
* Run apps in prod mode | ||
* Note: wildfly role overrides java8 installed by sdkman. Refactor wildfly role to not install java, it is installed already | ||
* Use mainitained ansible role for maven install and management if possible |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
# defaults file for kyma_infra | ||
|
||
jboss_install_home: /opt/jboss-eap | ||
jboss_owner: jboss-eap | ||
jboss_group: jboss-eap | ||
|
||
#helloworld-mdb | ||
#maven_deploy: false | ||
#app_path: . | ||
#app_name: helloworld-mdb | ||
#git_url: https://github.com/savitharaghunathan/helloworld-mdb.git | ||
#local_app_path: /home/fedora/{{ app_name }} | ||
#javaee_git_branch: javaee | ||
#quarkus_git_branch: quarkus | ||
#same_repo: true | ||
#war_file_path: '{{ local_app_path }}/target/{{ app_name }}.war' | ||
#quarkus_java_version: 11.0.21-tem | ||
|
||
|
||
# kitchensink | ||
#maven_deploy: false | ||
#app_path: kitchensink | ||
#app_name: jboss-eap-quickstarts | ||
#local_app_path: /home/fedora/{{ app_name }}/{{ app_path }} | ||
#war_file_path: '{{ local_app_path }}/target/{{ app_path }}.war' | ||
#git_url: https://github.com/windup/jboss-eap-quickstarts.git | ||
#git_url_quarkus: https://github.com/tqvarnst/jboss-eap-quickstarts.git | ||
#javaee_git_branch: 7.4.x | ||
#quarkus_git_branch: quarkus-3.2 | ||
#same_repo: false | ||
#quarkus_java_version: 17.0.9-tem | ||
|
||
# coolstoredb | ||
maven_deploy: false | ||
app_path: . | ||
app_name: coolstoredb | ||
git_url: https://github.com/mathianasj/eap-coolstore-monolith | ||
local_app_path: /home/fedora/{{ app_name }} | ||
javaee_git_branch: main | ||
quarkus_git_branch: quarkus-migration | ||
same_repo: true | ||
war_file_path: '{{ local_app_path }}/target/ROOT.war' | ||
quarkus_java_version: 17.0.9-tem |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
/opt/jboss-eap-7.4/bin/jboss-cli.sh --connect --file=/opt/jboss-eap-7.4/bin/postgres.cli |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Batch script to add the PostgreSQL driver to the WildFly server configuration | ||
|
||
# Start batching commands | ||
batch | ||
|
||
# Add the PostgreSQL database driver to the datasources subsystem | ||
|
||
/subsystem=datasources/jdbc-driver=postgresql:add(driver-name=postgresql,driver-module-name=org.postgresql) | ||
|
||
data-source add --name=CoolstoreDS --jndi-name=java:jboss/datasources/CoolstoreDS --driver-name=postgresql --connection-url=jdbc:postgresql://localhost:5432/postgresDB --user-name=postgresUser --password=postgresPW | ||
|
||
jms-topic add --topic-address=topic.orders --entries=topic/orders | ||
|
||
/subsystem=messaging-activemq/server=default:write-attribute(name=cluster-password, value=password) | ||
|
||
# Run the batch commands | ||
run-batch | ||
|
||
# Reload the server configuration | ||
reload |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
# handlers file for kyma_infra |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
galaxy_info: | ||
author: your name | ||
description: your role description | ||
company: your company (optional) | ||
|
||
# If the issue tracker for your role is not on github, uncomment the | ||
# next line and provide a value | ||
# issue_tracker_url: http://example.com/issue/tracker | ||
|
||
# Choose a valid license ID from https://spdx.org - some suggested licenses: | ||
# - BSD-3-Clause (default) | ||
# - MIT | ||
# - GPL-2.0-or-later | ||
# - GPL-3.0-only | ||
# - Apache-2.0 | ||
# - CC-BY-4.0 | ||
license: license (GPL-2.0-or-later, MIT, etc) | ||
|
||
min_ansible_version: 2.1 | ||
|
||
# If this a Container Enabled role, provide the minimum Ansible Container version. | ||
# min_ansible_container_version: | ||
|
||
# | ||
# Provide a list of supported platforms, and for each platform a list of versions. | ||
# If you don't wish to enumerate all versions for a particular platform, use 'all'. | ||
# To view available platforms and versions (or releases), visit: | ||
# https://galaxy.ansible.com/api/v1/platforms/ | ||
# | ||
# platforms: | ||
# - name: Fedora | ||
# versions: | ||
# - all | ||
# - 25 | ||
# - name: SomePlatform | ||
# versions: | ||
# - all | ||
# - 1.0 | ||
# - 7 | ||
# - 99.99 | ||
|
||
galaxy_tags: [] | ||
# List tags for your role here, one per line. A tag is a keyword that describes | ||
# and categorizes the role. Users find roles by searching for tags. Be sure to | ||
# remove the '[]' above, if you add tags to this list. | ||
# | ||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters. | ||
# Maximum 20 tags per role. | ||
|
||
dependencies: [] | ||
# List your role dependencies here, one per line. Be sure to remove the '[]' above, | ||
# if you add dependencies to this list. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
- name: Install required packages | ||
become: true | ||
dnf: | ||
name: "{{ item }}" | ||
state: present | ||
loop: | ||
- dnf-plugins-core | ||
|
||
- name: Set up Docker repository | ||
become: true | ||
command: "dnf config-manager --add-repo=https://download.docker.com/linux/fedora/docker-ce.repo" | ||
|
||
- name: Install Docker | ||
become: true | ||
dnf: | ||
name: "{{ item }}" | ||
state: present | ||
loop: | ||
- docker-ce | ||
- docker-ce-cli | ||
- containerd.io | ||
|
||
- name: Start and enable Docker service | ||
become: true | ||
service: | ||
name: docker | ||
state: started | ||
enabled: yes | ||
|
||
- name: Add user to the docker group | ||
become: true | ||
user: | ||
name: "fedora" | ||
groups: docker | ||
append: yes | ||
|
||
# run command newgrp docker | ||
- name: Run command newgrp docker | ||
command: "newgrp docker" | ||
|
||
# restart docker service | ||
- name: Restart docker service | ||
become: true | ||
service: | ||
name: docker | ||
state: restarted | ||
|
||
- meta: reset_connection |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
- name: Download Apache Maven | ||
get_url: | ||
url: "https://dlcdn.apache.org/maven/maven-3/3.9.4/binaries/apache-maven-3.9.4-bin.tar.gz" | ||
dest: "/home/fedora/apache-maven-3.9.4-bin.tar.gz" | ||
|
||
- name: Extract Maven archive | ||
ansible.builtin.unarchive: | ||
src: "/home/fedora/apache-maven-3.9.4-bin.tar.gz" | ||
dest: "/home/fedora/" | ||
remote_src: true | ||
|
||
- name: Set Maven environment variables | ||
ansible.builtin.lineinfile: | ||
path: "/home/fedora/.bashrc" | ||
line: "export MAVEN_HOME=/home/fedora/apache-maven-3.9.4; export PATH=$MAVEN_HOME/bin:$PATH" | ||
regexp: "^export MAVEN_HOME=/home/fedora/apache-maven-3.9.4; export PATH=\\$MAVEN_HOME/bin:\\$PATH$" | ||
become_user: fedora | ||
|
||
- name: Load Maven environment variables for the current session | ||
ansible.builtin.shell: source /home/fedora/.bashrc | ||
args: | ||
executable: /bin/bash | ||
environment: | ||
PATH: "{{ ansible_env.PATH }}" | ||
|
||
# register this output to a variable | ||
- name: Check Maven version | ||
command: "mvn -v" | ||
args: | ||
chdir: "/home/fedora/" | ||
become_user: fedora | ||
register: mvn_output | ||
|
||
# print the mvn version | ||
- name: Display Maven version | ||
debug: | ||
var: mvn_output.stdout_lines | ||
when: mvn_output.rc == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to get through the process, but by linking out to instructions in other readme files, etc. it was hard to discern where I should stop following the instructions in those and come back to this.
As a for instance, it points to https://github.com/migtools/playpen/tree/main/ec2#readme where I guess I was to run these:
But then I shouldn't run
./setup_nodes.sh
?But it did appear necessary to download
jboss-eap-7.4.0.zip
later in the instructions.I think it would be easier to follow if this is just a bullet or numbered list with the exact steps required to run deploy the environment.