-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#227 build basic backend deb package #228
Changes from all commits
1aaed7a
a17bd83
72a660a
7426a89
bed47c4
f1076df
d040302
fb6a28f
975e62a
84afdc3
46078bc
a0a025a
1bb0d64
706780b
89e03c8
4d0abec
04c6e6b
4a53654
0608384
543b97c
8c5c777
abc4a3c
eb1ffbd
bb8166a
a0cdf94
c0396f7
3c936c8
f2cdbe7
d855554
78d8b7c
f8cc06e
80ef3e9
e5bae80
f2e8fa4
c7e7be6
132e2ec
dc61d69
2db5bfd
6f4e366
460cceb
c055d39
bf00c12
a6810fa
a693479
5b0917a
8ee65cd
0ae5a92
18b0258
9caf839
2a697c9
a599f1f
c028d42
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
version: 2.1 | ||
orbs: | ||
gradle: circleci/[email protected] | ||
workflows: | ||
default: | ||
jobs: | ||
- be-build | ||
- ad-build | ||
- be-pack: | ||
requires: | ||
- be-build | ||
- ad-pack: | ||
requires: | ||
- ad-build | ||
- meta-pack | ||
- deploy: | ||
requires: | ||
- be-pack | ||
- ad-pack | ||
- meta-pack | ||
filters: | ||
branches: | ||
only: | ||
- main | ||
|
||
jobs: | ||
be-build: | ||
environment: | ||
# Configure the JVM and Gradle to avoid OOM errors | ||
_JAVA_OPTIONS: "-Xmx3g" | ||
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.workers.max=2" | ||
docker: | ||
- image: circleci/openjdk:11.0.3-jdk-stretch | ||
working_directory: ~/project/backend | ||
steps: | ||
- checkout: | ||
path: ~/project | ||
- restore_cache: | ||
key: v2-gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }} | ||
- restore_cache: | ||
key: v2-gradle-cache-{{ checksum "build.gradle.kts" }} | ||
- run: ./gradlew build | ||
- save_cache: | ||
paths: | ||
- .gradle/wrapper | ||
key: v2-gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }} | ||
- save_cache: | ||
paths: | ||
- .gradle/caches | ||
key: v2-gradle-cache-{{ checksum "build.gradle.kts" }} | ||
- store_artifacts: | ||
path: build/libs | ||
- persist_to_workspace: | ||
root: ~/project | ||
paths: | ||
- backend/build/distributions/* | ||
|
||
ad-build: | ||
docker: | ||
- image: cimg/node:15.8.0 | ||
working_directory: ~/project/administration | ||
steps: | ||
- checkout: | ||
path: ~/project | ||
- restore_cache: | ||
keys: | ||
- v1-node-modules-{{ checksum "package.json" }}-{{checksum "package-lock.json" }} | ||
- run: | ||
name: Install node dependencies | ||
command: "[ ! -d node_modules ] && npm ci --loglevel warn --yes || echo package.json and package-lock.json unchanged. Using cache." | ||
- run: npm run-script build | ||
- save_cache: | ||
paths: | ||
- node_modules | ||
key: v1-node-modules-{{ checksum "package.json" }}-{{checksum "package-lock.json" }} | ||
- store_artifacts: | ||
path: build | ||
- persist_to_workspace: | ||
root: ~/project | ||
paths: | ||
- administration/build | ||
|
||
be-pack: | ||
docker: | ||
- image: cimg/base:2020.01 | ||
working_directory: ~/project/backend | ||
steps: | ||
- checkout: | ||
path: ~/project | ||
- attach_workspace: | ||
at: /tmp/workspace | ||
- run: ../scripts/pack_deb.sh -v 0.1 -t /tmp/workspace/backend/build/distributions/*.tar -s ../scripts/eak-backend.service -d "Backend server for the Ehrenamtskarte app" -n "eak-backend" -c "default-jre" | ||
- run: | | ||
mkdir -p /tmp/artifacts/debs | ||
cp *.deb /tmp/artifacts/debs | ||
- store_artifacts: | ||
path: /tmp/artifacts | ||
- persist_to_workspace: | ||
root: /tmp/artifacts | ||
paths: | ||
- debs/*.deb | ||
|
||
ad-pack: | ||
docker: | ||
- image: cimg/base:2020.01 | ||
working_directory: ~/project/administration | ||
steps: | ||
- checkout: | ||
path: ~/project | ||
- attach_workspace: | ||
at: /tmp/workspace | ||
- run: ../scripts/pack_deb.sh -v 0.1 -f /tmp/workspace/administration/build -d "Administration backend for the Ehrenamtskarte app" -n "eak-administration" | ||
- run: | | ||
mkdir -p /tmp/artifacts/debs | ||
cp *.deb /tmp/artifacts/debs | ||
- store_artifacts: | ||
path: /tmp/artifacts | ||
- persist_to_workspace: | ||
root: /tmp/artifacts | ||
paths: | ||
- debs/*.deb | ||
|
||
meta-pack: | ||
docker: | ||
- image: cimg/base:2020.01 | ||
working_directory: ~/project/administration | ||
steps: | ||
- checkout: | ||
path: ~/project | ||
- run: ../scripts/pack_deb.sh -v 0.1 -d "Meta package for the Ehrenamtskarte app" -n "eak" -c "eak-backend, eak-administration" | ||
- run: | | ||
mkdir -p /tmp/artifacts/debs | ||
cp *.deb /tmp/artifacts/debs | ||
- store_artifacts: | ||
path: /tmp/artifacts | ||
- persist_to_workspace: | ||
root: /tmp/artifacts | ||
paths: | ||
- debs/*.deb | ||
|
||
deploy: | ||
docker: | ||
- image: cimg/base:2020.01 | ||
steps: | ||
- attach_workspace: | ||
at: /tmp/workspace | ||
- add_ssh_keys: | ||
fingerprints: | ||
- "5c:8a:70:dc:61:9d:fa:c2:c2:6d:2d:fc:4a:ab:d2:e3" | ||
- run: | ||
name: "SFTP upload" | ||
command: | | ||
echo $APT_HOST_FINGERPRINT > known_hosts | ||
echo "Uploading: " /tmp/workspace/debs/*.deb | ||
sftp -b - -o UserKnownHostsFile=known_hosts [email protected]:/local-apt-repository/ \<<< "put -r /tmp/workspace/debs/*.deb" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,39 @@ | ||
# Nginx config for routing within the docker network (development) | ||
|
||
upstream martin { | ||
server martin:3000; | ||
server martin:3000; # Host within docker network | ||
} | ||
|
||
server { | ||
listen 80; | ||
listen 80 default_server; | ||
server_name localhost; | ||
|
||
location ~ /tiles/(?<fwd_path>.*) { | ||
root /usr/share/nginx/html; | ||
|
||
location = /map.html { | ||
} | ||
|
||
location = /style.json { | ||
add_header 'Access-Control-Allow-Origin' '*'; | ||
|
||
sub_filter_once off; | ||
sub_filter_types application/json; | ||
sub_filter "https://tiles.staging.ehrenamtskarte.app" "http://localhost:5002"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is that right for development? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems right. It gets replaced with localhost like before. |
||
|
||
try_files $uri /style.json; | ||
} | ||
|
||
location ^~ /sprites { | ||
add_header 'Access-Control-Allow-Origin' '*'; | ||
|
||
try_files $uri $uri; | ||
} | ||
|
||
location ~ /(?<fwd_path>.*) { | ||
proxy_set_header X-Rewrite-URL $request_uri; | ||
proxy_set_header X-Forwarded-Host $host; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
proxy_pass http://martin/$fwd_path$is_args$args; | ||
} | ||
|
||
location / { | ||
add_header 'Access-Control-Allow-Origin' '*'; | ||
sub_filter_once off; | ||
sub_filter_types application/json; | ||
sub_filter "https://vector.ehrenamtskarte.app" "http://localhost:5002"; | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't we have some problems with that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is equivalent to the previous way. I no longer concat the url in java but pass the whole one here.