Merge pull request 'develop' (#11) from develop into master

Reviewed-on: #11
This commit is contained in:
giles 2020-08-27 16:06:21 +00:00
commit 338b9fc23a
18 changed files with 1844 additions and 0 deletions

1
.drone/build.sh Normal file
View File

@ -0,0 +1 @@
echo 'nothing to build'

4
.drone/deploy.sh Normal file
View File

@ -0,0 +1,4 @@
docker stack rm chat
echo 'sleeping...zzz'
sleep 60
docker stack deploy -c docker-compose.yml chat

17
.drone/drone-home.jsonnet Normal file
View File

@ -0,0 +1,17 @@
local secretSecrets = import 'lib/secret-secrets.libsonnet';
local publicSecrets = import 'lib/public-secrets.libsonnet';
local deploy = import 'node_modules/@sigyl/jsonnet-drone/deploy.libsonnet';
[
deploy(
'chat',
'/stack/',
[
'LOCAL_DOCKER_REGISTRY',
'REGISTRY_PASSWORD',
],
publicSecrets,
secretSecrets
),
]

160
.drone/drone-home.yml Normal file
View File

@ -0,0 +1,160 @@
---
kind: pipeline
type: docker
name: deploy
platform:
os: linux
arch: amd64
steps:
- name: print env
image: appleboy/drone-ssh:1.6.2
settings:
envs:
- drone_tag
- drone_commit
- drone_build_number
- drone_repo_name
- drone_repo_namespace
- local_docker_registry
- registry_password
- git_domain
- chat_admin_name
- chat_admin_email
- chat_admin_password
host:
from_secret: ssh-host
key:
from_secret: ssh-key
port:
from_secret: ssh-port
script:
- rm -f env-chat
- "echo \"export LOCAL_DOCKER_REGISTRY='$${LOCAL_DOCKER_REGISTRY}'\" >> env-chat # \"local-docker-registry\""
- "echo \"export REGISTRY_PASSWORD='$${REGISTRY_PASSWORD}'\" >> env-chat # \"registry-password\""
- "echo \"export GIT_DOMAIN='$${GIT_DOMAIN}'\" >> env-chat # \"git-domain\""
- "echo \"export CHAT_ADMIN_NAME='$${CHAT_ADMIN_NAME}'\" >> env-chat # \"chat-admin-name\""
- "echo \"export CHAT_ADMIN_EMAIL='$${CHAT_ADMIN_EMAIL}'\" >> env-chat # \"chat-admin-email\""
- "echo \"export CHAT_ADMIN_PASSWORD='$${CHAT_ADMIN_PASSWORD}'\" >> env-chat # \"chat-admin-password\""
username:
from_secret: ssh-user
environment:
CHAT_ADMIN_EMAIL:
from_secret: chat-admin-email
CHAT_ADMIN_NAME:
from_secret: chat-admin-name
CHAT_ADMIN_PASSWORD:
from_secret: chat-admin-password
GIT_DOMAIN:
from_secret: git-domain
LOCAL_DOCKER_REGISTRY:
from_secret: local-docker-registry
REGISTRY_PASSWORD:
from_secret: registry-password
- name: scp
image: appleboy/drone-scp:1.6.2
settings:
command_timeout: 2m
host:
from_secret: ssh-host
key:
from_secret: ssh-key
port:
from_secret: ssh-port
source:
- .
target: /stack/chat
username:
from_secret: ssh-user
- name: wait
image: alpine
commands:
- sleep 15
- name: "dockerbuild:"
image: docker:dind
commands:
- set -e
- sh .drone/login.sh
- sh .drone/build.sh
- sh .drone/push.sh
- sh .drone/logout.sh
environment:
LOCAL_DOCKER_REGISTRY:
from_secret: local-docker-registry
REGISTRY_PASSWORD:
from_secret: registry-password
volumes:
- name: dockersock
path: /var/run
- name: deploy
image: appleboy/drone-ssh:1.6.2
settings:
envs:
- drone_tag
- drone_commit
- drone_build_number
- drone_repo_name
- drone_repo_namespace
- git_domain
- chat_admin_name
- chat_admin_email
- chat_admin_password
- local_docker_registry
- registry_password
host:
from_secret: ssh-host
key:
from_secret: ssh-key
port:
from_secret: ssh-port
script:
- export CHAT_ADMIN_PASSWORD=$${CHAT_ADMIN_PASSWORD}
- export GIT_DOMAIN=$${GIT_DOMAIN}
- export CHAT_ADMIN_NAME=$${CHAT_ADMIN_NAME}
- export CHAT_ADMIN_EMAIL=$${CHAT_ADMIN_EMAIL}
- export LOCAL_DOCKER_REGISTRY=$${LOCAL_DOCKER_REGISTRY}
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD}
- set -e
- cd /stack/chat
- sh .drone/login.sh
- sh .drone/pull.sh
- sh .drone/deploy.sh
username:
from_secret: ssh-user
environment:
CHAT_ADMIN_EMAIL:
from_secret: chat-admin-email
CHAT_ADMIN_NAME:
from_secret: chat-admin-name
CHAT_ADMIN_PASSWORD:
from_secret: chat-admin-password
GIT_DOMAIN:
from_secret: git-domain
LOCAL_DOCKER_REGISTRY:
from_secret: local-docker-registry
REGISTRY_PASSWORD:
from_secret: registry-password
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
- name: ca
path: /etc/docker/certs.d
volumes:
- name: dockersock
temp: {}
- name: ca
host:
path: /etc/docker/certs.d
...

