Compare commits
11 Commits
ci-cd-depl
...
6836f05d06
Author | SHA1 | Date | |
---|---|---|---|
6836f05d06 | |||
a5489801ba | |||
7ad3901960 | |||
76888be1b9 | |||
057c3393a4 | |||
23a8bf752d | |||
f354eda75a | |||
a016159bab | |||
637089aa42 | |||
920def3123 | |||
0df02e995d |
@ -17,6 +17,7 @@ steps:
|
||||
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
|
||||
|
@ -1,9 +1,13 @@
|
||||
# lumbung-kiosk-cms
|
||||
|
||||
[](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).
|
||||
|
18
compose.yml
18
compose.yml
@ -6,6 +6,7 @@ services:
|
||||
image: decentral1se/kios-admin:latest
|
||||
networks:
|
||||
- proxy
|
||||
- internal
|
||||
volumes:
|
||||
- app:/home/node/app
|
||||
- node_modules:/home/node/app/node_modules
|
||||
@ -14,10 +15,14 @@ services:
|
||||
PORT: 3000
|
||||
NODE_ENV: production
|
||||
PAYLOAD_SECRET_FILE: /run/secrets/payload_secret
|
||||
PAYLOAD_CONFIG_PATH: /home/node/dist/payload.config.js
|
||||
PAYLOAD_PUBLIC_SERVER_URL: https://kios-admin.lumbung.space
|
||||
configs:
|
||||
- source: app_entrypoint
|
||||
target: /docker-entrypoint.sh
|
||||
mode: 0555
|
||||
entrypoint: /docker-entrypoint.sh
|
||||
command: node dist/server.js
|
||||
secrets:
|
||||
- payload_secret
|
||||
deploy:
|
||||
@ -26,19 +31,19 @@ services:
|
||||
order: start-first
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.coop-cloud-site.rule=Host(`kios-admin.lumbung.space`, `www.kios-admin.lumbung.space`)"
|
||||
- "traefik.http.routers.coop-cloud-site.entrypoints=web-secure"
|
||||
- "traefik.http.services.coop-cloud-site.loadbalancer.server.port=3000"
|
||||
- "traefik.http.routers.coop-cloud-site.tls.certresolver=production"
|
||||
- "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
|
||||
logging:
|
||||
driver: none
|
||||
|
||||
volumes:
|
||||
app:
|
||||
@ -46,6 +51,7 @@ volumes:
|
||||
data:
|
||||
|
||||
networks:
|
||||
internal:
|
||||
proxy:
|
||||
external: true
|
||||
|
||||
|
@ -1,29 +1,5 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
file_env() {
|
||||
local var="$1"
|
||||
local fileVar="${var}_FILE"
|
||||
local def="${2:-}"
|
||||
|
||||
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
||||
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local val="$def"
|
||||
|
||||
if [ "${!var:-}" ]; then
|
||||
val="${!var}"
|
||||
elif [ "${!fileVar:-}" ]; then
|
||||
val="$(< "${!fileVar}")"
|
||||
fi
|
||||
|
||||
export "$var"="$val"
|
||||
unset "$fileVar"
|
||||
}
|
||||
|
||||
file_env "PAYLOAD_SECRET"
|
||||
export PAYLOAD_SECRET=$(cat /run/secrets/payload_secret)
|
||||
|
||||
node dist/server.js
|
||||
|
17
src/collections/Couriers.ts
Normal file
17
src/collections/Couriers.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { CollectionConfig } from 'payload/types';
|
||||
|
||||
const Couriers: CollectionConfig = {
|
||||
slug: 'couriers',
|
||||
access: {
|
||||
read: () => true,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'name', // required
|
||||
type: 'text', // required
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default Couriers;
|
67
src/collections/Dispatches.ts
Normal file
67
src/collections/Dispatches.ts
Normal file
@ -0,0 +1,67 @@
|
||||
import { CollectionConfig } from 'payload/types';
|
||||
|
||||
const Dispatches: CollectionConfig = {
|
||||
slug: 'dispatches',
|
||||
// admin: {
|
||||
// useAsTitle: 'email',
|
||||
// },
|
||||
access: {
|
||||
read: () => true,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'dispatchesCode',
|
||||
type: 'text',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'products',
|
||||
type: 'relationship',
|
||||
relationTo: 'products',
|
||||
hasMany: true,
|
||||
},
|
||||
{
|
||||
name: 'startingPoint',
|
||||
type: 'relationship',
|
||||
relationTo: 'makers',
|
||||
hasMany: false,
|
||||
},
|
||||
{
|
||||
name: 'endPoint',
|
||||
type: 'relationship',
|
||||
relationTo: 'makers',
|
||||
hasMany: false,
|
||||
},
|
||||
{
|
||||
name: 'courier',
|
||||
type: 'relationship',
|
||||
relationTo: 'couriers',
|
||||
hasMany: false,
|
||||
},
|
||||
{
|
||||
name: 'status', // required
|
||||
type: 'select', // required
|
||||
hasMany: true,
|
||||
// admin: {
|
||||
// isClearable: true,
|
||||
// isSortable: true, // use mouse to drag and drop different values, and sort them according to your choice
|
||||
// },
|
||||
options: [
|
||||
{
|
||||
label: 'Route requested',
|
||||
value: 'routeRequested',
|
||||
},
|
||||
{
|
||||
label: 'In transit',
|
||||
value: 'inTransit',
|
||||
},
|
||||
{
|
||||
label: 'Completed',
|
||||
value: 'completed',
|
||||
},
|
||||
],
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
export default Dispatches;
|
32
src/collections/Makers.ts
Normal file
32
src/collections/Makers.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import { CollectionConfig } from 'payload/types';
|
||||
|
||||
const Makers: CollectionConfig = {
|
||||
slug: 'makers',
|
||||
// admin: {
|
||||
// useAsTitle: 'email',
|
||||
// },
|
||||
access: {
|
||||
read: () => true,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'name', // required
|
||||
type: 'text', // required
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'location',
|
||||
type: 'point',
|
||||
label: 'Location',
|
||||
},
|
||||
{
|
||||
name: 'products', // required
|
||||
type: 'relationship', // required
|
||||
relationTo: 'products', // required
|
||||
hasMany: true,
|
||||
// TODO: make the name of the product visible in the dropdown
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
export default Makers;
|
20
src/collections/Products.ts
Normal file
20
src/collections/Products.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { CollectionConfig } from 'payload/types';
|
||||
|
||||
const Products: CollectionConfig = {
|
||||
slug: 'products',
|
||||
// admin: {
|
||||
// useAsTitle: 'email',
|
||||
// },
|
||||
access: {
|
||||
read: () => true,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'productTitle', // required
|
||||
type: 'text', // required
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default Products;
|
31
src/collections/Retailers.ts
Normal file
31
src/collections/Retailers.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import { CollectionConfig } from 'payload/types';
|
||||
|
||||
const Retailers: CollectionConfig = {
|
||||
slug: 'retailers',
|
||||
// admin: {
|
||||
// useAsTitle: 'email',
|
||||
// },
|
||||
access: {
|
||||
read: () => true,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'name', // required
|
||||
type: 'text', // required
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'location',
|
||||
type: 'point',
|
||||
label: 'Location',
|
||||
},
|
||||
{
|
||||
name: 'products', // required
|
||||
type: 'relationship', // required
|
||||
relationTo: 'products', // required
|
||||
hasMany: true,
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
export default Retailers;
|
@ -2,16 +2,25 @@ import { buildConfig } from 'payload/config';
|
||||
import path from 'path';
|
||||
// import Examples from './collections/Examples';
|
||||
import Users from './collections/Users';
|
||||
import Couriers from './collections/Couriers';
|
||||
import Dispatches from './collections/Dispatches';
|
||||
import Makers from './collections/Makers';
|
||||
import Products from './collections/Products';
|
||||
import Retailers from './collections/Retailers';
|
||||
|
||||
|
||||
export default buildConfig({
|
||||
serverURL: 'http://localhost:3000',
|
||||
serverURL: process.env.PAYLOAD_PUBLIC_SERVER_URL,
|
||||
admin: {
|
||||
user: Users.slug,
|
||||
},
|
||||
collections: [
|
||||
Users,
|
||||
// Add Collections here
|
||||
// Examples,
|
||||
Couriers,
|
||||
Dispatches,
|
||||
Makers,
|
||||
Products,
|
||||
Retailers,
|
||||
],
|
||||
typescript: {
|
||||
outputFile: path.resolve(__dirname, 'payload-types.ts'),
|
||||
|
Reference in New Issue
Block a user