forked from atdixon/me.untethr.nostr-relay
-
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
382 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# .circleci/config.yml | ||
|
||
version: 2.1 | ||
jobs: | ||
build: | ||
machine: | ||
image: ubuntu-2004:202111-02 | ||
steps: | ||
- checkout | ||
- run: docker login --username "$DOCKER_USER" --password "$DOCKER_PASS" | ||
- run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'" | ||
- run: earthly --version | ||
- run: earthly -P --remote-cache=duck1123/me.untethr.nostr-relay:cache --push +ci --RELAY_VERSION=0.2.4-SNAPSHOT |
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,13 @@ | ||
# You shouldn't need to change these | ||
# export REPOSITORY_HOST=k3d-myregistry.localhost:12345 | ||
# export REPO=duck1123 | ||
# export PROJECT=me.untethr.nostr-relay | ||
|
||
# TODO: Read this from the official source | ||
export RELAY_VERSION=0.2.3-SNAPSHOT | ||
|
||
# Set these to your values | ||
export RELAY_HOST=relay.localhost | ||
export RELAY_CONTACT=someuser@example.com | ||
export RELAY_ADMIN_USERNAME=someuser | ||
export RELAY_ADMIN_PUBKEY= |
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 |
---|---|---|
|
@@ -40,5 +40,9 @@ n.db* | |
n-test.db* | ||
|
||
.cpcache | ||
.devspace | ||
dump | ||
scratch | ||
scratch | ||
|
||
# User-specific configuration | ||
.envrc |
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,96 @@ | ||
# Earthfile | ||
VERSION 0.6 | ||
ARG REPO=duck1123 | ||
ARG PROJECT=me.untethr.nostr-relay | ||
ARG TAG=latest | ||
ARG RELAY_VERSION=0.2.3-SNAPSHOT | ||
|
||
ARG BUILD_IMAGE=circleci/clojure:tools-deps | ||
ARG BUILD_IMAGE_USER=circleci | ||
ARG USER_HOME=/home/${BUILD_IMAGE_USER} | ||
ARG uid=3434 | ||
ARG gid=3434 | ||
|
||
IMPORT_JAR_DEPS: | ||
COMMAND | ||
# Store the files under the user | ||
COPY --dir \ | ||
--chown=${BUILD_IMAGE_USER} \ | ||
+jar-deps/.clojure \ | ||
+jar-deps/.deps.clj \ | ||
+jar-deps/.gitlibs \ | ||
+jar-deps/.m2 \ | ||
${USER_HOME} | ||
# Store the files under root | ||
# COPY --dir \ | ||
# --chown=root \ | ||
# +jar-deps/.clojure \ | ||
# +jar-deps/.gitlibs \ | ||
# +jar-deps/.m2 \ | ||
# /root | ||
COPY --dir --chown=${BUILD_IMAGE_USER} +jar-deps/.cpcache . | ||
|
||
# A base image others can be built off of | ||
builder-base: | ||
FROM ${BUILD_IMAGE} | ||
WORKDIR /app | ||
COPY deps.edn Makefile . | ||
|
||
jar-deps: | ||
FROM +builder-base | ||
RUN whoami | ||
USER root | ||
RUN rm -rf ${USER_HOME}/.m2 | ||
RUN --mount=type=cache,target=/root/.clojure \ | ||
--mount=type=cache,target=/root/.deps.clj \ | ||
--mount=type=cache,target=/root/.gitlibs \ | ||
--mount=type=cache,target=/root/.m2 \ | ||
( \ | ||
clojure -Stree \ | ||
&& clojure -A:uberdeps -Stree \ | ||
&& clojure -A:test -Stree \ | ||
&& clojure -X:test \ | ||
) \ | ||
&& cp -r /root/.clojure ${USER_HOME}/ \ | ||
&& cp -r /root/.deps.clj ${USER_HOME}/ \ | ||
&& cp -r /root/.gitlibs ${USER_HOME}/ \ | ||
&& cp -r /root/.m2 ${USER_HOME}/ | ||
USER ${uid} | ||
SAVE ARTIFACT ${USER_HOME}/.clojure | ||
SAVE ARTIFACT ${USER_HOME}/.deps.clj | ||
SAVE ARTIFACT ${USER_HOME}/.gitlibs | ||
SAVE ARTIFACT ${USER_HOME}/.m2 | ||
SAVE ARTIFACT .cpcache | ||
|
||
build-src: | ||
FROM +builder-base | ||
DO +IMPORT_JAR_DEPS | ||
COPY --dir conf src . | ||
|
||
jar: | ||
FROM +build-src | ||
ARG RELAY_VERSION=${RELAY_VERSION} | ||
RUN echo "(ns me.untethr.nostr.version) (def version \"${RELAY_VERSION}\")" > src/me/untethr/nostr/version.clj | ||
RUN make uberjar | ||
SAVE ARTIFACT target/app.jar me.untethr.nostr-relay.jar | ||
|
||
image: | ||
FROM amazoncorretto:19-alpine | ||
WORKDIR /app | ||
ARG EXPECTED_REF=${REPO}/${PROJECT}:${TAG} | ||
COPY \ | ||
( +jar/me.untethr.nostr-relay.jar --RELAY_VERSION ${RELAY_VERSION} ) \ | ||
. | ||
COPY bootstrap.sh . | ||
COPY conf/logback.xml . | ||
CMD ["./bootstrap.sh"] | ||
SAVE IMAGE --push ${EXPECTED_REF} | ||
|
||
test: | ||
FROM +build-src | ||
COPY --dir test . | ||
RUN make test | ||
|
||
ci: | ||
BUILD +test | ||
BUILD +image |
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
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 @@ | ||
#!/usr/bin/env sh | ||
|
||
java \ | ||
-Dlogback.configurationFile=logback.xml \ | ||
-cp me.untethr.nostr-relay.jar \ | ||
clojure.main \ | ||
-m me.untethr.nostr.app |
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,86 @@ | ||
version: v2beta1 | ||
name: me-untether-nostr-relay | ||
|
||
vars: | ||
REPO: | ||
default: "duck1123" | ||
PROJECT: | ||
default: "dinsro" | ||
REPOSITORY_HOST: | ||
default: "k3d-myregistry.localhost:12345" | ||
RELAY_ADMIN_USERNAME: | ||
default: "" | ||
RELAY_CONTACT: | ||
default: "" | ||
RELAY_ADMIN_PUBKEY: | ||
default: "" | ||
RELAY_NAME: | ||
default: "" | ||
RELAY_HOST: | ||
default: "relay.localhost" | ||
RELAY_VERSION: | ||
default: "0.2.3-SNAPSHOT" | ||
|
||
pipelines: | ||
build: | ||
build_images --all | ||
build-app: | ||
build_images app | ||
dev: |- | ||
echo "Running dev pipeline" | ||
deploy: |- | ||
echo "Deploying" | ||
run_dependencies --all | ||
build_images --all -t $(git describe --always) | ||
create_deployments --all | ||
images: | ||
app: | ||
image: ${REPOSITORY_HOST}/${REPO}/${PROJECT} | ||
custom: | ||
command: |- | ||
set -ex | ||
earthly +image \ | ||
--REPO ${REPO} \ | ||
--PROJECT ${PROJECT} \ | ||
--TAG ${runtime.images.app.tag} \ | ||
--RELAY_VERSION ${RELAY_VERSION} | ||
docker tag ${REPO}/${PROJECT}:${runtime.images.app.tag} ${runtime.images.app.image}:${runtime.images.app.tag} | ||
docker push ${runtime.images.app.image}:${runtime.images.app.tag} | ||
docker image rm ${REPO}/${PROJECT}:${runtime.images.app.tag} | ||
docker image rm ${runtime.images.app.image}:${runtime.images.app.tag} | ||
deployments: | ||
app: | ||
helm: | ||
chart: | ||
name: me-untethr-nostr-relay | ||
repo: https://chart.kronkltd.net/ | ||
version: 0.1.3 | ||
# name: ../chart.kronkltd.net/stable/me-untethr-nostr-relay | ||
# valuesFiles: | ||
# - ./values.yaml | ||
values: | ||
image: | ||
registry: ${REPOSITORY_HOST} | ||
repository: ${REPO}/${PROJECT} | ||
tag: "${runtime.images.app.tag}" | ||
|
||
dev: | ||
app: | ||
labelSelector: | ||
app.kubernetes.io/name: relay | ||
app.kubernetes.io/instance: app | ||
proxyCommands: | ||
- command: devspace | ||
- command: kubectl | ||
- command: helm | ||
- command: git | ||
|
||
commands: | ||
deploy: | ||
command: devspace deploy | ||
test: | ||
command: make test | ||
render-chart: | ||
command: helm template untethr helm |
Oops, something went wrong.