Commit fcc0b08c550e5292d2cafbf4a0404c9e890e037a

Authored by Paul Brodner
1 parent 308a4ed5b8
Exists in master

added dockerfiles

... ... @@ -0,0 +1,13 @@
  1 +FROM java:8
  2 +
  3 +# Install maven
  4 +RUN apt-get update
  5 +RUN apt-get install -y maven
  6 +
  7 +WORKDIR /code
  8 +
  9 +ADD . /code
  10 +EXPOSE 8080
  11 +
  12 +CMD ["mvn", "exec:java"]
  13 +
... ...
docker-compose.yml
... ... @@ -0,0 +1,18 @@
  1 +mongodata:
  2 + image: mongo:3.0.4
  3 + volumes:
  4 + - /data/db
  5 + command: --break-mongo
  6 +mongo:
  7 + image: mongo:3.0.4
  8 + volumes_from:
  9 + - mongodata
  10 + ports:
  11 + - "27017:27017"
  12 + command: --smallfiles
  13 +web:
  14 + build: .
  15 + ports:
  16 + - "8080:8080"
  17 + links:
  18 + - mongo
... ...
... ... @@ -13,7 +13,7 @@
13 13 <properties>
14 14 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15 15 <jdk.version>1.8</jdk.version>
16   - <tas.utility.version>1.0.5-SNAPSHOT</tas.utility.version>
  16 + <tas.utility.version>1.0.9-SNAPSHOT</tas.utility.version>
17 17  
18 18 <spark.version>2.3</spark.version>
19 19 <spark.freemarker-template.version>2.3</spark.freemarker-template.version>
... ...
src/main/java/org/alfresco/tasenvironment/models/Environment.java
1 1 package org.alfresco.tasenvironment.models;
2 2  
3 3 import org.alfresco.utility.network.ServerHealth;
  4 +import org.alfresco.utility.network.TenantConsole;
4 5 import org.springframework.data.annotation.Id;
5 6 import org.springframework.data.annotation.PersistenceConstructor;
6 7 import org.springframework.data.mongodb.core.mapping.Document;
... ... @@ -11,6 +12,10 @@ import org.springframework.data.mongodb.core.mapping.Document;
11 12 @Document(collection = "environments")
12 13 public class Environment
13 14 {
  15 + ServerHealth serverHealth = new ServerHealth();
  16 + private TenantConsole tenantConsole = new TenantConsole();
  17 +
  18 +
14 19 @Id
15 20 private String id;
16 21  
... ... @@ -87,7 +92,6 @@ public class Environment
87 92 boolean isOnline = false;
88 93 try
89 94 {
90   - ServerHealth serverHealth = new ServerHealth();
91 95 isOnline = serverHealth.isServerReachable(getIp(), Integer.valueOf(getPort()));
92 96 }
93 97 catch (Exception e)
... ... @@ -110,4 +114,20 @@ public class Environment
110 114 {
111 115 return "<span class=\"label label-danger\"> Offline</span>";
112 116 }
  117 +
  118 + public String getTenant()
  119 + {
  120 + try
  121 + {
  122 + if (tenantConsole.tenantExist("http", getIp(), Integer.valueOf(getPort()), "admin", "admin"))
  123 + return "<span class=\"label label-danger\"> Yes</span>";
  124 + else
  125 + return "<span class=\"label label-success\">No</span>";
  126 + }
  127 + catch (Exception e)
  128 + {
  129 + return "<span class=\"label label-success\">No</span>";
  130 + }
  131 +
  132 + }
113 133 }
114 134 \ No newline at end of file
... ...
src/main/resources/spark/template/freemarker/environment/index.ftl
... ... @@ -6,6 +6,7 @@
6 6 <th>IP</th>
7 7 <th>Alfresco Path</th>
8 8 <th>Status</th>
  9 + <th>With Tenant</th>
9 10 <th></th>
10 11 </tr>
11 12 </thead>
... ... @@ -16,12 +17,11 @@
16 17 <td>${env.getIp()}</td>
17 18 <td><a href="${env.getAlfrescoPath()}" target="_blank">${env.getAlfrescoPath()}</a></td>
18 19 <td align="center">${env.getStatus()}</td>
19   - <td>
20   -
21   - <form method="DELETE" action="/environment/delete/${env.getId()}">
22   - <button type="submit" class="btn btn-small">Delete</button>
23   - </form>
24   -
  20 + <td align="center">${env.getTenant()}</td>
  21 + <td>
  22 + <form method="DELETE" action="/environment/delete/${env.getId()}">
  23 + <button type="submit" class="btn btn-small">Delete</button>
  24 + </form>
25 25 </td>
26 26 </tr>
27 27 </#list>
... ...
src/main/resources/spark/template/freemarker/layout.ftl
... ... @@ -20,15 +20,7 @@
20 20 <a class="navbar-brand" href="/">TAS Environments</a>
21 21 </div>
22 22  
23   - <!-- Collect the nav links, forms, and other content for toggling -->
24   - <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
25   - <form class="navbar-form navbar-left" role="search">
26   - <div class="form-group">
27   - <input type="text" class="form-control" placeholder="Filter">
28   - </div>
29   - <button type="submit" class="btn btn-default">Go</button>
30   - </form>
31   - </div><!-- /.navbar-collapse -->
  23 +
32 24 </div><!-- /.container-fluid -->
33 25 </nav>
34 26  
... ...