View File

@ -0,0 +1,5 @@
[
'git-domain',
'chat-admin-name',
'chat-admin-email',
]

View File

@ -0,0 +1,3 @@
[
'chat-admin-password',
]

1
.drone/login.sh Normal file
View File

@ -0,0 +1 @@
docker login ${LOCAL_DOCKER_REGISTRY} --username client --password "${REGISTRY_PASSWORD}"

1
.drone/logout.sh Normal file
View File

@ -0,0 +1 @@
docker logout ${LOCAL_DOCKER_REGISTRY}

9
.drone/package.json Normal file
View File

@ -0,0 +1,9 @@
{
"private": true,
"scripts": {
"build": "drone jsonnet --source drone-home.jsonnet --target drone-home.yml --stream"
},
"dependencies": {
"@sigyl/jsonnet-drone": "^0.0.7"
}
}

1
.drone/pull.sh Normal file
View File

@ -0,0 +1 @@
echo 'nothing to pull'

1
.drone/push.sh Normal file
View File

@ -0,0 +1 @@
echo 'nothing to push'

21
.drone/yarn.lock Normal file
View File

@ -0,0 +1,21 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@sigyl/jsonnet-compose@^0.0.2":
version "0.0.2"
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-compose/-/jsonnet-compose-0.0.2.tgz#8900a21e8cd8109929b6042703f8645aacb9bcda"
integrity sha512-wWS3CgPeNi/o1pcS6n/4pafxlMD0KC9/RKMZr/ySmzeGNRW++sPuKuxajYse2TNd47uNDdeUSnk4aEeEIKL0zA==
"@sigyl/jsonnet-drone-environment@0.0.5":
version "0.0.5"
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone-environment/-/jsonnet-drone-environment-0.0.5.tgz#9ea85e08904777bd21a3e4b30b0b91461d0285ff"
integrity sha512-xVGmdMO1pOyozAWUbJm6mzKBgsLPJ+1hWnGCK3AxPkr7kkDh18hu30+TLzlcQtqq76s5jUfvJUztezsGj/mIcw==
"@sigyl/jsonnet-drone@^0.0.7":
version "0.0.7"
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-0.0.7.tgz#0f92ef15096b0c5497741ff56bfbd249de9edd66"
integrity sha512-353n/zExNnKPPZ235eLX3/DFXJVNIX8fdAeG3RvY+55538eGzDIk0/3HJd8jXsD6y0zxm+LexW5HghvXBMBOEA==
dependencies:
"@sigyl/jsonnet-compose" "^0.0.2"
"@sigyl/jsonnet-drone-environment" "0.0.5"

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

3
.versionrc Normal file
View File

@ -0,0 +1,3 @@
{
"tagMessageInChangeLog": true
}

11
CHANGELOG.md Normal file
View File

@ -0,0 +1,11 @@
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [0.0.4](https://sigyl.com///compare/v0.0.3...v0.0.4) "chore(release): 0.0.4" (2020-08-19)
### [0.0.3](https://sigyl.com///compare/v0.0.2...v0.0.3) "chore(release): 0.0.3" (2020-08-19)
### [0.0.2](https://sigyl.com///compare/v0.0.1...v0.0.2) "chore(release): 0.0.2" (2020-08-19)
### 0.0.1 "chore(release): 0.0.1" (2020-08-19)

3
git-hooks/pre-commit Executable file
View File

@ -0,0 +1,3 @@
drone jsonnet --source .drone/drone-home.jsonnet --target .drone/drone-home.yml --stream \
&& git add .drone/drone-home.yml \
&& echo "jsonnet built"

21
package.json Normal file
View File

@ -0,0 +1,21 @@
{
"private": true,
"name": "chat",
"version": "0.0.4",
"description": "rocket chat",
"scripts": {
"deploy": "sh deploy.sh",
"build": "sh build.sh",
"release": "standard-version",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://sigyl.com/git/stack/chat"
},
"author": "Giles Bradshaw",
"license": "ISC",
"devDependencies": {
"standard-version": "git+https://github.com/gilesbradshaw/standard-version.git"
}
}

1581
yarn.lock Normal file

File diff suppressed because it is too large Load Diff