-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
optimize async op add deployment-template for k8s optimize rest-api build add Dockerfile for local-distribution
- Loading branch information
Showing
18 changed files
with
225 additions
and
58 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package me.ahoo.govern.core.util; | ||
|
||
import me.ahoo.govern.core.GovernException; | ||
|
||
import java.time.Duration; | ||
import java.util.concurrent.ExecutionException; | ||
import java.util.concurrent.Future; | ||
import java.util.concurrent.TimeUnit; | ||
import java.util.concurrent.TimeoutException; | ||
|
||
import static java.lang.Thread.currentThread; | ||
|
||
/** | ||
* @author ahoo wang | ||
*/ | ||
public final class Futures { | ||
private Futures() { | ||
} | ||
|
||
public static <T> T getUnChecked(Future<T> future, Duration timeout) { | ||
try { | ||
return future.get(timeout.toNanos(), TimeUnit.NANOSECONDS); | ||
} catch (InterruptedException e) { | ||
currentThread().interrupt(); | ||
throw new GovernException(e); | ||
} catch (TimeoutException e) { | ||
throw new GovernException(e); | ||
} catch (ExecutionException e) { | ||
throw new GovernException(e); | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: govern-service-rest-api | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: govern-service-rest-api | ||
template: | ||
metadata: | ||
labels: | ||
app: govern-service-rest-api | ||
spec: | ||
containers: | ||
- env: | ||
- name: GOVERN_MODE | ||
value: cluster | ||
- name: GOVERN_REDIS_URI | ||
value: redis://redis-url:6379 | ||
image: ahoowang/govern-service:0.9.11 | ||
name: govern-service | ||
resources: | ||
limits: | ||
cpu: "1" | ||
memory: 640Mi | ||
requests: | ||
cpu: 250m | ||
memory: 512Mi | ||
volumeMounts: | ||
- mountPath: /etc/localtime | ||
name: volume-localtime | ||
volumes: | ||
- hostPath: | ||
path: /etc/localtime | ||
type: "" | ||
name: volume-localtime |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# docker buildx build --push --platform linux/arm/v7 --build-arg GOVERN_VERSION=0.9.12 --build-arg JDK_VERSION=armv7l-centos-jdk-11.0.11_9-slim -t ahoowang/govern-service:0.9.12-armv7 . | ||
# docker buildx build --push --platform linux/amd64,linux/arm64 --build-arg GOVERN_VERSION=0.9.12 --build-arg JDK_VERSION=jdk11u-centos-nightly-slim -t ahoowang/govern-service:0.9.12 . | ||
|
||
ARG JDK_VERSION=jdk11u-centos-nightly | ||
ARG GOVERN_VERSION=0.9.12 | ||
ARG GOVERN_SERVICE_HOME=/govern-service | ||
FROM adoptopenjdk/openjdk11:${JDK_VERSION} AS base | ||
|
||
ARG GOVERN_VERSION | ||
RUN echo "Building Govern-Service ${GOVERN_VERSION}" | ||
|
||
FROM curlimages/curl as build | ||
ARG GOVERN_VERSION | ||
ARG GOVERN_SERVICE_HOME | ||
USER root | ||
|
||
WORKDIR ${GOVERN_SERVICE_HOME} | ||
|
||
ENV GOVERN_SERVICE_REST_API_TAR=rest-api-${GOVERN_VERSION}.tar | ||
COPY ${GOVERN_SERVICE_REST_API_TAR} . | ||
RUN tar -xvf ${GOVERN_SERVICE_REST_API_TAR};\ | ||
rm ${GOVERN_SERVICE_REST_API_TAR} | ||
|
||
FROM base as run | ||
ARG GOVERN_VERSION | ||
ARG GOVERN_SERVICE_HOME | ||
|
||
LABEL maintainer="ahoowang@qq.com" | ||
COPY --from=build ${GOVERN_SERVICE_HOME} ${GOVERN_SERVICE_HOME} | ||
|
||
WORKDIR ${GOVERN_SERVICE_HOME}/rest-api-${GOVERN_VERSION} | ||
EXPOSE 8080 | ||
|
||
ENTRYPOINT ["bin/rest-api"] |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.