linchpin 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/linchpin/cli.rb +35 -0
- data/lib/linchpin/dockerfiles/dotnet-Dockerfile.erb +2 -1
- data/lib/linchpin/k8s/dotnet/app.yml.erb +48 -0
- data/lib/linchpin/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbc3ad118ca919232c253dc092b5cd298d01ffcb3c5a3215e964be223d5561fe
|
4
|
+
data.tar.gz: '070292c5fad2c6b4ca6de45fe19e4f6c70c74e0252d2b53d5a957f431bf779b2'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da6bf4ae8441acdb81c53cc71c1806706deed825375d25a57c7118d706f72886093b847139efb8e2053c1f561cb61cba81c87955846e050033bfd651caa778d8
|
7
|
+
data.tar.gz: fd08bdd3f2b42e14c773f69c84a3226543e707a9e566411553ef5acf128e96e14e4b04c8f0c21ee27d3deaf70d5f3c5ef6f829e8004bca98e4aeff50aa8f6108
|
data/lib/linchpin/cli.rb
CHANGED
@@ -3,6 +3,8 @@ require 'linchpin/templater'
|
|
3
3
|
require 'shellwords'
|
4
4
|
require 'find'
|
5
5
|
require 'tempfile'
|
6
|
+
require 'tmpdir'
|
7
|
+
require 'fileutils'
|
6
8
|
|
7
9
|
class LinchpinCLI < Thor
|
8
10
|
desc "build", "attempt to auto-discover application type and build it."
|
@@ -26,12 +28,45 @@ class LinchpinCLI < Thor
|
|
26
28
|
command_output = system({}, "bash -c #{escaped_command}")
|
27
29
|
exit(1) unless command_output
|
28
30
|
end
|
31
|
+
|
32
|
+
|
33
|
+
desc "deploy", "deploy the application"
|
34
|
+
def deploy
|
35
|
+
app_name = discover_appname
|
36
|
+
short_app_name = discover_short_appname
|
37
|
+
app_type = discover_type(Dir.pwd)
|
38
|
+
version = get_version_hash
|
39
|
+
|
40
|
+
temp_dir = Dir.mktmpdir
|
41
|
+
command_output = false
|
42
|
+
begin
|
43
|
+
deploy_templates = Dir[File.join(File.join(File.join(File.dirname(File.expand_path(__FILE__)), 'k8s'), app_type),"*.erb")]
|
44
|
+
deploy_templates.each do |filename|
|
45
|
+
"LOL #{filename}"
|
46
|
+
FileUtils.cp(filename, "#{temp_dir}")
|
47
|
+
end
|
48
|
+
FileUtils.cp(File.join(File.join(File.join(Dir.pwd, 'buildscripts'), "deploy"), "secrets.ejson"), "#{temp_dir}")
|
49
|
+
|
50
|
+
escaped_command = Shellwords.escape("KUBECONFIG=~/.kube/config REVISION=#{version} kubernetes-deploy #{short_app_name} cicd-example --template-dir=#{temp_dir} --bindings=full_name=#{app_name},app_name=#{short_app_name}")
|
51
|
+
command_output = system({}, "bash -c #{escaped_command}")
|
52
|
+
|
53
|
+
ensure
|
54
|
+
# remove the directory.
|
55
|
+
FileUtils.remove_entry temp_dir
|
56
|
+
end
|
57
|
+
|
58
|
+
exit(1) unless command_output
|
59
|
+
end
|
29
60
|
private
|
30
61
|
|
31
62
|
def discover_type(root_dir)
|
32
63
|
'dotnet' if Dir["#{root_dir}/*.sln"].any?
|
33
64
|
end
|
34
65
|
|
66
|
+
def discover_short_appname
|
67
|
+
`git config --get remote.origin.url`.split('/').last.gsub!('.git', '').gsub!('sdlc-example-app-', '').strip
|
68
|
+
end
|
69
|
+
|
35
70
|
def discover_appname
|
36
71
|
`git config --get remote.origin.url`.split('/').last.gsub!('.git', '').strip
|
37
72
|
end
|
@@ -21,6 +21,7 @@ FROM build AS publish
|
|
21
21
|
RUN dotnet publish --no-restore -c Release -o bin/deploy
|
22
22
|
|
23
23
|
FROM base AS final
|
24
|
+
RUN curl -s https://raw.githubusercontent.com/envkey/envkey-source/master/install.sh | bash
|
24
25
|
WORKDIR /app
|
25
26
|
COPY --from=publish /src/Catalog.API/bin/deploy .
|
26
27
|
RUN mkdir -p /opt/appdynamics/dotnet
|
@@ -30,4 +31,4 @@ ADD appd/AppDynamics.Agent.netstandard.dll /opt/appdynamics/dotnet/
|
|
30
31
|
ENV CORECLR_PROFILER={57e1aa68-2229-41aa-9931-a6e93bbc64d8} \
|
31
32
|
CORECLR_ENABLE_PROFILING=1 \
|
32
33
|
CORECLR_PROFILER_PATH=/opt/appdynamics/dotnet/libappdprofiler.so
|
33
|
-
|
34
|
+
CMD eval $(envkey-source) && dotnet <%= @entry_dll %>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
apiVersion: v1
|
2
|
+
kind: Service
|
3
|
+
metadata:
|
4
|
+
name: <%= app_name %>
|
5
|
+
spec:
|
6
|
+
ports:
|
7
|
+
- port: 80
|
8
|
+
targetPort: 80
|
9
|
+
selector:
|
10
|
+
app: <%= app_name %>
|
11
|
+
---
|
12
|
+
apiVersion: apps/v1
|
13
|
+
kind: Deployment
|
14
|
+
metadata:
|
15
|
+
name: <%= app_name %>
|
16
|
+
spec:
|
17
|
+
selector:
|
18
|
+
matchLabels:
|
19
|
+
app: <%= app_name %>
|
20
|
+
replicas: 2
|
21
|
+
template:
|
22
|
+
metadata:
|
23
|
+
labels:
|
24
|
+
app: <%= app_name %>
|
25
|
+
spec:
|
26
|
+
containers:
|
27
|
+
- name: catalog
|
28
|
+
image: dataconstruct/<%= full_name %>:<%= current_sha %>
|
29
|
+
ports:
|
30
|
+
- containerPort: 80
|
31
|
+
readinessProbe:
|
32
|
+
httpGet:
|
33
|
+
path: /hc
|
34
|
+
port: 80
|
35
|
+
initialDelaySeconds: 10
|
36
|
+
timeoutSeconds: 5
|
37
|
+
livenessProbe:
|
38
|
+
httpGet:
|
39
|
+
path: /hc
|
40
|
+
port: 80
|
41
|
+
initialDelaySeconds: 60
|
42
|
+
timeoutSeconds: 5
|
43
|
+
env:
|
44
|
+
- name: ENVKEY
|
45
|
+
valueFrom:
|
46
|
+
secretKeyRef:
|
47
|
+
name: envkey-token
|
48
|
+
key: ENVKEY
|
data/lib/linchpin/version.rb
CHANGED