Verified Commit 3fecc2b5 authored by Dmytro Bogatov's avatar Dmytro Bogatov 💕

Add kubernetes configs.

parent d3e7fe3f
Pipeline #1425 failed with stages
in 9 minutes and 58 seconds
......@@ -10,3 +10,7 @@ insert_final_newline = true
[*.yml]
indent_style = space
indent_size = 2
[*.yaml]
indent_style = space
indent_size = 2
......@@ -62,3 +62,6 @@ test/appsettings.*
*lock.json
docker-compose-*.yml
deployment/services/
deployment/config.yaml
......@@ -148,3 +148,14 @@ release-debian:
- debian/build/*
tags:
- docker
release-deployment:
stage: release
image: dbogatov/docker-images:alpine-extras-latest
script:
- ./build.sh -f build-deployment
artifacts:
paths:
- deployment/config.yaml
tags:
- docker
......@@ -6,7 +6,7 @@ info:
Collects, processes and provides various data regarding the status of
the services.
version: "1.0.0"
host: status.makerchip.com
host: status.dbogatov.org
securityDefinitions:
apiauth:
type: apiKey
......
......@@ -290,6 +290,25 @@ build-for-compose () {
build-docker-images
}
## Deployment
build-deployment () {
cd $CWD/deployment
echo "Building deploy configs..."
if [ -z "$DOTNET_TAG" ]; then
DOTNET_TAG="local"
fi
./build-services.sh $DOTNET_TAG
mv services/namespace.yaml config.yaml
cat services/**/*.yaml >> config.yaml
}
## DEBIAN PACKAGE
build-debian-package () {
......
#!/usr/bin/env bash
set -e
shopt -s globstar
SERVICES=("ping" "nginx" "docs" "daemons" "web" "database")
if [ $# -eq 0 ]
then
TAG="master"
else
TAG=$1
fi
# "49-move-to-kubernetes-deployment"
rm -rf services/
mkdir -p services
cp sources/namespace.yaml services/
for service in ${SERVICES[@]}
do
echo "Generating $service configs..."
mkdir -p services/$service
cp sources/service/{service,deployment}.yaml services/$service
if [ "$service" != "database" ]
then
IMAGE="dbogatov/status-site:$service-$TAG"
PORT="80"
else
IMAGE="postgres:9.6.3-alpine"
PORT="5432"
fi
sed -i '' -e "s#__NAME__#$service#g" services/$service/{service,deployment}.yaml
sed -i '' -e "s#__IMAGE__#$IMAGE#g" services/$service/{service,deployment}.yaml
sed -i '' -e "s#__PORT__#$PORT#g" services/$service/{service,deployment}.yaml
done
echo "Done!"
---
apiVersion: v1
kind: Namespace
metadata:
name: status-site
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: __NAME__
namespace: status-site
labels:
application: __NAME__
spec:
replicas: 1
selector:
matchLabels:
application: __NAME__
template:
metadata:
labels:
application: __NAME__
spec:
containers:
- name: __NAME__
image: __IMAGE__
imagePullPolicy: Always
volumeMounts:
- name: appsettings
mountPath: "/run/secrets/"
# readOnly: true
env:
- name: POSTGRES_DB
value: "statussite"
- name: POSTGRES_USER
value: "statususer"
- name: POSTGRES_PASSWORD
value: "relyOn1InternalSwarmNetwork"
- name: ASPNETCORE_ENVIRONMENT
value: "Production"
volumes:
- name: appsettings
secret:
secretName: appsettings.production.yml
---
apiVersion: v1
kind: Service
metadata:
name: __NAME__
namespace: status-site
labels:
application: __NAME__
spec:
selector:
application: __NAME__
ports:
- port: __PORT__
targetPort: __PORT__
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment