Compare commits

..

1 Commits

Author SHA1 Message Date
drone 2ee9ef7aa1 chore(deps): pin docker digests
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/pr Build is failing Details
2020-08-28 13:14:43 +00:00
13 changed files with 89 additions and 119 deletions

16
.drone-home.star Normal file
View File

@ -0,0 +1,16 @@
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),
]
)

View File

@ -3,28 +3,15 @@ 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',
'LOCAL_DOCKER_REGISTRY',
'REGISTRY_PASSWORD',
],
) {
trigger +: {
event +: [
'promote',
],
target +: [
'production',
],
},
},
publicSecrets,
secretSecrets
),
]

View File

@ -1,20 +1,3 @@
---
kind: pipeline
type: docker
name: register
platform:
os: linux
arch: amd64
clone:
disable: true
trigger:
event:
exclude:
- promote
---
kind: pipeline
type: docker
@ -26,7 +9,7 @@ platform:
steps:
- name: print env
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
image: appleboy/drone-ssh:1.6.2
settings:
envs:
- drone_tag
@ -34,19 +17,28 @@ steps:
- 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: ${SSH_HOST}
key: ${SSH_KEY}
passphrase: ${SSH_PASSPHRASE}
port: ${SSH_PORT}
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: ${SSH_USER}
username:
from_secret: ssh-user
environment:
CHAT_ADMIN_EMAIL:
from_secret: chat-admin-email
@ -54,39 +46,53 @@ steps:
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@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47
image: appleboy/drone-scp:1.6.2
settings:
command_timeout: 2m
host: ${SSH_HOST}
key: ${SSH_KEY}
passphrase: ${SSH_PASSPHRASE}
port: ${SSH_PORT}
host:
from_secret: ssh-host
key:
from_secret: ssh-key
port:
from_secret: ssh-port
source:
- .
target: /stack/chat
username: ${SSH_USER}
username:
from_secret: ssh-user
- name: wait
image: alpine:3.12.0@sha256:90baa0922fe90624b05cb5766fa5da4e337921656c2f8e2b13bd3c052a0baac1
image: alpine
commands:
- sleep 15
- name: "dockerbuild:"
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
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@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
image: appleboy/drone-ssh:1.6.2
settings:
envs:
- drone_tag
@ -94,29 +100,32 @@ steps:
- drone_build_number
- drone_repo_name
- drone_repo_namespace
- registry_domain
- registry_port
- registry_password
- git_domain
- chat_admin_name
- chat_admin_email
- chat_admin_password
host: ${SSH_HOST}
key: ${SSH_KEY}
passphrase: ${SSH_PASSPHRASE}
port: ${SSH_PORT}
- 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 REGISTRY_DOMAIN=$${REGISTRY_DOMAIN}
- export REGISTRY_PORT=$${REGISTRY_PORT}
- 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: ${SSH_USER}
username:
from_secret: ssh-user
environment:
CHAT_ADMIN_EMAIL:
from_secret: chat-admin-email
@ -124,10 +133,16 @@ steps:
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:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
image: docker:dind
privileged: true
volumes:
- name: dockersock
@ -142,10 +157,4 @@ volumes:
host:
path: /etc/docker/certs.d
trigger:
event:
- promote
target:
- production
...

View File

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

View File

@ -1 +1 @@
docker login ${REGISTRY_DOMAIN}:${REGISTRY_PORT} --username client --password "${REGISTRY_PASSWORD}"
docker login ${LOCAL_DOCKER_REGISTRY} --username client --password "${REGISTRY_PASSWORD}"

View File

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

View File

@ -4,6 +4,6 @@
"build": "drone jsonnet --source drone-home.jsonnet --target drone-home.yml --stream"
},
"dependencies": {
"@sigyl/jsonnet-drone": "^0.1.0"
"@sigyl/jsonnet-drone": "^0.0.8"
}
}

View File

@ -1,21 +1 @@
# 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"
null

1
.gitignore vendored
View File

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

View File

@ -2,13 +2,6 @@
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)

View File

@ -1,24 +1,9 @@
# 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

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

View File

@ -1,7 +1,7 @@
{
"private": true,
"name": "chat",
"version": "0.0.5",
"version": "0.0.4",
"description": "rocket chat",
"scripts": {
"deploy": "sh deploy.sh",