mirror of
https://github.com/muerwre/vk-tg-bot.git
synced 2025-04-24 22:46:41 +07:00
update deploy
This commit is contained in:
parent
2d2c959925
commit
6230217741
3 changed files with 11 additions and 95 deletions
75
.drone.yml
75
.drone.yml
|
@ -15,79 +15,12 @@ steps:
|
||||||
settings:
|
settings:
|
||||||
dockerfile: docker/Dockerfile
|
dockerfile: docker/Dockerfile
|
||||||
tag:
|
tag:
|
||||||
- ${DRONE_BRANCH}
|
|
||||||
- latest
|
- latest
|
||||||
username:
|
username:
|
||||||
from_secret: docker_login
|
from_secret: global_docker_login
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: global_docker_password
|
||||||
|
registry:
|
||||||
|
from_secret: global_docker_registry
|
||||||
repo:
|
repo:
|
||||||
from_secret: docker_repo
|
from_secret: docker_repo
|
||||||
registry:
|
|
||||||
from_secret: docker_registry
|
|
||||||
- name: upload
|
|
||||||
image: drillster/drone-rsync
|
|
||||||
when:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
environment:
|
|
||||||
BUILD_PATH:
|
|
||||||
from_secret: build_path
|
|
||||||
PLUGIN_ARGS: -zz -O --no-perms
|
|
||||||
PLUGIN_HOSTS:
|
|
||||||
from_secret: rsync_host
|
|
||||||
settings:
|
|
||||||
user:
|
|
||||||
from_secret: rsync_user
|
|
||||||
key:
|
|
||||||
from_secret: rsync_key
|
|
||||||
port:
|
|
||||||
from_secret: rsync_port
|
|
||||||
source: ./docker/
|
|
||||||
target: $${BUILD_PATH}/${DRONE_BRANCH}
|
|
||||||
include:
|
|
||||||
- "docker-compose.yml"
|
|
||||||
exclude:
|
|
||||||
- "wait-for-it.sh"
|
|
||||||
- "Dockerfile"
|
|
||||||
- name: deploy
|
|
||||||
image: appleboy/drone-ssh
|
|
||||||
when:
|
|
||||||
branch:
|
|
||||||
- never
|
|
||||||
environment:
|
|
||||||
BUILD_PATH:
|
|
||||||
from_secret: build_path
|
|
||||||
ENV_PATH:
|
|
||||||
from_secret: env_path
|
|
||||||
DOCKER_REGISTRY:
|
|
||||||
from_secret: docker_registry
|
|
||||||
DOCKER_REPO:
|
|
||||||
from_secret: docker_repo
|
|
||||||
settings:
|
|
||||||
port:
|
|
||||||
from_secret: rsync_port
|
|
||||||
host:
|
|
||||||
from_secret: rsync_host
|
|
||||||
username:
|
|
||||||
from_secret: rsync_user
|
|
||||||
key:
|
|
||||||
from_secret: rsync_key
|
|
||||||
envs: [build_path, env_path, docker_registry, docker_repo]
|
|
||||||
script_stop: true
|
|
||||||
script:
|
|
||||||
- cat $${ENV_PATH}/${DRONE_BRANCH}/.env > $${BUILD_PATH}/${DRONE_BRANCH}/.env
|
|
||||||
- |
|
|
||||||
echo -en "\nDRONE_BRANCH=${DRONE_BRANCH}\nCONFIG_PATH=$${ENV_PATH}/${DRONE_BRANCH}/config.yml\nDOCKER_REPO=$${DOCKER_REPO}\n"\
|
|
||||||
>> $${BUILD_PATH}/${DRONE_BRANCH}/.env
|
|
||||||
- |
|
|
||||||
docker-compose \
|
|
||||||
-f $${BUILD_PATH}/${DRONE_BRANCH}/docker-compose.yml \
|
|
||||||
--env-file $${BUILD_PATH}/${DRONE_BRANCH}/.env \
|
|
||||||
pull app
|
|
||||||
- |
|
|
||||||
docker-compose \
|
|
||||||
-f $${BUILD_PATH}/${DRONE_BRANCH}/docker-compose.yml \
|
|
||||||
--env-file $${BUILD_PATH}/${DRONE_BRANCH}/.env \
|
|
||||||
up \
|
|
||||||
-d --build
|
|
||||||
|
|
|
@ -12,5 +12,6 @@ RUN yarn build
|
||||||
WORKDIR /app/dist
|
WORKDIR /app/dist
|
||||||
COPY ./docker/wait-for-it.sh .
|
COPY ./docker/wait-for-it.sh .
|
||||||
|
|
||||||
EXPOSE ${EXPOSE}
|
EXPOSE 80
|
||||||
|
|
||||||
CMD ["node", "./index.js"]
|
CMD ["node", "./index.js"]
|
||||||
|
|
|
@ -1,36 +1,18 @@
|
||||||
version: '3.7'
|
# Docker-compose for dev purposes only
|
||||||
|
version: "3.7"
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
restart: always
|
restart: always
|
||||||
container_name: bot-${DRONE_BRANCH}__db
|
container_name: bot__db
|
||||||
image: postgres:11-alpine
|
image: postgres:11-alpine
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: user
|
POSTGRES_USER: user
|
||||||
POSTGRES_PASSWORD: password
|
POSTGRES_PASSWORD: password
|
||||||
POSTGRES_DB: bot
|
POSTGRES_DB: bot
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
volumes:
|
volumes:
|
||||||
- bot-db:/var/lib/postgresql/data
|
- bot-db:/var/lib/postgresql/data
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
app:
|
|
||||||
container_name: bot-${DRONE_BRANCH}
|
|
||||||
restart: always
|
|
||||||
pull_policy: always
|
|
||||||
environment:
|
|
||||||
PORT: 80
|
|
||||||
image: ${DOCKER_REPO}:${DRONE_BRANCH}
|
|
||||||
ports:
|
|
||||||
- ${EXPOSE}:80
|
|
||||||
volumes:
|
|
||||||
- /etc/localtime:/etc/localtime:ro
|
|
||||||
- ${CONFIG_PATH}:/etc/bot/config.yml:ro
|
|
||||||
- ${CONFIG_PATH}:/app/dist/common:ro
|
|
||||||
entrypoint: ./wait-for-it.sh -t 90 db:5432 -- node ./index.js --config /etc/bot/config.yml
|
|
||||||
depends_on:
|
|
||||||
- db
|
|
||||||
healthcheck:
|
|
||||||
test: [ "CMD-SHELL", "curl -f http://localhost || kill -s 2 1" ]
|
|
||||||
interval: 30m
|
|
||||||
timeout: 1m
|
|
||||||
start_period: 5m
|
|
||||||
volumes:
|
volumes:
|
||||||
bot-db:
|
bot-db:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue