-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from repco-org/apex
- Loading branch information
Showing
52 changed files
with
16,837 additions
and
143 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 |
---|---|---|
|
@@ -5,7 +5,6 @@ package-lock.json | |
.env | ||
SANDBOX | ||
data | ||
yarn.lock | ||
*.0x | ||
packages/repco-frontend/app/styles | ||
packages/*/coverage |
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 @@ | ||
docker-volume |
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,50 @@ | ||
version: "3.3" | ||
|
||
services: | ||
|
||
peertube: | ||
# If you don't want to use the official image and build one from sources: | ||
# build: | ||
# context: . | ||
# dockerfile: ./support/docker/production/Dockerfile.bullseye | ||
image: chocobozzz/peertube:production-bullseye | ||
env_file: | ||
- .env | ||
|
||
ports: | ||
# - "1935:1935" # Comment if you don't want to use the live feature | ||
- "9000:9000" # Uncomment if you use another webserver/proxy or test PeerTube in local, otherwise not suitable for production | ||
volumes: | ||
# - ./docker-volume/assets:/app/client/dist | ||
- ./docker-volume/data:/data | ||
- ./docker-volume/config:/config | ||
depends_on: | ||
- postgres | ||
- redis | ||
# - postfix | ||
restart: "always" | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" | ||
|
||
postgres: | ||
image: postgres:13-alpine | ||
env_file: | ||
- .env | ||
volumes: | ||
- ./docker-volume/db:/var/lib/postgresql/data | ||
restart: "always" | ||
|
||
redis: | ||
image: redis:6-alpine | ||
volumes: | ||
- ./docker-volume/redis:/data | ||
restart: "always" | ||
|
||
# postfix: | ||
# image: mwader/postfix-relay | ||
# env_file: | ||
# - .env | ||
# volumes: | ||
# - ./docker-volume/opendkim/keys:/etc/opendkim/keys | ||
# restart: "always" | ||
|
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,55 @@ | ||
# Database / Postgres service configuration | ||
POSTGRES_USER=peertube | ||
POSTGRES_PASSWORD=peertube | ||
# Postgres database name "peertube" | ||
POSTGRES_DB=peertube | ||
# The database name used by PeerTube will be PEERTUBE_DB_NAME (only if set) *OR* 'peertube'+PEERTUBE_DB_SUFFIX | ||
#PEERTUBE_DB_NAME=<MY POSTGRES DB NAME> | ||
#PEERTUBE_DB_SUFFIX=_prod | ||
# Database username and password used by PeerTube must match Postgres', so they are copied: | ||
PEERTUBE_DB_USERNAME=peertube | ||
PEERTUBE_DB_PASSWORD=peertube | ||
PEERTUBE_DB_SSL=false | ||
# Default to Postgres service name "postgres" in docker-compose.yml | ||
PEERTUBE_DB_HOSTNAME=postgres | ||
|
||
# PeerTube server configuration | ||
# If you test PeerTube in local: use "peertube.localhost" and add this domain to your host file resolving on 127.0.0.1 | ||
PEERTUBE_WEBSERVER_HOSTNAME=host.docker.internal | ||
# If you just want to test PeerTube on local | ||
PEERTUBE_WEBSERVER_PORT=9000 | ||
PEERTUBE_WEBSERVER_HTTPS=false | ||
# If you need more than one IP as trust_proxy | ||
# pass them as a comma separated array: | ||
PEERTUBE_TRUST_PROXY=["127.0.0.1", "loopback", "172.18.0.0/16"] | ||
|
||
PEERTUBE_LOG_LEVEL="debug" | ||
|
||
# Generate one using `openssl rand -hex 32` | ||
PEERTUBE_SECRET=66abdc69a969d9632be098c9bd8814972ca87c93a1bffae00580f228dfc57cd8 | ||
PT_INITIAL_ROOT_PASSWORD=peertube | ||
# E-mail configuration | ||
# If you use a Custom SMTP server | ||
#PEERTUBE_SMTP_USERNAME= | ||
#PEERTUBE_SMTP_PASSWORD= | ||
# Default to Postfix service name "postfix" in docker-compose.yml | ||
# May be the hostname of your Custom SMTP server | ||
PEERTUBE_SMTP_HOSTNAME=postfix | ||
PEERTUBE_SMTP_PORT=25 | ||
PEERTUBE_SMTP_FROM=noreply@<MY DOMAIN> | ||
PEERTUBE_SMTP_TLS=false | ||
PEERTUBE_SMTP_DISABLE_STARTTLS=false | ||
PEERTUBE_ADMIN_EMAIL=[email protected] | ||
|
||
# Postfix service configuration | ||
#POSTFIX_myhostname=localhost | ||
# If you need to generate a list of sub/DOMAIN keys | ||
# pass them as a whitespace separated string <DOMAIN>=<selector> | ||
#OPENDKIM_DOMAINS=<MY DOMAIN>=peertube | ||
# see https://github.com/wader/postfix-relay/pull/18 | ||
#OPENDKIM_RequireSafeKeys=no | ||
|
||
# /!\ Prefer to use the PeerTube admin interface to set the following configurations /!\ | ||
#PEERTUBE_SIGNUP_ENABLED=true | ||
#PEERTUBE_TRANSCODING_ENABLED=true | ||
#PEERTUBE_CONTACT_FORM_ENABLED=true |
4 changes: 4 additions & 0 deletions
4
dev/peertube/start-peertube-without-dnscache-for-local-dev.sh
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,4 @@ | ||
#!/bin/sh | ||
docker compose up -d | ||
docker compose exec peertube sed -i "s/dnsCache: true,/dnsCache: false,/g" /app/dist/server/helpers/requests.js | ||
docker compose restart peertube |
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 @@ | ||
docker-volume |
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,50 @@ | ||
version: "3.3" | ||
|
||
services: | ||
|
||
peertube: | ||
# If you don't want to use the official image and build one from sources: | ||
# build: | ||
# context: . | ||
# dockerfile: ./support/docker/production/Dockerfile.bullseye | ||
image: chocobozzz/peertube:production-bullseye | ||
env_file: | ||
- .env | ||
|
||
ports: | ||
# - "1935:1935" # Comment if you don't want to use the live feature | ||
- "9001:9000" # Uncomment if you use another webserver/proxy or test PeerTube in local, otherwise not suitable for production | ||
volumes: | ||
# - ./docker-volume/assets:/app/client/dist | ||
- ./docker-volume/data:/data | ||
- ./docker-volume/config:/config | ||
depends_on: | ||
- postgres | ||
- redis | ||
# - postfix | ||
restart: "always" | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" | ||
|
||
postgres: | ||
image: postgres:13-alpine | ||
env_file: | ||
- .env | ||
volumes: | ||
- ./docker-volume/db:/var/lib/postgresql/data | ||
restart: "always" | ||
|
||
redis: | ||
image: redis:6-alpine | ||
volumes: | ||
- ./docker-volume/redis:/data | ||
restart: "always" | ||
|
||
# postfix: | ||
# image: mwader/postfix-relay | ||
# env_file: | ||
# - .env | ||
# volumes: | ||
# - ./docker-volume/opendkim/keys:/etc/opendkim/keys | ||
# restart: "always" | ||
|
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,54 @@ | ||
# Database / Postgres service configuration | ||
POSTGRES_USER=peertube | ||
POSTGRES_PASSWORD=peertube | ||
# Postgres database name "peertube" | ||
POSTGRES_DB=peertube | ||
# The database name used by PeerTube will be PEERTUBE_DB_NAME (only if set) *OR* 'peertube'+PEERTUBE_DB_SUFFIX | ||
#PEERTUBE_DB_NAME=<MY POSTGRES DB NAME> | ||
#PEERTUBE_DB_SUFFIX=_prod | ||
# Database username and password used by PeerTube must match Postgres', so they are copied: | ||
PEERTUBE_DB_USERNAME=peertube | ||
PEERTUBE_DB_PASSWORD=peertube | ||
PEERTUBE_DB_SSL=false | ||
# Default to Postgres service name "postgres" in docker-compose.yml | ||
PEERTUBE_DB_HOSTNAME=postgres | ||
|
||
# PeerTube server configuration | ||
# If you test PeerTube in local: use "peertube.localhost" and add this domain to your host file resolving on 127.0.0.1 | ||
PEERTUBE_WEBSERVER_HOSTNAME=host.docker.internal | ||
# If you just want to test PeerTube on local | ||
PEERTUBE_WEBSERVER_PORT=9001 | ||
PEERTUBE_WEBSERVER_HTTPS=false | ||
# If you need more than one IP as trust_proxy | ||
# pass them as a comma separated array: | ||
PEERTUBE_TRUST_PROXY=["127.0.0.1", "loopback", "172.18.0.0/16"] | ||
PEERTUBE_LOG_LEVEL="debug" | ||
|
||
# Generate one using `openssl rand -hex 32` | ||
PEERTUBE_SECRET=66abdc69a969d9632be098c9bd8814972ca87c93a1bffae00580f228dfc57cd8 | ||
PT_INITIAL_ROOT_PASSWORD=peertube | ||
# E-mail configuration | ||
# If you use a Custom SMTP server | ||
#PEERTUBE_SMTP_USERNAME= | ||
#PEERTUBE_SMTP_PASSWORD= | ||
# Default to Postfix service name "postfix" in docker-compose.yml | ||
# May be the hostname of your Custom SMTP server | ||
PEERTUBE_SMTP_HOSTNAME=postfix | ||
PEERTUBE_SMTP_PORT=25 | ||
PEERTUBE_SMTP_FROM=noreply@<MY DOMAIN> | ||
PEERTUBE_SMTP_TLS=false | ||
PEERTUBE_SMTP_DISABLE_STARTTLS=false | ||
PEERTUBE_ADMIN_EMAIL=[email protected] | ||
|
||
# Postfix service configuration | ||
#POSTFIX_myhostname=localhost | ||
# If you need to generate a list of sub/DOMAIN keys | ||
# pass them as a whitespace separated string <DOMAIN>=<selector> | ||
#OPENDKIM_DOMAINS=<MY DOMAIN>=peertube | ||
# see https://github.com/wader/postfix-relay/pull/18 | ||
#OPENDKIM_RequireSafeKeys=no | ||
|
||
# /!\ Prefer to use the PeerTube admin interface to set the following configurations /!\ | ||
#PEERTUBE_SIGNUP_ENABLED=true | ||
#PEERTUBE_TRANSCODING_ENABLED=true | ||
#PEERTUBE_CONTACT_FORM_ENABLED=true |
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,26 @@ | ||
# ActivityPub development | ||
|
||
Repco includes a tiny ActivityPub server to ingest content from ActivityPub actors. | ||
|
||
To locally develop and test the federation, you can start a local peertube instance. A docker compose file is included in the repo. | ||
|
||
To launch a local PeerTube instance: | ||
|
||
``` | ||
cd dev/peertube | ||
docker compose up -d | ||
``` | ||
To make federation work, add this line to `/etc/hosts`: | ||
``` | ||
127.0.0.1 host.docker.internal | ||
``` | ||
|
||
Afterwards open http://host.docker.internal:9000 in a browser and login with username `root` and password `peertube` | ||
|
||
|
||
And make sure that you have these two variables set in repco's `.env` file. | ||
|
||
``` | ||
AP_BASE_URL=http://host.docker.internal:8765/ap | ||
``` | ||
|
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 @@ | ||
# Deploying repco |
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,3 @@ | ||
/.peertube-repl-history | ||
/generated | ||
/dist |
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,5 @@ | ||
# repco-activitypub | ||
|
||
a minimal implementation of an activitypub server | ||
|
||
only used to follow other actors, no publishing happens |
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,34 @@ | ||
import 'source-map-support/register.js' | ||
import Dotenv from 'dotenv' | ||
import express from 'express' | ||
import { PrismaClient } from 'repco-prisma' | ||
import { ActivityPub, mountActivityPub } from './src/server.js' | ||
|
||
Dotenv.config() | ||
Dotenv.config({ path: '../../.env' }) | ||
|
||
const app = express() | ||
|
||
const baseUrl = process.env.AP_BASE_URL | ||
if (!baseUrl) { | ||
throw new Error('Missing AP_BASE_URL environment variable') | ||
} | ||
|
||
const db = new PrismaClient() | ||
const ap = new ActivityPub(db, baseUrl) | ||
|
||
mountActivityPub(app, ap, { | ||
prefix: '/ap', | ||
api: { | ||
prefix: '/api/ap', | ||
auth: async (_req) => { | ||
// todo: authentication | ||
return true | ||
}, | ||
}, | ||
}) | ||
|
||
const port = process.env.PORT || 8765 | ||
app.listen(port, () => { | ||
console.log('listening on http://localhost:' + port) | ||
}) |
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,31 @@ | ||
{ | ||
"name": "repco-activitypub", | ||
"version": "0.1.0", | ||
"license": "MIT OR Apache-2.0", | ||
"maintainers": [ | ||
"repco contributors" | ||
], | ||
"main": "./dist/src/server.js", | ||
"type": "module", | ||
"scripts": { | ||
"build": "tsc --build", | ||
"watch": "tsc --build -w", | ||
"dev": "run-p watch start:watch", | ||
"docs": "typedoc src/server.ts --out ./docs", | ||
"start": "node dist/bin.js", | ||
"test": "brittle dist/test/*.js" | ||
}, | ||
"dependencies": { | ||
"@digitalbazaar/http-digest-header": "^2.0.0", | ||
"body-parser": "^1.18.3", | ||
"express": "^4.18.1", | ||
"express-async-errors": "^3.1.1", | ||
"pino-http": "^8.3.3", | ||
"repco-common": "*", | ||
"repco-prisma": "*", | ||
"source-map-support": "^0.5.21", | ||
"undici": "^5.10.0", | ||
"zod": "^3.19", | ||
"zod-error": "^1.5.0" | ||
} | ||
} |
Oops, something went wrong.