Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/devcontainer stack compose #29

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "[Optional] Your project name here",
"dockerComposeFile": ["../docker-compose.yml", "../docker-compose-dev.yml"],
"service": "yggdrasil",
"workspaceFolder": "/opt/app/",
"shutdownAction": "stopCompose"
}
4 changes: 0 additions & 4 deletions .dockerignore

This file was deleted.

4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Yggdrasil build configuration
YGGDRASIL_VERSION=0.0.0
# Build environment preparation
LANG=C.UTF-8
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* text=auto

gradlew binary
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
gradlew binary
* text=auto eol=lf
*.[cC][mM][dD] text eol=crlf
*.[bB][aA][tT] text eol=crlf
*.[pP][sS]1 text eol=crlf

32 changes: 16 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
FROM eclipse-temurin:21
FROM eclipse-temurin:21 as builder

ADD . /opt/app/

# Yggdrasil build configuration
ENV YGGDRASIL_VERSION 0.0.0
WORKDIR /opt/app/
RUN ./gradlew

FROM eclipse-temurin:21

# Build environment preparation
ENV LANG C.UTF-8
RUN apt update && apt install -y \
git \
&& rm -rf /var/cache/apt/archives /var/lib/apt/lists/*

# Copy the jar
RUN mkdir /opt/app
COPY build/libs/yggdrasil-${YGGDRASIL_VERSION}-SNAPSHOT-all.jar /opt/app
# Copy the configuration
RUN mkdir /opt/app/conf
COPY conf/docker_disk_config.json /opt/app/conf/config.json
ARG YGGDRASIL_VERSION

# The default http port
EXPOSE 8080
# The port for interacting with CArtAgO
EXPOSE 8088
# https://stackoverflow.com/a/793867
RUN mkdir -p /opt/app/conf
COPY --from=builder /opt/app/build/libs/yggdrasil-${YGGDRASIL_VERSION}-SNAPSHOT-all.jar /opt/app/libs/
COPY --from=builder /opt/app/conf/docker_disk_config.json /opt/app/conf/config.json

ENTRYPOINT java -jar /opt/app/yggdrasil-${YGGDRASIL_VERSION}-SNAPSHOT-all.jar
ENTRYPOINT java -jar /opt/app/libs/yggdrasil-${YGGDRASIL_VERSION}-SNAPSHOT-all.jar
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Lecture Notes in Computer Science, vol 11375. Springer, Cham. https://doi.org/10
[2] Alessandro Ricci, Michele Piunti, and Mirko Viroli. 2011. Environment Programming in multi-agent
systems: an artifact-based perspective. Autonomous Agents and Multi-Agent Systems, 23(2):158-192.


## Prerequisites

* JDK 21+
Expand All @@ -32,7 +31,6 @@ To build the project, just use:

The default Gradle task `shadowJar` generates a fat-jar in the `build/libs` directory.


## Running Yggdrasil

To start an Yggdrasil node:
Expand All @@ -58,6 +56,13 @@ Run with docker-compose (by default, it exposes the port `8899` of the host mach
docker-compose up
```

Use `docker-compose-dev.yml` for an environment that contains both libraries and sources:

```shell
docker-compose -f docker-compose.yml -f docker-compose-dev.yml build
docker-compose -f docker-compose.yml -f docker-compose-dev.yml up
```

## HTTP API Overview

The HTTP API implements CRUD operations for 2 types of resources:
Expand Down Expand Up @@ -110,10 +115,9 @@ Using the discovered hub and topic IRIs, a client can subscribe for notification
that contains a JSON payload with the following fields (see the
[W3C WebSub recommendation](https://www.w3.org/TR/2018/REC-websub-20180123/)):

* `hub.mode`
* `hub.topic`
* `hub.callback`
* `hub.mode`
* `hub.topic`
* `hub.callback`

When a resource is updated, Yggdrasil issues `POST` requests with the (updated) resource
representation to all registered callbacks.

17 changes: 17 additions & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3.9'
# This file adds extensions needed for development and needs to be merged with docker-compose.yml
# See https://docs.docker.com/compose/multiple-compose-files/merge/

services:
yggdrasil:
# overwrite entrypoint of productive image
entrypoint: ["tail", "-F", "anything"]
container_name: yggdrasil-dev
# Sync changes with host
volumes:
- .:/opt/app/:cached # does already exist but https://stackoverflow.com/a/39647631
# restarting causes problems when using vscode's "Reopne in Container"
restart: "no"



4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ services:
image: yggdrasil:latest
build:
context: .
args:
- YGGDRASIL_VERSION=${YGGDRASIL_VERSION}
container_name: yggdrasil
environment:
- YGGDRASIL_VERSION=0.0.0
- YGGDRASIL_VERSION=${YGGDRASIL_VERSION}
ports:
- "8899:8080"
- "8900:8088"
Expand Down