Browse Source

attempt kubernetes deployment

master
Cadey Ratio 1 year ago
parent
commit
ea319e25ff
  1. 47
      .drone.yml
  2. 5
      nix/dhall.nix
  3. 8
      printerfacts.dhall
  4. 6
      scripts/release.sh

47
.drone.yml

@ -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

@ -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

8
printerfacts.dhall

@ -1,16 +1,16 @@
let kms =
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
kms.app.Config::{
, name = "printerfacts-warp"
, name = "printerfacts"
, appPort = 5000
, image
, replicas = 2
, domain = "printerfacts-warp.cetacean.club"
, domain = "printerfacts.cetacean.club"
, leIssuer = "prod"
}

6
scripts/release.sh

@ -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
Loading…
Cancel
Save