Skip to content

Commit a62156f

Browse files
Update App pglombardo-passwordpusher on branch main
1 parent 86ac9a5 commit a62156f

File tree

12 files changed

+319
-23
lines changed

12 files changed

+319
-23
lines changed

pglombardo-passwordpusher/.do/deploy.template.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ spec:
55
- name: default
66
image:
77
registry_type: DOCKER_HUB
8-
repository: pglombardo/pwpush
8+
registry: pglombardo
9+
repository: pwpush
910
tag: latest
10-
http_port: 5100
1111
instance_count: 1
1212
instance_size_slug: basic-xxs
1313
run_command: ""
1414
envs: []
15+
http_port: 5100
1516
routes:
1617
- path: /

pglombardo-passwordpusher/aws-cloudformation.cf.yml

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AWSTemplateFormatVersion: 2010-09-09
2-
Description: Deplo.my CFN template translated from Docker compose
2+
Description: Generated from container configuration by docker-to-iac
33
Parameters:
44
VPC:
55
Type: AWS::EC2::VPC::Id
@@ -27,23 +27,14 @@ Resources:
2727
Action: sts:AssumeRole
2828
ManagedPolicyArns:
2929
- arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy
30-
TaskRole:
31-
Type: AWS::IAM::Role
32-
Properties:
33-
RoleName: !Join ['', [!Ref ServiceName, TaskRole]]
34-
AssumeRolePolicyDocument:
35-
Statement:
36-
- Effect: Allow
37-
Principal:
38-
Service: ecs-tasks.amazonaws.com
39-
Action: sts:AssumeRole
4030
LogGroupdefault:
4131
Type: AWS::Logs::LogGroup
4232
Properties:
4333
LogGroupName: !Join ['', [/ecs/, !Ref ServiceName, TaskDefinitiondefault]]
4434
TaskDefinitiondefault:
4535
Type: AWS::ECS::TaskDefinition
46-
DependsOn: LogGroupdefault
36+
DependsOn:
37+
- LogGroupdefault
4738
Properties:
4839
Family: !Join ['', [!Ref ServiceName, TaskDefinitiondefault]]
4940
NetworkMode: awsvpc
@@ -52,12 +43,10 @@ Resources:
5243
Cpu: 512
5344
Memory: 1GB
5445
ExecutionRoleArn: !Ref ExecutionRole
55-
TaskRoleArn: !Ref TaskRole
5646
ContainerDefinitions:
5747
- Name: default
58-
Command:
59-
- ""
6048
Image: docker.io/pglombardo/pwpush:latest
49+
ReadonlyRootFilesystem: false
6150
PortMappings:
6251
- ContainerPort: 5100
6352
Environment: []
@@ -73,10 +62,10 @@ Resources:
7362
GroupDescription: !Join ['', [default, ContainerSecurityGroup]]
7463
VpcId: !Ref VPC
7564
SecurityGroupIngress:
76-
- IpProtocol: tcp
77-
FromPort: 5100
78-
ToPort: 5100
79-
CidrIp: 0.0.0.0/0
65+
IpProtocol: tcp
66+
FromPort: 0
67+
ToPort: 65535
68+
CidrIp: 0.0.0.0/0
8069
Servicedefault:
8170
Type: AWS::ECS::Service
8271
Properties:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker run -d -p 5100:5100 pglombardo/pwpush:latest
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v2
2+
name: pglombardo-passwordpusher
3+
description: A Helm chart for DeployStack application generated from Docker configuration
4+
type: application
5+
version: 0.1.0
6+
appVersion: 1.0.0
7+
maintainers:
8+
- name: DeployStack
9+
email: hello@deploystack.io
10+
dependencies: []
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
Thank you for installing {{ .Chart.Name }}.
3+
4+
Your application has been deployed successfully!
5+
6+
{{- range $key, $service := .Values.services }}
7+
{{- if and $service.enabled $service.service.ports }}
8+
9+
Service {{ $key }}:
10+
{{- if contains "NodePort" $service.service.type }}
11+
Access on: http://NODE_IP:NODE_PORT
12+
Get the NodePort by running: kubectl get svc {{ include "deploystack.fullname" $ }}-{{ $key }}
13+
{{- else if contains "LoadBalancer" $service.service.type }}
14+
Access on: http://EXTERNAL_IP:PORT
15+
Get the LoadBalancer IP by running: kubectl get svc {{ include "deploystack.fullname" $ }}-{{ $key }}
16+
{{- else if contains "ClusterIP" $service.service.type }}
17+
Access within the cluster only
18+
Forward ports by running: kubectl port-forward svc/{{ include "deploystack.fullname" $ }}-{{ $key }} LOCAL_PORT:SERVICE_PORT
19+
{{- end }}
20+
{{- end }}
21+
{{- end }}
22+
23+
For more information on managing your application, see the Helm documentation:
24+
https://helm.sh/docs/
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "deploystack.name" -}}
6+
{{- default .Chart.Name .Values.global.nameOverride | trunc 63 | trimSuffix "-" }}
7+
{{- end }}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
*/}}
12+
{{- define "deploystack.fullname" -}}
13+
{{- if .Values.global.fullnameOverride }}
14+
{{- .Values.global.fullnameOverride | trunc 63 | trimSuffix "-" }}
15+
{{- else }}
16+
{{- $name := default .Chart.Name .Values.global.nameOverride }}
17+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
18+
{{- end }}
19+
{{- end }}
20+
21+
{{/*
22+
Create chart name and version as used by the chart label.
23+
*/}}
24+
{{- define "deploystack.chart" -}}
25+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
26+
{{- end }}
27+
28+
{{/*
29+
Common labels
30+
*/}}
31+
{{- define "deploystack.labels" -}}
32+
helm.sh/chart: {{ include "deploystack.chart" . }}
33+
{{ include "deploystack.selectorLabels" . }}
34+
{{- if .Chart.AppVersion }}
35+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
36+
{{- end }}
37+
app.kubernetes.io/managed-by: {{ .Release.Service }}
38+
{{- end }}
39+
40+
{{/*
41+
Selector labels
42+
*/}}
43+
{{- define "deploystack.selectorLabels" -}}
44+
app.kubernetes.io/name: {{ include "deploystack.name" . }}
45+
app.kubernetes.io/instance: {{ .Release.Name }}
46+
{{- end }}
47+
48+
{{/*
49+
Service reference helper
50+
*/}}
51+
{{- define "deploystack.serviceReference" -}}
52+
{{- if .service }}
53+
{{- if .service.service.ports }}
54+
{{- with index .service.service.ports 0 }}
55+
{{ $.serviceKey }}.{{ $.serviceName }}.svc.cluster.local:{{ .port }}
56+
{{- end }}
57+
{{- else }}
58+
{{ $.serviceKey }}.{{ $.serviceName }}.svc.cluster.local
59+
{{- end }}
60+
{{- else }}
61+
unknown-service-reference
62+
{{- end }}
63+
{{- end }}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
{{- range $key, $service := .Values.services }}
3+
{{- if $service.enabled }}
4+
{{- if $service.environment.regular }}
5+
apiVersion: v1
6+
kind: ConfigMap
7+
metadata:
8+
name: {{ include "deploystack.fullname" $ }}-{{ $key }}-config
9+
labels:
10+
{{- include "deploystack.labels" $ | nindent 4 }}
11+
app.kubernetes.io/component: {{ $key }}
12+
data:
13+
{{- toYaml $service.environment.regular | nindent 2 }}
14+
{{- end }}
15+
16+
{{- if $service.dependencies }}
17+
---
18+
apiVersion: v1
19+
kind: ConfigMap
20+
metadata:
21+
name: {{ include "deploystack.fullname" $ }}-{{ $key }}-dependencies
22+
labels:
23+
{{- include "deploystack.labels" $ | nindent 4 }}
24+
app.kubernetes.io/component: {{ $key }}
25+
data:
26+
{{- range $service.dependencies }}
27+
{{- $serviceName := .service }}
28+
{{- range $envKey, $envValue := .variables }}
29+
{{ $envKey }}: {{ include "deploystack.serviceReference" (dict "service" (index $.Values.services $serviceName) "serviceKey" $serviceName) }}
30+
{{- end }}
31+
{{- end }}
32+
{{- end }}
33+
{{- end }}
34+
{{- end }}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
2+
{{- range $key, $service := .Values.services }}
3+
{{- if $service.enabled }}
4+
apiVersion: apps/v1
5+
kind: Deployment
6+
metadata:
7+
name: {{ include "deploystack.fullname" $ }}-{{ $key }}
8+
labels:
9+
{{- include "deploystack.labels" $ | nindent 4 }}
10+
app.kubernetes.io/component: {{ $key }}
11+
spec:
12+
{{- if not $service.autoscaling.enabled }}
13+
replicas: {{ $service.replicaCount }}
14+
{{- end }}
15+
selector:
16+
matchLabels:
17+
{{- include "deploystack.selectorLabels" $ | nindent 6 }}
18+
app.kubernetes.io/component: {{ $key }}
19+
template:
20+
metadata:
21+
{{- with $.Values.global.podAnnotations }}
22+
annotations:
23+
{{- toYaml . | nindent 8 }}
24+
{{- end }}
25+
labels:
26+
{{- include "deploystack.selectorLabels" $ | nindent 8 }}
27+
app.kubernetes.io/component: {{ $key }}
28+
spec:
29+
{{- with $.Values.global.imagePullSecrets }}
30+
imagePullSecrets:
31+
{{- toYaml . | nindent 8 }}
32+
{{- end }}
33+
securityContext:
34+
{{- toYaml $.Values.global.podSecurityContext | nindent 8 }}
35+
containers:
36+
- name: {{ $key }}
37+
securityContext:
38+
{{- toYaml $.Values.global.securityContext | nindent 12 }}
39+
image: "{{ $service.image.repository }}:{{ $service.image.tag | default "latest" }}"
40+
imagePullPolicy: {{ $service.image.pullPolicy }}
41+
{{- if $service.command }}
42+
command:
43+
{{- toYaml $service.command | nindent 12 }}
44+
{{- end }}
45+
ports:
46+
{{- range $service.service.ports }}
47+
- name: http-{{ .port }}
48+
containerPort: {{ .targetPort }}
49+
protocol: {{ .protocol }}
50+
{{- end }}
51+
{{- if or $service.environment.regular $service.environment.sensitive }}
52+
env:
53+
{{- range $envKey, $envValue := $service.environment.regular }}
54+
- name: {{ $envKey }}
55+
valueFrom:
56+
configMapKeyRef:
57+
name: {{ include "deploystack.fullname" $ }}-{{ $key }}-config
58+
key: {{ $envKey }}
59+
{{- end }}
60+
{{- range $envKey, $envValue := $service.environment.sensitive }}
61+
- name: {{ $envKey }}
62+
valueFrom:
63+
secretKeyRef:
64+
name: {{ include "deploystack.fullname" $ }}-{{ $key }}-secret
65+
key: {{ $envKey }}
66+
{{- end }}
67+
{{- if $service.dependencies }}
68+
{{- range $service.dependencies }}
69+
{{- range $envKey, $envValue := .variables }}
70+
- name: {{ $envKey }}
71+
valueFrom:
72+
configMapKeyRef:
73+
name: {{ include "deploystack.fullname" $ }}-{{ $key }}-dependencies
74+
key: {{ $envKey }}
75+
{{- end }}
76+
{{- end }}
77+
{{- end }}
78+
{{- end }}
79+
{{- with $service.volumes }}
80+
volumeMounts:
81+
{{- toYaml . | nindent 12 }}
82+
{{- end }}
83+
resources:
84+
{{- toYaml $service.resources | nindent 12 }}
85+
{{- with $service.volumes }}
86+
volumes:
87+
{{- range . }}
88+
- name: {{ .name }}
89+
hostPath:
90+
path: {{ .hostPath }}
91+
{{- end }}
92+
{{- end }}
93+
{{- end }}
94+
{{- end }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
{{- range $key, $service := .Values.services }}
3+
{{- if $service.enabled }}
4+
{{- if $service.environment.sensitive }}
5+
apiVersion: v1
6+
kind: Secret
7+
metadata:
8+
name: {{ include "deploystack.fullname" $ }}-{{ $key }}-secret
9+
labels:
10+
{{- include "deploystack.labels" $ | nindent 4 }}
11+
app.kubernetes.io/component: {{ $key }}
12+
type: Opaque
13+
data:
14+
{{- range $envKey, $envValue := $service.environment.sensitive }}
15+
{{ $envKey }}: {{ $envValue | b64enc | quote }}
16+
{{- end }}
17+
{{- end }}
18+
{{- end }}
19+
{{- end }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
{{- range $key, $service := .Values.services }}
3+
{{- if $service.enabled }}
4+
apiVersion: v1
5+
kind: Service
6+
metadata:
7+
name: {{ include "deploystack.fullname" $ }}-{{ $key }}
8+
labels:
9+
{{- include "deploystack.labels" $ | nindent 4 }}
10+
app.kubernetes.io/component: {{ $key }}
11+
spec:
12+
type: {{ $service.service.type }}
13+
ports:
14+
{{- range $service.service.ports }}
15+
- port: {{ .port }}
16+
targetPort: {{ .targetPort }}
17+
protocol: {{ .protocol }}
18+
name: http-{{ .port }}
19+
{{- end }}
20+
selector:
21+
{{- include "deploystack.selectorLabels" $ | nindent 4 }}
22+
app.kubernetes.io/component: {{ $key }}
23+
{{- end }}
24+
{{- end }}

0 commit comments

Comments
 (0)