Skip to content

Commit cd8fd50

Browse files
committed
wip: build jar with env + nginx rewrite adress in install
1 parent 695f33a commit cd8fd50

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

deploy/Jenkinsfile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,20 @@ podTemplate(label: 'build-pod-sourcerer-app',
1212
]
1313
) {
1414
node('build-pod-sourcerer-app') {
15+
def namespace = 'staging'
16+
def env = 'development'
17+
if (env.BRANCH_NAME == 'master') {
18+
env = 'production'
19+
namespace = 'production'
20+
}
21+
1522
stage('checkout') {
1623
checkout scm
1724
}
1825

1926
stage('build jar and test') {
2027
container('gradle') {
21-
sh("./do.sh build_jar_inside")
28+
sh("ENV=${env} ./do.sh build_jar_inside")
2229
}
2330
}
2431

@@ -33,10 +40,6 @@ podTemplate(label: 'build-pod-sourcerer-app',
3340
}
3441

3542
stage('deploy') {
36-
def namespace = 'staging'
37-
if (env.BRANCH_NAME == 'master') {
38-
namespace = 'production'
39-
}
4043
println "Deploying to ${namespace} kubernetes namespace"
4144
sh("NAMESPACE=${namespace} ./do.sh deploy")
4245
}

deploy/default.conf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1+
geo $dollar {
2+
default "$";
3+
}
4+
15
server {
26
listen 80 default_server;
37
server_name _;
48

9+
location /install {
10+
alias /files/install;
11+
12+
sub_filter "${dollar}SERVER_EXT" 'https://$host';
13+
sub_filter_types *;
14+
}
15+
516
location / {
617
root /files/;
718
}

do.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ ARGUMENTS=${@}
2323

2424
TAG="${CONTAINER_TAG:-latest}"
2525
NAMESPACE="${NAMESPACE:-staging}"
26+
ENV="${ENV:-development}"
2627
VOLUME="${BUILD_VOLUME:-$PWD}"
2728
PROJECT=sourcerer-app
2829
PORT=3182
@@ -35,11 +36,12 @@ GRADLE_VERSION=4.2.0
3536

3637
# run only inside build container
3738
build_jar_inside() {
38-
gradle build
39+
gradle build -Penv $ENV
3940
}
4041

4142
build_jar() {
42-
docker run -i -v $VOLUME:/home/gradle/app --workdir=/home/gradle/app gradle:$GRADLE_VERSION \
43+
docker run -i -v $VOLUME:/home/gradle/app --workdir=/home/gradle/app -e ENV=$ENV \
44+
gradle:$GRADLE_VERSION \
4345
./do.sh build_jar_inside
4446
}
4547

src/install/install

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
echo "Installing sourcerer app.."
55

6-
SERVER=https://sourcerer.io
6+
SERVER=$SERVER_EXT
77
DOWNLOAD_URL=$SERVER/app/download
88
JAR_DIR=/usr/local/lib
99
SCRIPT_DIR=/usr/local/bin

0 commit comments

Comments
 (0)