-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
117 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,51 @@ | ||
# v3x-property | ||
|
||
## Repo Dev | ||
|
||
### Prerequisites | ||
|
||
- Docker `docker` | ||
- Docker Buildx `docker-buildx` | ||
|
||
## Brainrot | ||
|
||
Every hosted instance has a FQDN url, for example `v3x.property` or `property.example.com`. | ||
Instances do not have to be accessible from the internet, they can be local or on a private network (behind VPN or firewall). | ||
|
||
An instance consists of a deployment of the `engine` container. | ||
An instance keeps track of the state of all entities within it. | ||
|
||
### Entity Identity | ||
|
||
An entity is a user, a group or an organization. | ||
Entities are referenced by their path within the INSTANCE_URL of an engine. | ||
|
||
```url | ||
v3x.property/users/1234 | ||
v3x.property/items/1234 | ||
v3x.property/groups/1234 | ||
v3x.property/template/1234 | ||
``` | ||
|
||
entities at these urls have ld+json blobs that contain the entity's data. | ||
IMPORTANT; these blobs may be customized based on the viewer's permissions. | ||
This means that some data may be hidden from the viewer. | ||
If you are running into trouble double check if you are making your request with the correct authorization header. | ||
|
||
An example of a tracked item could be: | ||
|
||
```json | ||
{ | ||
"@context": "https://v3x.property/definitions/item.json", | ||
"@type": "Item", | ||
"id": "https://v3x.property/items/1234", | ||
"data": { | ||
"name": "My Cool Item", | ||
"description": "This is a cool item", | ||
"color": "red" | ||
}, | ||
"owner": "https://v3x.property/users/1234", | ||
"created": "2023-06-01T00:00:00Z", | ||
"modified": "2023-06-01T00:00:00Z" | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
ARG BINARY_NAME_DEFAULT=v3x-property-engine | ||
# ARG MY_GREAT_CONFIG_DEFAULT="someconfig-default-value" | ||
|
||
FROM clux/muslrust:stable as builder | ||
RUN groupadd -g 10001 -r dockergrp && useradd -r -g dockergrp -u 10001 dockeruser | ||
ARG BINARY_NAME_DEFAULT | ||
ENV BINARY_NAME=$BINARY_NAME_DEFAULT | ||
# Build the project with target x86_64-unknown-linux-musl | ||
|
||
# Build dummy main with the project's Cargo lock and toml | ||
# This is a docker trick in order to avoid downloading and building | ||
# dependencies when lock and toml not is modified. | ||
COPY Cargo.lock . | ||
COPY Cargo.toml . | ||
RUN mkdir src \ | ||
&& echo "fn main() {print!(\"Dummy main\");} // dummy file" > src/main.rs | ||
RUN set -x && cargo build --target x86_64-unknown-linux-musl --release | ||
RUN ["/bin/bash", "-c", "set -x && rm target/x86_64-unknown-linux-musl/release/deps/${BINARY_NAME//-/_}*"] | ||
|
||
# Now add the rest of the project and build the real main | ||
COPY src ./src | ||
RUN set -x && cargo build --target x86_64-unknown-linux-musl --release | ||
RUN mkdir -p /build-out | ||
RUN set -x && cp target/x86_64-unknown-linux-musl/release/$BINARY_NAME /build-out/ | ||
|
||
# Create a minimal docker image | ||
FROM scratch | ||
|
||
COPY --from=0 /etc/passwd /etc/passwd | ||
USER dockeruser | ||
|
||
ARG BINARY_NAME_DEFAULT | ||
ENV BINARY_NAME=$BINARY_NAME_DEFAULT | ||
# ARG MY_GREAT_CONFIG_DEFAULT | ||
# ENV MY_GREAT_CONFIG=$MY_GREAT_CONFIG_DEFAULT | ||
|
||
ENV RUST_LOG="error,$BINARY_NAME=info" | ||
COPY --from=builder /build-out/$BINARY_NAME / | ||
|
||
EXPOSE 3000 | ||
|
||
# Start with an execution list (there is no sh in a scratch image) | ||
# No shell => no variable expansion, |, <, >, etc | ||
# Hard coded start command | ||
CMD ["/v3x-property-engine"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
target/debug |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[package] | ||
name = "v3x-property" | ||
name = "v3x-property-engine" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build: | ||
# cargo build --release | ||
docker buildx build -t ghcr.io/v3xlabs/v3x-property-engine:latest -f .build/Dockerfile . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# runs the engine on port 3000 | ||
version: "3.9" | ||
services: | ||
engine: | ||
build: | ||
context: . | ||
dockerfile: .build/Dockerfile | ||
ports: | ||
- "3000:3000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# runs the engine on port 3000 | ||
version: "3.9" | ||
services: | ||
engine: | ||
image: ghcr.io/v3xlabs/v3x-property-engine:latest | ||
ports: | ||
- "3000:3000" |