Compare commits

..

27 Commits

Author SHA1 Message Date
Giles Bradshaw 85224e1f0c chore(release): 0.0.5
continuous-integration/drone/push Build is passing Details
2020-08-28 21:46:13 +01:00
Giles Bradshaw 3292d34704 Squashed commit of the following:
commit 99ed34c5a2
Author: Giles Bradshaw <giles.bradshaw@sigyl.com>
Date:   Fri Aug 28 13:44:28 2020 +0100

    domain

commit 7b495fa217
Author: Giles Bradshaw <giles.bradshaw@sigyl.com>
Date:   Fri Aug 28 13:26:56 2020 +0100

    .

commit 94e7d7fa5b
Author: Giles Bradshaw <giles.bradshaw@sigyl.com>
Date:   Fri Aug 28 13:17:20 2020 +0100

    .

commit 246dff312f
Author: Giles Bradshaw <giles.bradshaw@sigyl.com>
Date:   Thu Aug 27 19:50:21 2020 +0100

    fix: hostname

commit e44ab46af2
Author: Giles Bradshaw <giles.bradshaw@sigyl.com>
Date:   Thu Aug 27 18:45:55 2020 +0100

    fix: image digests

commit f76f87d9b0
Author: Giles Bradshaw <giles.bradshaw@sigyl.com>
Date:   Thu Aug 27 17:45:23 2020 +0100

    fix: remove smallfiles

commit 59963d55dd
Author: Giles Bradshaw <giles.bradshaw@sigyl.com>
Date:   Thu Aug 27 17:18:23 2020 +0100

    ci: promote to production to deploy
