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: |     environment: | ||||||
|       STACK_NAME: kios_admin_lumbung_space |       STACK_NAME: kios_admin_lumbung_space | ||||||
|       SECRET_PAYLOAD_SECRET_VERSION: v1 |       SECRET_PAYLOAD_SECRET_VERSION: v1 | ||||||
|  |       APP_ENTRYPOINT_VERSION: v1 | ||||||
|     settings: |     settings: | ||||||
|       stack: kios_admin_lumbung_space |       stack: kios_admin_lumbung_space | ||||||
|       host: lumbung.space |       host: lumbung.space | ||||||
|  | |||||||
| @ -1,9 +1,13 @@ | |||||||
| # lumbung-kiosk-cms | # lumbung-kiosk-cms | ||||||
|  |  | ||||||
|  | [](https://drone.autonomic.zone/ruangrupa/lumbung-kios-cms) | ||||||
|  |  | ||||||
| This project was created using create-payload-app using the ts-blank template. | This project was created using create-payload-app using the ts-blank template. | ||||||
|  |  | ||||||
| ## How to Use | ## How to Use | ||||||
|  |  | ||||||
| `yarn dev` will start up your application and reload on any changes. | `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 |     image: decentral1se/kios-admin:latest | ||||||
|     networks: |     networks: | ||||||
|       - proxy |       - proxy | ||||||
|  |       - internal | ||||||
|     volumes: |     volumes: | ||||||
|       - app:/home/node/app |       - app:/home/node/app | ||||||
|       - node_modules:/home/node/app/node_modules |       - node_modules:/home/node/app/node_modules | ||||||
| @ -14,10 +15,14 @@ services: | |||||||
|       PORT: 3000 |       PORT: 3000 | ||||||
|       NODE_ENV: production |       NODE_ENV: production | ||||||
|       PAYLOAD_SECRET_FILE: /run/secrets/payload_secret |       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: |     configs: | ||||||
|       - source: app_entrypoint |       - source: app_entrypoint | ||||||
|         target: /docker-entrypoint.sh |         target: /docker-entrypoint.sh | ||||||
|         mode: 0555 |         mode: 0555 | ||||||
|  |     entrypoint: /docker-entrypoint.sh | ||||||
|  |     command: node dist/server.js | ||||||
|     secrets: |     secrets: | ||||||
|       - payload_secret |       - payload_secret | ||||||
|     deploy: |     deploy: | ||||||
| @ -26,19 +31,19 @@ services: | |||||||
|         order: start-first |         order: start-first | ||||||
|       labels: |       labels: | ||||||
|         - "traefik.enable=true" |         - "traefik.enable=true" | ||||||
|         - "traefik.http.routers.coop-cloud-site.rule=Host(`kios-admin.lumbung.space`, `www.kios-admin.lumbung.space`)" |         - "traefik.http.routers.kios-admin.rule=Host(`kios-admin.lumbung.space`, `www.kios-admin.lumbung.space`)" | ||||||
|         - "traefik.http.routers.coop-cloud-site.entrypoints=web-secure" |         - "traefik.http.routers.kios-admin.entrypoints=web-secure" | ||||||
|         - "traefik.http.services.coop-cloud-site.loadbalancer.server.port=3000" |         - "traefik.http.services.kios-admin.loadbalancer.server.port=3000" | ||||||
|         - "traefik.http.routers.coop-cloud-site.tls.certresolver=production" |         - "traefik.http.routers.kios-admin.tls.certresolver=production" | ||||||
|  |  | ||||||
|   db: |   db: | ||||||
|     image: mongo:6.0.3 |     image: mongo:6.0.3 | ||||||
|  |     networks: | ||||||
|  |       - internal | ||||||
|     command: |     command: | ||||||
|       - "--storageEngine=wiredTiger" |       - "--storageEngine=wiredTiger" | ||||||
|     volumes: |     volumes: | ||||||
|       - data:/data/db |       - data:/data/db | ||||||
|     logging: |  | ||||||
|       driver: none |  | ||||||
|  |  | ||||||
| volumes: | volumes: | ||||||
|   app: |   app: | ||||||
| @ -46,6 +51,7 @@ volumes: | |||||||
|   data: |   data: | ||||||
|  |  | ||||||
| networks: | networks: | ||||||
|  |   internal: | ||||||
|   proxy: |   proxy: | ||||||
|     external: true |     external: true | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,29 +1,5 @@ | |||||||
| #!/bin/bash | #!/bin/sh | ||||||
|  |  | ||||||
| set -e | export PAYLOAD_SECRET=$(cat /run/secrets/payload_secret) | ||||||
|  |  | ||||||
| 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" |  | ||||||
|  |  | ||||||
| node dist/server.js | 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 path from 'path'; | ||||||
| // import Examples from './collections/Examples'; | // import Examples from './collections/Examples'; | ||||||
| import Users from './collections/Users'; | 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({ | export default buildConfig({ | ||||||
|   serverURL: 'http://localhost:3000', |   serverURL: process.env.PAYLOAD_PUBLIC_SERVER_URL, | ||||||
|   admin: { |   admin: { | ||||||
|     user: Users.slug, |     user: Users.slug, | ||||||
|   }, |   }, | ||||||
|   collections: [ |   collections: [ | ||||||
|     Users, |     Users, | ||||||
|     // Add Collections here |     Couriers, | ||||||
|     // Examples, |     Dispatches, | ||||||
|  |     Makers, | ||||||
|  |     Products, | ||||||
|  |     Retailers, | ||||||
|   ], |   ], | ||||||
|   typescript: { |   typescript: { | ||||||
|     outputFile: path.resolve(__dirname, 'payload-types.ts'), |     outputFile: path.resolve(__dirname, 'payload-types.ts'), | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	