Skip to content

Commit

Permalink
Merge pull request #5 from emberstack/develop
Browse files Browse the repository at this point in the history
Fix startup issues and refactoring pipelines
  • Loading branch information
winromulus authored Jan 12, 2020
2 parents b7edc01 + 9e45656 commit c368221
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 63 deletions.
4 changes: 2 additions & 2 deletions ES.SFTP.Host/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
RUN apt-get update && \
# - Install required packages
#
Expand All @@ -21,7 +21,7 @@ RUN apt-get update && \
WORKDIR /app
EXPOSE 22 80

FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /src
COPY ["ES.SFTP.Host/ES.SFTP.Host.csproj", "ES.SFTP.Host/"]
RUN dotnet restore "ES.SFTP.Host/ES.SFTP.Host.csproj"
Expand Down
4 changes: 3 additions & 1 deletion ES.SFTP.Host/ES.SFTP.Host.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
</ItemGroup>

<ItemGroup>
<Content Include="config\sssd.conf" />
<Content Include="config\sssd.conf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Below are deployment methods for:
- Docker CLI
- Docker-Compose
- Kubernetes using Helm (recommended for Kubernetes)
- Kubernetes (manual)

Process:
1) Create server configuration
Expand Down Expand Up @@ -147,13 +146,6 @@ You can customize the values of the helm deployment by using the following Value
> Find us on [Helm Hub](https://hub.helm.sh/charts/emberstack)

### Deployment to Kubernetes using kubectl
Each release (found on the [Releases](https://github.com/EmberStack/docker-sftp/releases) GitHub page) contains the manual deployment file (`sftp.yaml`).

```shellsession
$ kubectl apply -f https://github.com/EmberStack/docker-sftp/releases/latest/download/sftp.yaml
```

## Advanced Configuration

TODO: This section is under development due to the number of configuration options being added. Please open an issue on the [emberstack/docker-sftp](https://github.com/emberstack/docker-sftp) project if you need help.
Expand Down
155 changes: 104 additions & 51 deletions azure-pipelines.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: $(coreVersion).$(Date:yy)$(DayOfYear).$(Rev:r)
name: $(version).$(Rev:r)

variables:
coreVersion: 1
version: 1.1
buildConfiguration: "Release"
imageRepository: "emberstack/sftp"
DOCKER_CLI_EXPERIMENTAL: 'enabled'
Expand All @@ -12,69 +12,129 @@ trigger:
- "*"

stages:

- stage: build
displayName: "Build"
jobs:
- job: build
displayName: "Build Job"

- job: build_helm
displayName: "Helm"
pool:
vmImage: "Ubuntu-16.04"
steps:

- script: |
mkdir -p artifacts/helm
mkdir -p artifacts/kubectl
workingDirectory: '$(Build.ArtifactStagingDirectory)'
displayName: 'Create Artifacts directories'
- task: HelmInstaller@1
displayName: 'Install Helm'
inputs:
helmVersionToInstall: 2.14.1

- script: 'helm lint'
workingDirectory: deploy/helm/sftp
displayName: 'helm lint'

- task: HelmDeploy@0
displayName: 'helm package'
inputs:
connectionType: None
command: package
chartPath: deploy/helm/sftp
chartVersion: '$(Build.BuildNumber)'
destination: '$(Build.ArtifactStagingDirectory)/artifacts/helm'
helmVersionToInstall: 'latest'

- script: 'helm template --name sftp sftp > $(Build.ArtifactStagingDirectory)/artifacts/kubectl/sftp-$(Build.BuildNumber).yaml'
workingDirectory: deploy/helm
displayName: 'helm template'
- script: |
helm package --destination $(Build.ArtifactStagingDirectory)/artifacts/helm --version $(Build.BuildNumber) --app-version $(Build.BuildNumber) deploy/helm/sftp
displayName: 'Helm Package'
- publish: '$(Build.ArtifactStagingDirectory)/artifacts/helm'
artifact: 'helm'
displayName: 'Publish helm artifact'

- publish: '$(Build.ArtifactStagingDirectory)/artifacts/kubectl'
artifact: 'kubectl'
displayName: 'Publish kubectl artifact'


- job: build_docker_arm32
displayName: "Docker arm32"
pool:
name: winromulus
demands:
- Agent.OSArchitecture -equals ARM
steps:

- script: |
apt-get update
apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io
displayName: 'Install docker'
- task: Docker@2
displayName: 'Build arm32 image'
inputs:
containerRegistry: 'Emberstack Docker Hub'
repository: $(imageRepository)
Dockerfile: ES.SFTP.Host/Dockerfile
command: build
buildContext: .
tags: 'build-$(Build.BuildNumber)-arm32'

- task: Docker@2
displayName: "Push image"
inputs:
containerRegistry: "Emberstack Docker Hub"
repository: $(imageRepository)
command: push
tags: |
build-$(Build.BuildNumber)-arm32
- job: build_docker_amd64
displayName: "Docker amd64"
pool:
vmImage: "Ubuntu-16.04"
steps:

- task: DockerInstaller@0
displayName: 'Install docker'
inputs:
dockerVersion: '19.03.5'

- task: Docker@2
displayName: "Build amd64 image"
displayName: 'Build amd64 image'
inputs:
containerRegistry: "Emberstack Docker Hub"
containerRegistry: 'Emberstack Docker Hub'
repository: $(imageRepository)
Dockerfile: ES.SFTP.Host/Dockerfile
command: build
buildContext: .
tags: "build-$(Build.BuildNumber)-amd64"
tags: 'build-$(Build.BuildNumber)-amd64'

- task: Docker@2
displayName: "Push images"
displayName: "Push image"
inputs:
containerRegistry: "Emberstack Docker Hub"
repository: $(imageRepository)
command: push
tags: |
build-$(Build.BuildNumber)-amd64
- job: build_docker_multiarch
displayName: "Docker multiarch"
pool:
vmImage: "Ubuntu-16.04"
dependsOn:
- build_docker_amd64
steps:

- task: DockerInstaller@0
displayName: 'Install docker'
inputs:
dockerVersion: '19.03.5'

- task: Docker@2
displayName: "Docker Hub Login"
inputs:
containerRegistry: "Emberstack Docker Hub"
command: login

- task: Docker@2
displayName: "Docker Hub Login"
Expand All @@ -83,12 +143,14 @@ stages:
command: login

- script: |
docker manifest create $(imageRepository):build-$(Build.BuildNumber) $(imageRepository):build-$(Build.BuildNumber)-amd64
docker manifest create $(imageRepository):build-$(Build.BuildNumber) $(imageRepository):build-$(Build.BuildNumber)-amd64 $(imageRepository):build-$(Build.BuildNumber)-arm32
docker manifest inspect $(imageRepository):build-$(Build.BuildNumber)
docker manifest push $(imageRepository):build-$(Build.BuildNumber)
displayName: "Create and push multi-arch manifest"
- stage: release
displayName: "Release"
dependsOn: 'build'
Expand All @@ -101,31 +163,28 @@ stages:
variables:
- group: "OpenSource.GitHub"
steps:
- checkout: none

- download: current
artifact: 'helm'
- checkout: none

- download: current
artifact: 'kubectl'
artifact: 'helm'

- task: Docker@2
displayName: "Docker Login"
inputs:
containerRegistry: "Emberstack Docker Hub"
command: login

- task: HelmInstaller@0
displayName: 'Install Helm'
- task: HelmInstaller@1
inputs:
helmVersion: 2.13.1
kubectlVersion: 1.10.11
helmVersionToInstall: 'latest'

- script: |
docker pull $(imageRepository):build-$(Build.BuildNumber)-amd64
docker manifest create $(imageRepository):release-$(Build.BuildNumber) $(imageRepository):build-$(Build.BuildNumber)-amd64
docker manifest push $(imageRepository):release-$(Build.BuildNumber)
docker manifest create $(imageRepository):latest $(imageRepository):build-$(Build.BuildNumber)-amd64
docker pull $(imageRepository):build-$(Build.BuildNumber)-arm32
docker manifest create $(imageRepository):$(Build.BuildNumber) $(imageRepository):build-$(Build.BuildNumber)-amd64 $(imageRepository):build-$(Build.BuildNumber)-arm32
docker manifest create $(imageRepository):latest $(imageRepository):build-$(Build.BuildNumber)-amd64 $(imageRepository):build-$(Build.BuildNumber)-arm32
docker manifest push $(imageRepository):$(Build.BuildNumber)
docker manifest push $(imageRepository):latest
displayName: 'docker pull, tag and push'
Expand All @@ -144,12 +203,7 @@ stages:
git status
git commit -m "Added sftp-$(Build.BuildNumber).tgz"
git push
displayName: 'Add chart to GitHub repository'
- script: |
mkdir -p github
cp $(Pipeline.Workspace)/kubectl/sftp-$(Build.BuildNumber).yaml github/sftp.yaml
displayName: 'Prepare GitHub Artifacts'
displayName: 'Add chart to GitHub repository'
- task: GitHubRelease@1
displayName: 'GitHub release (create)'
Expand All @@ -161,5 +215,4 @@ stages:
title: 'Release v$(Build.BuildNumber)'
releaseNotesSource: inline
releaseNotes: 'The release process is automated.'
assets: '$(System.DefaultWorkingDirectory)/github/*.*'

4 changes: 4 additions & 0 deletions deploy/helm/sftp/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ spec:
{{- end }}
containers:
- name: {{ .Chart.Name }}
{{- if .Values.image.tag }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
{{- else }}
image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
{{- end }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: ssh
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/sftp/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ metadata:
{{- end }}
spec:
{{- if ne .Values.service.type "NodePort" }}
{{- if .Values.service.clusterIP }}
clusterIP: "{{ .Values.service.clusterIP }}"
{{- end }}
{{- end }}
{{- if .Values.service.externalIPs }}
externalIPs:
{{ toYaml .Values.service.externalIPs | indent 4 }}
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/sftp/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ replicaCount: 1

image:
repository: emberstack/sftp
tag: latest
tag: ""
pullPolicy: Always

imagePullSecrets: []
Expand Down

0 comments on commit c368221

Please sign in to comment.