Skip to content

Commit

Permalink
Fix CF template for bfmgr
Browse files Browse the repository at this point in the history
  • Loading branch information
80degreeswest committed Jun 5, 2020
1 parent 81a5ce0 commit d209f37
Show file tree
Hide file tree
Showing 8 changed files with 273 additions and 12 deletions.
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ Build and run from source
Download and run a binary release

```
rel=<REL NUMBER>
rel=<RELEASE_NUMBER>
wget https://github.com/80degreeswest/bfmgr/releases/download/$rel/bfmgr-$rel.jar
java -jar target/bfmgr-$rel.jar
```

Go to http://localhost:8080 and click Create
Go to http://localhost and click Create

#### Deploying in AWS

Expand All @@ -38,6 +38,17 @@ Run below CloudFormation template in your AWS account
https://github.com/80degreeswest/bfmgr/blob/master/src/main/resources/bfmgr-aws.json
```

Go to http://<INSTANCE_IP>:8080 and click Create
Enter desired Subnet ID and Security Group and click Create
You should have a working Buildfarm cluster setup in under 5 minutes
Alternatively, manually launch an EC2 instance with the IAM Role with specified policies and run the following

```
yum install java -y
rel=<RELEASE_NUMBER>
wget -N https://github.com/80degreeswest/bfmgr/releases/download/$rel/bfmgr-$rel.jar
mkdir /var/log/bfmgr && chmod 0777 /var/log/bfmgr
java -jar bfmgr-$rel.jar &
disown
```

Go to http://<INSTANCE_IP> and click Create</br>
Enter desired Subnet ID and Security Group and click Create<br/>
You should have a working Buildfarm cluster setup in under 5 minutes<br/>
43 changes: 43 additions & 0 deletions output-resources/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Buildfarm Manager

This repository hosts the [Buildfarm](https://github.com/bazelbuild/bazel-buildfarm) deployment and administration application.

### Quick Start

#### Local Testing

Make sure Docker is running

Create log directory

```
sudo mkdir /var/log/bfmgr && sudo chmod 0777 /var/log/bfmgr
```

Build and run from source

```
./mvnw clean package && java -jar target/bfmgr-<REL NUMBER>.jar
```

Download and run a binary release

```
rel=${version}
wget https://github.com/80degreeswest/bfmgr/releases/download/$rel/bfmgr-$rel.jar
java -jar target/bfmgr-$rel.jar
```

Go to http://localhost and click Create

#### Deploying in AWS

Run below CloudFormation template in your AWS account

```
https://github.com/80degreeswest/bfmgr/blob/master/src/main/resources/bfmgr-aws.json
```

Go to http://<INSTANCE_IP> and click Create
Enter desired Subnet ID and Security Group and click Create
You should have a working Buildfarm cluster setup in under 5 minutes
163 changes: 163 additions & 0 deletions output-resources/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.8.BUILD-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.eightydegreeswest</groupId>
<artifactId>bfmgr</artifactId>
<version>1.0.1</version>
<name>bfmgr</name>
<description>Buildfarm Manager</description>

<properties>
<java.version>10</java.version>
<spring-cloud.version>Hoxton.SR4</spring-cloud.version>
<aws.version>1.11.791</aws.version>
</properties>

<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<version>${aws.version}</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-autoscaling</artifactId>
<version>${aws.version}</version>
</dependency>

<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-cloudformation</artifactId>
<version>${aws.version}</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-elasticloadbalancingv2</artifactId>
<version>${aws.version}</version>
</dependency>

<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-ec2</artifactId>
<version>${aws.version}</version>
</dependency>
<dependency>
<groupId>com.github.docker-java</groupId>
<artifactId>docker-java</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>io.github.lognet</groupId>
<artifactId>grpc-spring-boot-starter</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<outputDirectory>output-resources</outputDirectory>
<resources>
<resource>
<directory>.</directory>
<includes>
<include>*.json</include>
<include>*.xml</include>
<include>README.md</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

</project>
8 changes: 7 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.eightydegreeswest</groupId>
<artifactId>bfmgr</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<name>bfmgr</name>
<description>Buildfarm Manager</description>

Expand Down Expand Up @@ -103,6 +103,12 @@
</dependencyManagement>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
server.port=80

container.name.server=buildfarm-server
container.name.worker=buildfarm-worker
container.name.redis=buildfarm-redis
Expand Down
30 changes: 28 additions & 2 deletions src/main/resources/aws.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,20 @@
},
"TagSpecifications" : [
{
"ResourceType" : "launch-template",
"ResourceType" : "instance",
"Tags" : [
{
"Key" : {
"Ref": "RequiredTagName"
},
"Value" : {
"Ref": "ClusterName"
}
}
]
},
{
"ResourceType" : "volume",
"Tags" : [
{
"Key" : {
Expand Down Expand Up @@ -226,7 +239,20 @@
},
"TagSpecifications" : [
{
"ResourceType" : "launch-template",
"ResourceType" : "instance",
"Tags" : [
{
"Key" : {
"Ref": "RequiredTagName"
},
"Value" : {
"Ref": "ClusterName"
}
}
]
},
{
"ResourceType" : "volume",
"Tags" : [
{
"Key" : {
Expand Down
14 changes: 11 additions & 3 deletions src/main/resources/bfmgr-aws.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
"Type": "String",
"Default": "Asset",
"Description": "Enter required asset tag name"
},
"ReleaseNumber": {
"Type": "String",
"Description": "Enter bfmgr release number"
}
},
"Resources": {
Expand Down Expand Up @@ -73,7 +77,10 @@
"Properties" : {
"Path" : "/",
"Roles" : ["buildfarm-manager"]
}
},
"DependsOn": [
"BfMgrRole"
]
},
"BfMgrEc2": {
"Type": "AWS::EC2::Instance",
Expand Down Expand Up @@ -112,7 +119,7 @@
[
"#!/bin/bash\n\n",
"yum install java -y\n",
"rel=1.0.0",
"rel=", { "Ref": "ReleaseNumber" }, "\n",
"wget -N https://github.com/80degreeswest/bfmgr/releases/download/$rel/bfmgr-$rel.jar\n",
"mkdir /var/log/bfmgr && chmod 0777 /var/log/bfmgr\n",
"java -jar bfmgr-$rel.jar &\n",
Expand All @@ -123,7 +130,8 @@
}
},
"DependsOn": [
"BfMgrRole"
"BfMgrRole",
"BfMgrInstanceProfile"
]
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/templates/error.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ <h1 class="display-4">Error Occurred!</h1>
<div class="card-deck mb-3 text-center">
<p class="mb-4"></p>
<p>
<span th:text="${status}">status</span>] <span th:text="${error}">error</span>
[<span th:text="${status}">status</span>] <span th:text="${error}">error</span>
</p>
<p th:text="${message}">message</p>
<p th:text="${exception}">exception</p>
<p th:text="${trace}">trace</p>
</div>

<footer class="pt-4 my-md-5 pt-md-5 border-top">
Expand Down

0 comments on commit d209f37

Please sign in to comment.