attempt kubernetes deployment
continuous-integration/drone/push Build was killed Details

This commit is contained in:
Cadey Ratio 2020-07-09 16:41:47 -04:00
parent 14b02a0f80
commit ea319e25ff
4 changed files with 62 additions and 4 deletions

47
.drone.yml Normal file
View File

@ -0,0 +1,47 @@
kind: pipeline
name: docker
steps:
- name: build docker image
image: "monacoremo/nix:2020-04-05-05f09348-circleci"
environment:
USER: root
commands:
- nix-build
- cp $(readlink result) /result/docker.tgz
volumes:
- name: image
path: /result
- name: push docker image
image: docker:dind
volumes:
- name: image
path: /result
- name: dockersock
path: /var/run/docker.sock
commands:
- docker load -i /result/docker.tgz
- docker tag xena/printerfacts:latest xena/printerfacts:$DRONE_COMMIT_SHA
- echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
- docker push xena/printerfacts:$DRONE_COMMIT_SHA
environment:
DOCKER_USERNAME: xena
DOCKER_PASSWORD:
from_secret: DOCKER_PASSWORD
- name: kubenetes release
image: "monacoremo/nix:2020-04-05-05f09348-circleci"
environment:
USER: root
DIGITALOCEAN_ACCESS_TOKEN:
from_secret: DIGITALOCEAN_ACCESS_TOKEN
commands:
- ./scripts/release.sh
volumes:
- name: image
temp: {}
- name: dockersock
host:
path: /var/run/docker.sock

5
nix/dhall.nix Normal file
View File

@ -0,0 +1,5 @@
let
sources = import ./sources.nix;
pkgs = import sources.nixpkgs { };
dhall = import sources.easy-dhall-nix { inherit pkgs; };
in dhall.dhall-yaml-simple

View File

@ -1,16 +1,16 @@
let kms = let kms =
https://xena.greedo.xeserv.us/pkg/dhall/kubermemes/k8s/package.dhall sha256:e47e95aba6a08f8ca3e38fbabc436566d6558a05a9b4ac149e8e712c8583b8f0 https://xena.greedo.xeserv.us/pkg/dhall/kubermemes/k8s/package.dhall sha256:e47e95aba6a08f8ca3e38fbabc436566d6558a05a9b4ac149e8e712c8583b8f0
let tag = env:GITHUB_SHA as Text ? "latest" let tag = env:DRONE_COMMIT_SHA as Text ? "latest"
let image = "xena/printerfacts-warp:${tag}" let image = "xena/printerfacts:${tag}"
in kms.app.make in kms.app.make
kms.app.Config::{ kms.app.Config::{
, name = "printerfacts-warp" , name = "printerfacts"
, appPort = 5000 , appPort = 5000
, image , image
, replicas = 2 , replicas = 2
, domain = "printerfacts-warp.cetacean.club" , domain = "printerfacts.cetacean.club"
, leIssuer = "prod" , leIssuer = "prod"
} }

6
scripts/release.sh Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env nix-shell
#! nix-shell -p doctl -p kubectl
nix-env -i -f ./nix/dhall.nix
doctl kubernetes cluster kubeconfig save kubermemes
dhall-to-yaml-ng < ./printerfacts.dhall | kubectl apply -n apps -f -
kubectl rollout status -n apps deployment/printerfacts