Last active
July 6, 2021 11:53
-
-
Save jcabrerizo/fd8b3ffcb5298c033b17f42fb4132a77 to your computer and use it in GitHub Desktop.
Training 2021 s1e2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://amp-demo-artifacts.s3.eu-west-1.amazonaws.com/amp.demo-0.1.0-SNAPSHOT.jar | |
| # https://amp-demo-artifacts.s3.eu-west-1.amazonaws.com/amp.training-0.1.0-SNAPSHOT.jar | |
| # https://amp-demo-artifacts.s3.eu-west-1.amazonaws.com/java-web-chat.sql | |
| # https://amp-demo-artifacts.s3.eu-west-1.amazonaws.com/web-chat-1.0.0-SNAPSHOT.war | |
| brooklyn.config: | |
| db.user: db_user | |
| db.password: abcd1234 | |
| db.name: web_chat | |
| services: | |
| - type: mysql-server | |
| id: db | |
| brooklyn.config: | |
| datastore.creation.script.template.url: 'https://amp-demo-artifacts.s3.eu-west-1.amazonaws.com/java-web-chat.sql' | |
| - type: tomcat-node | |
| brooklyn.config: | |
| root.war: 'https://amp-demo-artifacts.s3.eu-west-1.amazonaws.com/web-chat-1.0.0-SNAPSHOT.war' | |
| catalina.properties: | |
| db.user: $brooklyn:config("db.user") | |
| db.password: $brooklyn:config("db.password") | |
| db.connection: | |
| $brooklyn:formatString: | |
| - "jdbc:%s%s" | |
| - $brooklyn:component("db").attributeWhenReady("datastore.url") | |
| - $brooklyn:config("db.name") | |
| #################### | |
| #!/bin/bash | |
| echo "AMP password configurator" | |
| echo -n " User name: " | |
| read USER | |
| echo -n " Password: " | |
| read -s PASSWORD | |
| SALT_LENGTH=4 | |
| SALT=$( LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | head -c${SALT_LENGTH} ) | |
| HASH=$( echo -n "${SALT}${PASSWORD}" | openssl sha256 ) | |
| cat <<EOF | |
| Insert the following config into brooklyn.properties: | |
| brooklyn.webconsole.security.users=${USER} | |
| brooklyn.webconsole.security.user.${USER}.salt=${SALT} | |
| brooklyn.webconsole.security.user.${USER}.sha256=${HASH} | |
| EOF | |
| ################################################# | |
| brooklyn.catalog: | |
| version: 0.1.0-SNAPSHOT | |
| items: | |
| - id: custom-entity | |
| name: Custom Entity | |
| item: | |
| name: Custom Entity | |
| type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess | |
| brooklyn.config: | |
| checkRunning.command: 'true' | |
| shell.env: | |
| filename: $brooklyn:config("filename") | |
| brooklyn.parameters: | |
| - name: filename | |
| default: myFile.txt | |
| brooklyn.initializers: | |
| - type: org.apache.brooklyn.core.sensor.ssh.SshCommandSensor | |
| brooklyn.config: | |
| name: file.contents | |
| period: 5s | |
| command: cat "$filename" | |
| - type: org.apache.brooklyn.core.effector.ssh.SshCommandEffector | |
| brooklyn.config: | |
| name: writeToFile | |
| command: echo "$value" > "$filename" | |
| parameters: | |
| value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://tinyurl.com/t2021s1e1