Merge branch 'main' of ssh://git.autonomic.zone:2222/ruangrupa/lumbung-kios-cms
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
augurk 2023-01-24 14:09:34 +01:00
commit 76888be1b9
6 changed files with 133 additions and 36 deletions

34
.drone.yml Normal file
View File

@ -0,0 +1,34 @@
---
kind: pipeline
name: continuous deployment
steps:
- name: build and push new image
image: plugins/docker
settings:
username:
from_secret: docker_reg_username
password:
from_secret: docker_reg_passwd
repo: decentral1se/kios-admin
tags: latest
- name: deploy image
image: decentral1se/stack-ssh-deploy:latest
environment:
STACK_NAME: kios_admin_lumbung_space
SECRET_PAYLOAD_SECRET_VERSION: v1
APP_ENTRYPOINT_VERSION: v1
settings:
stack: kios_admin_lumbung_space
host: lumbung.space
deploy_key:
from_secret: drone_ssh_lumbung.space
depends_on:
- build and push new image
trigger:
branch:
- main
event:
exclude:
- pull_request

23
Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM node:18-alpine as base
FROM base as builder
WORKDIR /home/node
COPY package*.json ./
COPY . .
RUN yarn install
RUN yarn build
FROM base as runtime
ENV NODE_ENV=production
WORKDIR /home/node
COPY package*.json ./
RUN yarn install --production
COPY --from=builder /home/node/dist ./dist
COPY --from=builder /home/node/build ./build
EXPOSE 3000

View File

@ -1,9 +1,13 @@
# lumbung-kiosk-cms
[![Build Status](https://drone.autonomic.zone/api/badges/ruangrupa/lumbung-kios-cms/status.svg?ref=refs/heads/main)](https://drone.autonomic.zone/ruangrupa/lumbung-kios-cms)
This project was created using create-payload-app using the ts-blank template.
## How to Use
`yarn dev` will start up your application and reload on any changes.
If you have docker and docker-compose installed, you can run `docker-compose up`
## Deploy
Push commits, it will auto-deploy to [kios-admin.lumbung.space](https://kios-admin.lumbung.space).

66
compose.yml Normal file
View File

@ -0,0 +1,66 @@
---
version: "3.8"
services:
app:
image: decentral1se/kios-admin:latest
networks:
- proxy
- internal
volumes:
- app:/home/node/app
- node_modules:/home/node/app/node_modules
environment:
MONGODB_URI: mongodb://db:27017/payload
PORT: 3000
NODE_ENV: production
PAYLOAD_SECRET_FILE: /run/secrets/payload_secret
PAYLOAD_CONFIG_PATH: /home/node/dist/payload.config.js
configs:
- source: app_entrypoint
target: /docker-entrypoint.sh
mode: 0555
entrypoint: /docker-entrypoint.sh
command: node dist/server.js
secrets:
- payload_secret
deploy:
update_config:
failure_action: rollback
order: start-first
labels:
- "traefik.enable=true"
- "traefik.http.routers.kios-admin.rule=Host(`kios-admin.lumbung.space`, `www.kios-admin.lumbung.space`)"
- "traefik.http.routers.kios-admin.entrypoints=web-secure"
- "traefik.http.services.kios-admin.loadbalancer.server.port=3000"
- "traefik.http.routers.kios-admin.tls.certresolver=production"
db:
image: mongo:6.0.3
networks:
- internal
command:
- "--storageEngine=wiredTiger"
volumes:
- data:/data/db
volumes:
app:
node_modules:
data:
networks:
internal:
proxy:
external: true
secrets:
payload_secret:
external: true
name: ${STACK_NAME}_payload_secret_${SECRET_PAYLOAD_SECRET_VERSION}
configs:
app_entrypoint:
name: ${STACK_NAME}_app_entrypoint_${APP_ENTRYPOINT_VERSION}
file: entrypoint.sh.tmpl
template_driver: golang

View File

@ -1,35 +0,0 @@
version: '3'
services:
payload:
image: node:18-alpine
ports:
- "3000:3000"
volumes:
- .:/home/node/app
- node_modules:/home/node/app/node_modules
working_dir: /home/node/app/
command: sh -c "yarn install && yarn dev"
depends_on:
- mongo
environment:
MONGODB_URI: mongodb://mongo:27017/payload
PORT: 3000
NODE_ENV: development
PAYLOAD_SECRET: TESTING
mongo:
image: mongo:latest
ports:
- "27017:27017"
command:
- --storageEngine=wiredTiger
volumes:
- data:/data/db
logging:
driver: none
volumes:
data:
node_modules:

5
entrypoint.sh.tmpl Normal file
View File

@ -0,0 +1,5 @@
#!/bin/sh
export PAYLOAD_SECRET=$(cat /run/secrets/payload_secret)
node dist/server.js