2020-08-28 21:45:23 +01:00
giles 7924549e32 Merge pull request 'chore(deps): update dependency @sigyl/jsonnet-drone to ^0.0.8' (#12) from renovate/sigyl-jsonnet-drone-0.x into master
Reviewed-on: #12
2020-08-27 16:08:14 +00:00
Giles Bradshaw 8e86951737 chore(deps): update dependency @sigyl/jsonnet-drone to ^0.0.8 2020-08-27 16:07:18 +00:00
giles 338b9fc23a Merge pull request 'develop' (#11) from develop into master
Reviewed-on: #11
2020-08-27 16:06:21 +00:00
giles bb89b5591f Merge pull request 'Update mongo Docker tag to v4.4' (#9) from renovate/docker-mongo-4.x into master
Reviewed-on: #9
2020-08-27 16:03:24 +00:00
giles c9ae808bd3 Merge branch 'master' into renovate/docker-mongo-4.x 2020-08-27 16:03:13 +00:00
giles ae1b33ad66 Merge pull request 'Update rocketchat/rocket.chat Docker tag to v3.5.4' (#10) from renovate/docker-rocketchat-rocket.chat-3.x into master
Reviewed-on: #10
2020-08-27 16:02:43 +00:00
Giles Bradshaw 69de9c37a8 Update mongo Docker tag to v4.4 2020-08-27 15:04:44 +00:00
Giles Bradshaw 223623d469 Update rocketchat/rocket.chat Docker tag to v3.5.4 2020-08-27 14:58:28 +00:00
giles 1dc1315d31 Update 'docker-compose.yml' 2020-08-27 14:52:24 +00:00
giles 36455a90d6 Merge pull request 'Update mongo Docker tag to v4.4' (#3) from renovate/docker-mongo-4.x into master
Reviewed-on: #3
2020-08-27 14:46:34 +00:00
giles 0855a31682 Merge branch 'master' into renovate/docker-mongo-4.x 2020-08-27 14:44:57 +00:00
giles 99ae39b2c4 Merge pull request 'Update rocketchat/rocket.chat Docker tag to v3.5.4' (#4) from renovate/docker-rocketchat-rocket.chat-3.x into master
Reviewed-on: #4
2020-08-27 14:43:48 +00:00
Giles Bradshaw f2617f1239 Update rocketchat/rocket.chat Docker tag to v3.5.4 2020-08-27 14:34:23 +00:00
Giles Bradshaw 5b1ac3115e Update mongo Docker tag to v4.4 2020-08-27 14:34:15 +00:00
giles 3975c0fc8c Merge pull request 'Configure Renovate' (#2) from renovate/configure into master
Reviewed-on: #2
2020-08-27 14:32:57 +00:00
Giles Bradshaw deecce9fa4 Add renovate.json 2020-08-27 14:28:02 +00:00
Giles be6493f37d fix: drone jsonnet version 0.0.7
continuous-integration/drone/push Build is passing Details
2020-08-20 13:15:24 +01:00
Giles f81cf9dcbd chore(release): 0.0.4 2020-08-20 00:03:44 +01:00
Giles b39210ec43 ci: added logins 2020-08-20 00:03:30 +01:00
Giles 39ba4af9d0 chore(release): 0.0.3 2020-08-19 23:56:23 +01:00
Giles d76cd54925 ci: moved scripts 2020-08-19 23:56:07 +01:00
Giles 73ec7dcb9d chore(release): 0.0.2 2020-08-19 23:23:22 +01:00
Giles 9164021a1a ci: built with library 2020-08-19 23:23:00 +01:00
Giles 91f7f4db3e chore(release): 0.0.1 2020-08-19 23:11:09 +01:00
giles c334f60fb7 Update 'README.md'
continuous-integration/drone/push Build is passing Details
2020-05-11 15:17:23 +00:00
23 changed files with 1879 additions and 37 deletions

View File

@ -1,16 +0,0 @@
load("@this//chat:drone.star", "drone")
load("@this//chat:stack-name.star", "stackName")
load("@this//chat:stack-root.star", "stackRoot")
def main(ctx):
return drone(
ctx,
"do",
stackRoot,
stackName,
[
"docker service scale {name}_chat=1".format(name=stackName),
]
)

View File

@ -1,16 +0,0 @@
load("@this//chat:drone.star", "drone")
load("@this//chat:stack-name.star", "stackName")
load("@this//chat:stack-root.star", "stackRoot")
def main(ctx):
return drone(
ctx,
"home-deploy",
stackRoot,
stackName,
[
"docker service scale {name}_chat=1".format(name=stackName),
]
)

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

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

@ -0,0 +1,30 @@
local secretSecrets = import 'lib/secret-secrets.libsonnet';
local publicSecrets = import 'lib/public-secrets.libsonnet';
local deploy = import 'node_modules/@sigyl/jsonnet-drone/deploy.libsonnet';
local register = import 'node_modules/@sigyl/jsonnet-drone/register.libsonnet';
[
register,
deploy(
'chat',
'/stack/',
[],
publicSecrets,
secretSecrets,
[
'REGISTRY_DOMAIN',
'REGISTRY_PORT',
'REGISTRY_PASSWORD',
],
) {
trigger +: {
event +: [
'promote',
],
target +: [
'production',
],
},
},
]

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

@ -0,0 +1,151 @@
---
kind: pipeline
type: docker
name: register
platform:
os: linux
arch: amd64
clone:
disable: true
trigger:
event:
exclude:
- promote
---
kind: pipeline
type: docker
name: deploy
platform:
os: linux
arch: amd64
steps:
- name: print env
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
settings:
envs:
- drone_tag
- drone_commit
- drone_build_number
- drone_repo_name
- drone_repo_namespace
- chat_admin_name
- chat_admin_email
- chat_admin_password
host: ${SSH_HOST}
key: ${SSH_KEY}
passphrase: ${SSH_PASSPHRASE}
port: ${SSH_PORT}
script:
- rm -f env-chat
- "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: ${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
- name: scp
image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47
settings:
command_timeout: 2m
host: ${SSH_HOST}
key: ${SSH_KEY}
passphrase: ${SSH_PASSPHRASE}
port: ${SSH_PORT}
source:
- .
target: /stack/chat
username: ${SSH_USER}
- name: wait
image: alpine:3.12.0@sha256:90baa0922fe90624b05cb5766fa5da4e337921656c2f8e2b13bd3c052a0baac1
commands:
- sleep 15
- name: "dockerbuild:"
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
commands:
- set -e
- sh .drone/login.sh
- sh .drone/build.sh
- sh .drone/push.sh
- sh .drone/logout.sh
volumes:
- name: dockersock
path: /var/run
- name: deploy
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
settings:
envs:
- drone_tag
- drone_commit
- drone_build_number
- drone_repo_name
- drone_repo_namespace
- registry_domain
- registry_port
- registry_password
- chat_admin_name
- chat_admin_email
- chat_admin_password
host: ${SSH_HOST}
key: ${SSH_KEY}
passphrase: ${SSH_PASSPHRASE}
port: ${SSH_PORT}
script:
- export CHAT_ADMIN_PASSWORD=$${CHAT_ADMIN_PASSWORD}
- export CHAT_ADMIN_NAME=$${CHAT_ADMIN_NAME}
- export CHAT_ADMIN_EMAIL=$${CHAT_ADMIN_EMAIL}
- export REGISTRY_DOMAIN=$${REGISTRY_DOMAIN}
- export REGISTRY_PORT=$${REGISTRY_PORT}
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD}
- set -e
- cd /stack/chat
- sh .drone/login.sh
- sh .drone/pull.sh
- sh .drone/deploy.sh
username: ${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
services:
- name: docker
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
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
trigger:
event:
- promote
target:
- production
...

View File

@ -0,0 +1,4 @@
[
'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 ${REGISTRY_DOMAIN}:${REGISTRY_PORT} --username client --password "${REGISTRY_PASSWORD}"

1
.drone/logout.sh Normal file
View File

@ -0,0 +1 @@
docker logout ${REGISTRY_DOMAIN}:${REGISTRY_PORT}

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.1.0"
}
}

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.1.0":
version "0.1.0"
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-0.1.0.tgz#feda1797e8e9ef799cad72e65f7163ca26a9e3a5"
integrity sha512-QY/ngucxFOtLfL8Mt0f2bxN4fQDUOGOFtaRpSH2cNyg84xADkzehT0ORZtbLitr+AwhyF5KN/zAGvzkyNAoqPw==
dependencies:
"@sigyl/jsonnet-compose" "^0.0.2"
"@sigyl/jsonnet-drone-environment" "0.0.5"

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules
*.log

3
.versionrc Normal file
View File

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

18
CHANGELOG.md Normal file
View File

@ -0,0 +1,18 @@
# 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.5 "chore(release): 0.0.5" (2020-08-28)
### Bug Fixes
* drone jsonnet version 0.0.7 ([be6493f](https://sigyl.com///commit/be6493f37dcd75bea3d3a9091c73129433018d41))
### [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)

View File

@ -1,8 +1,24 @@
# chat
## secrets
* chat-admin-name
* chat-admin-password
* git-domain
* local-docker-registry
* registry-password
## initialise mongo
https://docs.rocket.chat/installation/manual-installation/mongo-replicas
```shell
docker exec -it [mongo container id] mongo
rs.initiate()
```
## scale chat
```shell
docker service scale chat_chat=1
```

View File

@ -7,13 +7,13 @@ services:
replicas: 0 # will scale after mongo initated
restart_policy:
condition: any
image: rocketchat/rocket.chat:3.0.7
image: rocketchat/rocket.chat:3.5.4@sha256:f5978d325f9b63abe42adebecb9a3b891fa5ffaf9840ea252c134ed9ac6c09b8
networks:
- appnet
- externalnet
environment:
- MONGO_OPLOG_URL=mongodb://chat-mongo:27017/local
- ROOT_URL=https://${GIT_DOMAIN}/chat
- ROOT_URL=https://${DOMAIN}/chat
- PORT=3000
- MONGO_URL=mongodb://chat-mongo:27017/rocketchat
- ADMIN_USERNAME=${CHAT_ADMIN_NAME}
@ -28,7 +28,8 @@ services:
replicas: 1
restart_policy:
condition: any
image: mongo:4.0
hostname: chat-mongo
image: mongo:4.4.0@sha256:ebd31eaac273a9544a33387aa859b0a8676565340a40fc824fa7bda686f462f1
networks:
- appnet
environment:
@ -36,7 +37,7 @@ services:
- MONGO_LOG_DIR=/dev/null
volumes:
- mongo-chat:/data/db
command: mongod --smallfiles --replSet rs0 --oplogSize 128
command: mongod --replSet rs0 --oplogSize 128
volumes:
mongo-chat:
chat-uploads:
@ -44,7 +45,6 @@ volumes:
networks:
appnet:
driver: overlay
#external: true
externalnet:
driver: overlay
external: true

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.5",
"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"
}
}

3
renovate.json Normal file
View File

@ -0,0 +1,3 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
}

1581
yarn.lock Normal file

File diff suppressed because it is too large Load Diff