Skip to content

Commit

Permalink
Merge pull request #17 from SteeltoeOSS/hosting
Browse files Browse the repository at this point in the history
Move to Actions + App Service
  • Loading branch information
TimHess authored Feb 7, 2024
2 parents 8c033b6 + 729c25c commit 8e2c8b3
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 201 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build and deploy JAR

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Java version
uses: actions/setup-java@v4
with:
java-version: '17'

- name: Build with Gradle
run: gradlew --no-daemon build

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: java-app
path: '${{ github.workspace }}/target/*.jar'

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: java-app

- name: Log into Azure CLI with service principal
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: 'initializr-config'
slot-name: 'production'
package: '*.jar'
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM bellsoft/liberica-openjdk-alpine:11 as build
FROM bellsoft/liberica-openjdk-alpine:17 as build
WORKDIR /scratch
COPY . .
RUN ./gradlew --no-daemon build

FROM bellsoft/liberica-openjdk-alpine:11
FROM bellsoft/liberica-openjdk-alpine:17
WORKDIR /srv
COPY --from=build /scratch/build/libs/Steeltoe.InitializrConfigServer-*.jar Steeltoe.InitializrConfigServer.jar
EXPOSE 8888
Expand Down
45 changes: 11 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,85 +2,62 @@

A [Spring Cloud Config Server](https://cloud.spring.io/spring-cloud-config/multi/multi__spring_cloud_config_server.html) for [Steeltoe InitializrApi](https://github.com/SteeltoeOSS/InitializrApi)

[![Build Status](https://dev.azure.com/SteeltoeOSS/Steeltoe/_apis/build/status/Initializr/SteeltoeOSS.InitializrConfigServer?branchName=main)](https://dev.azure.com/SteeltoeOSS/Steeltoe/_build/latest?definitionId=33&branchName=main)

## Build

```sh
$ ./gradlew bootJar
./gradlew bootJar
```

## Docker
```sh
$ docker build -t initializr-config-server .
```

## Kubernetes
```sh
# default manifest
$ ytt -f kubernetes

# sample custom manifest, see kubernetes/defaults.yaml for available parameters
$ ytt -f kubernetes -v args=debug
docker build -t initializr-config-server .
```

## Run

### Using Application Jar

```sh
$ java -jar build/libs/InitializrConfigServer-*.jar <args>
java -jar build/libs/Steeltoe.InitializrConfigServer-*.jar <args>
```

### Using Gradle

```sh
$ ./gradlew bootRun -Pargs=<args>
./gradlew bootRun -Pargs=<args>
```

### Using Docker

```sh
$ docker -it --rm -p 8888:8888 initializr-config-server <args>
```

## Deploy

### Kubernetes

```sh
$ kubectl apply -f deploy/manifest/local.yaml
```


### Cloud Foundry

```sh
$ cf push -f deploy/cloud-foundry/manifest.yaml
docker run -it --rm -p 8888:8888 initializr-config-server <args>
```

## Options

### Logging

```
```text
logging.level.io.steeltoe={error,warn,info,debug,trace}
```

### Git Backend
```

```text
spring.cloud.config.server.git.uri=<url>
```

### Local Backend
```

```text
spring.profiles.active=native
spring.cloud.config.server.native.searchLocations=file://<path>
```

## Sample URL paths

```
```text
# development profile
/SteeltoeInitializr/Development
Expand Down
14 changes: 8 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
plugins {
id 'org.springframework.boot' version '2.5.2'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'org.springframework.boot' version '3.2.2'
id 'io.spring.dependency-management' version '1.1.4'
id 'java'
id 'com.gorylenko.gradle-git-properties' version '2.3.1'
id 'com.gorylenko.gradle-git-properties' version '2.4.1'
}

group = steeltoeInitializrConfigServerGroup
version = steeltoeInitializrConfigServerVersion
sourceCompatibility = '11'

java {
sourceCompatibility = '17'
}

repositories {
mavenCentral()
}

ext {
set('springCloudVersion', "2020.0.3")
set('springCloudVersion', "2023.0.0")
}

dependencies {
Expand All @@ -39,4 +42,3 @@ springBoot {
jar {
enabled = false
}

4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
11 changes: 0 additions & 11 deletions kubernetes/defaults.yaml

This file was deleted.

39 changes: 0 additions & 39 deletions kubernetes/initializr-config-server.yaml

This file was deleted.

77 changes: 0 additions & 77 deletions setversion.sh

This file was deleted.

2 changes: 0 additions & 2 deletions tool.properties

This file was deleted.

29 changes: 0 additions & 29 deletions yttw.sh

This file was deleted.

0 comments on commit 8e2c8b3

Please sign in to comment.