Skip to content

Commit

Permalink
initial commit with apps from course repo
Browse files Browse the repository at this point in the history
  • Loading branch information
richardallred committed May 23, 2019
0 parents commit 497620c
Show file tree
Hide file tree
Showing 244 changed files with 6,997 additions and 0 deletions.
19 changes: 19 additions & 0 deletions apache-httpd/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM registry.access.redhat.com/rhel7:7.6

RUN rpm --rebuilddb && \
yum install -y httpd \
&& yum clean all

ADD index.html /var/www/html

RUN sed -i 's/Listen 80/Listen 8080/' /etc/httpd/conf/httpd.conf \
&& chgrp -R 0 /var/log/httpd /var/run/httpd \
&& chmod -R g=u /var/log/httpd /var/run/httpd

EXPOSE 8080

USER 1001

ENTRYPOINT ["httpd"]
CMD ["-D", "FOREGROUND"]

5 changes: 5 additions & 0 deletions apache-httpd/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<html>
<body>
<h1>Hello, World!</h1>
</body>
</html>
54 changes: 54 additions & 0 deletions apache-httpd/training.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[rhel-7-dvd]
baseurl = http://content.example.com/rhel7.6/x86_64/dvd
enabled = true
gpgcheck = false
name = Remote classroom copy of RHEL DVD

[rhel-server-rhscl-7-rpms]
baseurl = http://content.example.com/ocp4.0/x86_64/rhelrhscl
enabled = true
gpgcheck = false
name = Remote classroom copy of RHSCL

[rhel-7-server-datapath-rpms]
baseurl = http://content.example.com/ocp4.0/x86_64/rheladditional/rhel-7-fast-datapath-rpms
enabled = true
gpgcheck = false
name = Remote classroom copy of RHEL 7.6 Datapath Packages

[rhel-7-server-ansible-26]
baseurl = http://content.example.com/ocp4.0/x86_64/rheladditional/rhel-7-server-ansible-2.6-rpms
enabled = true
gpgcheck = false
name = Remote classroom copy of RHEL 7.6 Ansible Packages

[rhel-7-server-extras-rpms]
baseurl = http://content.example.com/ocp4.0/x86_64/rheladditional/rhel-7-server-extras-rpms
enabled = true
gpgcheck = false
name = Remote classroom copy of RHEL 7.6 Extra Packages

[rhel-7-server-common-rpms]
baseurl = http://content.example.com/ocp4.0/x86_64/rheladditional/rhel-7-server-rh-common-rpms
enabled = true
gpgcheck = false
name = Remote classroom copy of RHEL 7.6 Common Packages

[rhel-7-server-supplementary]
baseurl = http://content.example.com/ocp4.0/x86_64/rhelsupplementary
enabled = true
gpgcheck = false
name = Remote classroom copy of RHEL 7.6 Supplementary Packages

[rhel-7-server-optional-rpms]
baseurl = http://content.example.com/ocp4.0/x86_64/rhelopt
enabled = true
gpgcheck = false
name = Remote classroom copy of RHEL 7.6 Optional Packages

[rhel-7-server-updates]
baseurl = http://content.example.com/ocp4.0/x86_64/rhelupdates
enabled = true
gpgcheck = false
name = Remote classroom copy of RHEL 7.6 Updates

32 changes: 32 additions & 0 deletions app-config/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
var express = require('express');
var fs = require('fs')
app = express();

// read in the APP_MSG env var
var msg = process.env.APP_MSG;

var response;

app.get('/', function (req, res) {

response = 'Value in the APP_MSG env var is => ' + msg + '\n';

// Read in the secret file
fs.readFile('/opt/app-root/secure/myapp.sec', 'utf8', function (secerr,secdata) {
if (secerr) {
console.log(secerr + '\n');
response += secerr + '\n';
}
else {
response += 'The secret is => ' + secdata + '\n';
}

//send the response to the client
res.send(response);
});

});

app.listen(8080, function () {
console.log('Server listening on port 8080...');
});
3 changes: 3 additions & 0 deletions app-config/myapp.sec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
username=user1
password=pass1
salt=xyz123
14 changes: 14 additions & 0 deletions app-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "node-configmap",
"version": "1.0.0",
"description": "A simple Node.js app to demonstrate config maps and secrets",
"main": "app.js",
"scripts": {
"start": "node app.js"
},
"author": "Red Hat Training",
"license": "ASL",
"dependencies": {
"express": "4.14.x"
}
}
11 changes: 11 additions & 0 deletions build-app/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var express = require('express');
app = express();

app.get('/', function (req, res) {
res.send('Simple app for the Building Applications Lab!\n');
});

app.listen(8080, function () {
console.log('Simple app for the Building Applications Lab!');
});

14 changes: 14 additions & 0 deletions build-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "nodejs-helloworld",
"version": "1.0.0",
"description": "Hello World!",
"main": "app.js",
"scripts": {
"start": "node app.js"
},
"author": "Red Hat Training",
"license": "ASL",
"dependencies": {
"express": "4.14.x"
}
}
27 changes: 27 additions & 0 deletions builds-for-managers/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM registry.centos.org/centos/centos:centos7

MAINTAINER Red Hat Training <[email protected]>

# command line options to pass to the JVM
ENV JAVA_OPTIONS -Xmx512m

# Install the Java runtime, create a user for running the app, and set permissions
RUN rpm --rebuilddb && \
yum install -y --noplugins java-1.8.0-openjdk-headless && \
yum clean all --noplugins -y && \
mkdir -p /opt/app-root/bin

# Copy the runnable fat JAR to the container.
ADD app-src/target/builds-for-managers-swarm.jar /opt/app-root/bin/builds-for-managers.jar

COPY run-app.sh /opt/app-root/bin/

RUN chgrp -R 0 /opt/app-root && \
chmod -R g=u /opt/app-root

EXPOSE 8080

USER 1001

# Run the fat JAR
CMD /opt/app-root/bin/run-app.sh
49 changes: 49 additions & 0 deletions builds-for-managers/app-src/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
23 changes: 23 additions & 0 deletions builds-for-managers/app-src/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>builds-for-managers</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=false
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
84 changes: 84 additions & 0 deletions builds-for-managers/app-src/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.redhat.training.example</groupId>
<artifactId>builds-for-managers</artifactId>
<name>WildFly Swarm Example</name>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>

<properties>
<version.wildfly.swarm>2017.10.0</version.wildfly.swarm>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<failOnMissingWebXml>false</failOnMissingWebXml>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>bom-all</artifactId>
<version>${version.wildfly.swarm}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<finalName>builds-for-managers</finalName>
<plugins>
<plugin>
<groupId>org.wildfly.swarm</groupId>
<artifactId>wildfly-swarm-plugin</artifactId>
<version>${version.wildfly.swarm}</version>
<configuration>
<mainClass>com.redhat.training.example.buildsformanagers.configuration.Main</mainClass>
</configuration>

<executions>
<execution>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>

<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>jpa</artifactId>
</dependency>

<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>jaxrs</artifactId>
</dependency>

<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>ejb</artifactId>
</dependency>

<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>datasources</artifactId>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.187</version>
<scope>compile</scope>
</dependency>

</dependencies>

</project>
Loading

0 comments on commit 497620c

Please sign in to comment.