Skip to content

Commit

Permalink
Refactor Makefile. Add support for running updater
Browse files Browse the repository at this point in the history
  • Loading branch information
kam193 committed Nov 30, 2023
1 parent 2a146c0 commit 52fcd01
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 6 deletions.
3 changes: 2 additions & 1 deletion TEMPLATE/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include ../common.mk

SERVICE_NAME=assemblyline-service-template
AL_SERVICE_NAME=Template
# SERVICE_NAME=assemblyline-service-template
2 changes: 1 addition & 1 deletion TEMPLATE/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# assemblyline-service-template
# al-name-template
2 changes: 1 addition & 1 deletion TEMPLATE/service_manifest.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: assemblyline-service-template
name: al-name-template
version: 4.4.0.stable$VERSION
description: FIXME
enabled: true
Expand Down
28 changes: 25 additions & 3 deletions common.mk
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
REGISTRY?=
PUSH_REGISTRY?=
BASE_IMAGE?=${REGISTRY}/cccs/assemblyline-v4-service-base:stable
SERVICE_NAME=assemblyline-service-template
AL_SERVICE_NAME=Template
SERVICE_NAME=assemblyline-service-$(shell echo ${AL_SERVICE_NAME} | tr '[:upper:]' '[:lower:]')
BASE_TAG?=4.4.0.stable

manifest:
sed -i "s/al-name-template/${AL_SERVICE_NAME}/g" service_manifest.yml
sed -i "s/al-name-template/${AL_SERVICE_NAME}/g" README.md
sed -i "s/assemblyline-service-template/${SERVICE_NAME}/g" service_manifest.yml
sed -i "s/assemblyline-service-template/${SERVICE_NAME}/g" README.md

Expand All @@ -26,14 +29,33 @@ push: build tag

release: bump_version push

COMMAND=
ARGS=
CONTAINER_NAME=${SERVICE_NAME}
CONTAINER_NETWORK=al_registration
run: build
docker run --rm --env SERVICE_API_HOST=http://al_service_server:5003 --network=al_registration -e LOG_LEVEL=DEBUG --name ${SERVICE_NAME} kam193/${SERVICE_NAME}:latest
docker run --rm --env SERVICE_API_HOST=http://al_service_server:5003 --network=${CONTAINER_NETWORK} \
-e LOG_LEVEL=DEBUG \
-v "${PWD}/../config.yml:/etc/assemblyline/config.yml" \
-e AL_SERVICE_NAME=${AL_SERVICE_NAME} \
${ARGS} \
--name ${CONTAINER_NAME} kam193/${SERVICE_NAME}:latest ${COMMAND}

run-with-host: build
docker run --rm --env SERVICE_API_HOST=http://al_service_server:5003 --network=al_registration --add-host=host.docker.internal:host-gateway -e LOG_LEVEL=DEBUG --name ${SERVICE_NAME} kam193/${SERVICE_NAME}:latest
run-with-host: ARGS=--add-host=host.docker.internal:host-gateway
run-with-host: run

run-updater: build
run-updater: COMMAND=python -m service.updater
run-updater: CONTAINER_NAME=${SERVICE_NAME}_update
run-updater: CONTAINER_NETWORK=external
run-updater: run

refresh: CACHE="--no-cache"
refresh: build

test:
true

print:
echo ${SERVICE_NAME}
46 changes: 46 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
core:
alerter:
delay: 0
metrics:
apm_server:
server_url: null # http://apm_server:8200/
elasticsearch:
hosts: [http://elastic:devpass@elasticsearch:9200]
redis:
host: redis
redis:
nonpersistent:
host: redis
persistent:
host: redis
port: 6379

datastore:
hosts: [http://elastic:devpass@elasticsearch:9200]

filestore:
cache:
[
"s3://al_storage_key:Ch@ngeTh!sPa33w0rd@minio:9000?s3_bucket=al-cache&use_ssl=False",
]
storage:
[
"s3://al_storage_key:Ch@ngeTh!sPa33w0rd@minio:9000?s3_bucket=al-storage&use_ssl=False",
]
# cache:
# - file:///home/kamil/Devel/lab-analysing-pkgs/assemblyline/var/cache/assemblyline

logging:
export_interval: 30
log_to_console: true
log_to_file: false
log_to_syslog: false

services:
preferred_update_channel: dev
allow_insecure_registry: true
image_variables:
PRIVATE_REGISTRY: $PRIVATE_REGISTRY

ui:
enforce_quota: false

0 comments on commit 52fcd01

Please sign in to comment.