Browse Source

+ci

Co-authored-by: david <[email protected]>
Reviewed-on: https://git.poyner.page/david/drcl/pulls/1
Co-authored-by: david <[email protected]>
Co-committed-by: david <[email protected]>
pull/3/head
david 2 years ago
parent
commit
8fd078fbeb
  1. 47
      .drone.yml
  2. 3
      .gitignore
  3. 2
      Dockerfile
  4. 2
      README.md
  5. 8
      swarm/deploy.bash
  6. 28
      swarm/docker-compose.storybook.yml
  7. 2
      swarm/logs.bash
  8. 2
      swarm/remove.bash
  9. 3
      swarm/restart.bash
  10. 2
      swarm/status.bash

47
.drone.yml

@ -0,0 +1,47 @@
---
kind: pipeline
name: default
steps:
- name: build static files for storybook
image: node:16.13.1-alpine3.14
commands:
- 'yarn install'
- 'yarn build-storybook'
- name: build storybook image
image: plugins/docker
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: daveplsno/storybook
tags:
- latest
- '${DRONE_COMMIT_SHA:0:8}'
- name: deploy storybook to swarm
image: docker:dind
environment:
DEPLOY_ENV:
from_secret: DEPLOY_ENV
volumes:
- name: dockersock
path: /var/run/docker.sock
commands:
- export $DEPLOY_ENV
- export imageTag='${DRONE_COMMIT_SHA:0:8}'
- docker stack deploy -c ./swarm/docker-compose.storybook.yml storybook
- docker service update --force --update-parallelism 1 --update-delay 30s storybook_app
volumes:
- name: dockersock
host:
path: /var/run/docker.sock
trigger:
branch:
- master
event:
- push

3
.gitignore vendored

@ -2,4 +2,5 @@ node_modules/
lib/
rubbish/
yarn-error.log
storybook-static/
storybook-static/
swarm/.env.deploy

2
Dockerfile

@ -0,0 +1,2 @@
FROM nginx:alpine
COPY ./storybook-static /usr/share/nginx/html

2
README.md

@ -1,3 +1,5 @@
[![Build Status](https://drone.poyner.page/api/badges/david/drcl/status.svg)](https://drone.poyner.page/david/drcl)
# drcl
yoinked from:

8
swarm/deploy.bash

@ -0,0 +1,8 @@
# export vars
export $(cat .env.deploy)
# deploy to swarm
docker stack deploy -c ./docker-compose.storybook.yml --prune storybook
# unset the env vars
unset $(cat .env.deploy | cut -f 1 -d '=' $1)

28
swarm/docker-compose.storybook.yml

@ -0,0 +1,28 @@
---
version: '3.8'
networks:
swarmnet-public:
external: true
services:
app:
image: daveplsno/storybook:${imageTag? Variable not set}
hostname: storybook
networks:
- swarmnet-public
deploy:
restart_policy:
condition: on-failure
placement:
constraints:
- node.labels.${storybookNode? Variable not set} == true
labels:
- traefik.enable=true
- traefik.docker.network=swarmnet-public
- traefik.constraint-label=swarmnet-public
- traefik.http.routers.${storybookTraefikGrp? Variable not set}.rule=Host(`${storybookTraefikUrl? Variable not set}`)
- traefik.http.routers.${storybookTraefikGrp? Variable not set}.entrypoints=websecure
- traefik.http.routers.${storybookTraefikGrp? Variable not set}.tls=true
- traefik.http.routers.${storybookTraefikGrp? Variable not set}.tls.certresolver=le
- traefik.http.services.${storybookTraefikGrp? Variable not set}.loadbalancer.server.port=80

2
swarm/logs.bash

@ -0,0 +1,2 @@
#!/bin/bash
docker service logs storybook_app -f

2
swarm/remove.bash

@ -0,0 +1,2 @@
#!/bin/bash
docker service rm storybook_app

3
swarm/restart.bash

@ -0,0 +1,3 @@
#!/bin/bash
docker service scale storybook_app=0
docker service scale storybook_app=1

2
swarm/status.bash

@ -0,0 +1,2 @@
#!/bin/bash
docker stack services storybook
Loading…
Cancel
Save