-
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.
Peer to Peer integration with gateway
Pusher protocols Server abstractions
- Loading branch information
Showing
93 changed files
with
4,192 additions
and
583 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,3 @@ | ||
dist/* | ||
node_modules/* | ||
.nx/* |
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,2 @@ | ||
* | ||
!.gitignore |
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,2 @@ | ||
* | ||
!.gitignore |
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 @@ | ||
data/ | ||
ipfs/ | ||
ipns/ | ||
!.gitignore |
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,16 @@ | ||
#!/bin/sh | ||
set -ex | ||
|
||
ipfs config --json Ipns.UsePubsub true | ||
ipfs config --json Pubsub.Enabled true | ||
|
||
ipfs config --json Experimental.GatewayOverLibp2p true | ||
ipfs config --json Experimental.Libp2pStreamMounting true | ||
ipfs config --json Experimental.P2pHttpProxy true | ||
|
||
ipfs config --json Swarm.RelayClient.Enabled true | ||
ipfs config --json Swarm.RelayService.Enabled true | ||
ipfs config --json Swarm.Transports.Network.Websocket true | ||
ipfs config --bool Swarm.EnableAutoNATService true | ||
|
||
ipfs bootstrap rm all |
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,3 +1,5 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"Lua.diagnostics.globals": ["redis"], | ||
"Lua.diagnostics.disable": ["deprecated"] | ||
} |
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,23 @@ | ||
FROM --platform=$BUILDPLATFORM node:20-bullseye as build | ||
|
||
COPY . /tmp/build | ||
|
||
WORKDIR /tmp/build | ||
|
||
RUN corepack enable ; \ | ||
pnpm install --frozen-lockfile ; \ | ||
npx nx run-many --target=lint,test,build --all | ||
|
||
FROM --platform=$TARGETPLATFORM node:20-bullseye-slim | ||
|
||
COPY --from=build /tmp/build/dist /app/dist/ | ||
COPY --from=build /tmp/build/node_modules /app/node_modules/ | ||
COPY --from=build /tmp/build/package.json /tmp/build/pnpm-lock.yaml /app/ | ||
|
||
WORKDIR /app | ||
|
||
ENTRYPOINT ["node", "--no-warnings", "--experimental-modules", "--es-module-specifier-resolution=node", "/app/dist/packages/cli/index.js"] | ||
|
||
CMD ["ipfs", "start"] | ||
|
||
EXPOSE 7001 7001/udp 8001 8001/udp 4001 4001/udp 5001 5001/udp |
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,127 @@ | ||
version: '3' | ||
|
||
networks: | ||
libp2p: | ||
driver: bridge | ||
|
||
services: | ||
soketi: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
networks: | ||
- libp2p | ||
ulimits: | ||
nproc: 65535 | ||
nofile: | ||
soft: 20000 | ||
hard: 40000 | ||
environment: | ||
DEBUG: 'libp2p:*' | ||
SOKETI_P2P_SWARM_KEY: |- | ||
/key/swarm/psk/1.0.0/ | ||
/base64/ | ||
eWPS6sIlS74fXQJgrxtzvBF+zqo7UUg61BYLfAUyJ1CM4/3GHHxCwO9tojUnaqgfMRuGo/n0Km18rtLXeAy5HA== | ||
entrypoint: | ||
- 'node' | ||
- '--no-warnings' | ||
- '--experimental-modules' | ||
- '--es-module-specifier-resolution=node' | ||
- '/app/dist/packages/cli/index.js' | ||
- ipfs | ||
- start | ||
scale: 3 | ||
ports: | ||
- 7001-7003:7001 | ||
|
||
kubo: | ||
image: ipfs/kubo:release | ||
container_name: kubo | ||
volumes: | ||
- ./.ipfs/kubo/data/ipfs:/data/ipfs | ||
- ./.ipfs/kubo/ipfs:/ipfs | ||
- ./.ipfs/kubo/ipns:/ipns | ||
- ./.ipfs/kubo/init.d/001-initialize-kubo.sh:/container-init.d/001-initialize-kubo.sh | ||
networks: | ||
- libp2p | ||
ulimits: | ||
nproc: 65535 | ||
nofile: | ||
soft: 20000 | ||
hard: 40000 | ||
environment: | ||
DEBUG: '*' | ||
IPFS_PATH: /data/ipfs | ||
IPFS_FD_MAX: 10000 | ||
# IPFS_HTTP_ROUTERS: 'http://soketi:7001' | ||
IPFS_PROFILE: 'local-discovery' | ||
LIBP2P_FORCE_PNET: '1' | ||
IPFS_SWARM_KEY: |- | ||
/key/swarm/psk/1.0.0/ | ||
/base64/ | ||
eWPS6sIlS74fXQJgrxtzvBF+zqo7UUg61BYLfAUyJ1CM4/3GHHxCwO9tojUnaqgfMRuGo/n0Km18rtLXeAy5HA== | ||
ports: | ||
- 4001:4001 | ||
- 4001:4001/udp | ||
- 5001:5001 | ||
- 8080:8080 | ||
- 8081:8081 | ||
|
||
cluster: | ||
image: ipfs/ipfs-cluster:latest | ||
container_name: cluster | ||
depends_on: | ||
- kubo | ||
networks: | ||
- libp2p | ||
ulimits: | ||
nproc: 65535 | ||
nofile: | ||
soft: 20000 | ||
hard: 40000 | ||
environment: | ||
DEBUG: '*' | ||
CLUSTER_PEERNAME: cluster | ||
CLUSTER_SECRET: 'c2b82fedbd69cc89b9fb691b4b4cc9b1966f5ec34717568673b6c19f8fa336b7' | ||
CLUSTER_IPFSHTTP_NODEMULTIADDRESS: /dns4/kubo/tcp/5001 | ||
CLUSTER_CRDT_TRUSTEDPEERS: '*' # Trust all peers in Cluster | ||
CLUSTER_RESTAPI_HTTPLISTENMULTIADDRESS: /ip4/0.0.0.0/tcp/9094 # Expose API | ||
CLUSTER_MONITORPINGINTERVAL: 2s # Speed up peer discovery | ||
CLUSTER_ENABLERELAYHOP: 'true' | ||
ports: | ||
# Open API port (allows ipfs-cluster-ctl usage on host) | ||
- '127.0.0.1:9094:9094' | ||
# The cluster swarm port would need to be exposed if this container | ||
# was to connect to cluster peers on other hosts. | ||
# But this is just a testing cluster. | ||
- '9095:9095' # Cluster IPFS Proxy endpoint | ||
- '9096:9096' # Cluster swarm endpoint | ||
volumes: | ||
- ./.ipfs/cluster/data:/data/ipfs-cluster | ||
|
||
http_gateway: | ||
image: ghcr.io/ipfs/helia-http-gateway:latest | ||
container_name: http_gateway | ||
networks: | ||
- libp2p | ||
ulimits: | ||
nproc: 65535 | ||
nofile: | ||
soft: 20000 | ||
hard: 40000 | ||
ports: | ||
- 9090:9090 | ||
volumes: | ||
- ./.ipfs/http-gateway/data:/data | ||
environment: | ||
DEBUG: '*' | ||
PORT: '9090' | ||
USE_BITSWAP: true | ||
USE_LIBP2P: true | ||
USE_TRUSTLESS_GATEWAYS: true | ||
USE_DELEGATED_ROUTING: true | ||
TRUSTLESS_GATEWAYS: 'http://127.0.0.1:9090' | ||
DELEGATED_ROUTING_V1_HOST: 'http://127.0.0.1:9090' | ||
FILE_BLCOKSTORE_PATH: '/data/blockstore' | ||
FILE_DATASTORE_PATH: '/data/datastore' | ||
ECHO_HEADERS: 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
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
#!/usr/bin/env node --no-warnings --experimental-modules --es-module-specifier-resolution=node | ||
|
||
import('./lib/cli'); | ||
process.title = 'soketi'; | ||
|
||
import { cli } from './lib/cli'; | ||
cli(); |
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
22 changes: 22 additions & 0 deletions
22
packages/cli/src/lib/commands/ipfs/generate-swarm-key.command.ts
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,22 @@ | ||
import { CommandModule } from 'yargs'; | ||
import { generateSwarmKey } from '@soketi/p2p'; | ||
|
||
export type StartCommandModule = CommandModule<unknown>; | ||
|
||
export const command: StartCommandModule['command'] = 'generate:swarm-key'; | ||
|
||
export const describe: StartCommandModule['describe'] = | ||
'Generate the Swarm Key for the cluster.'; | ||
|
||
export const builder: CommandModule['builder'] = (cli) => cli; | ||
|
||
export const handler: StartCommandModule['handler'] = async () => { | ||
process.stdout.write(generateSwarmKey()); | ||
}; | ||
|
||
export default { | ||
command, | ||
describe, | ||
builder, | ||
handler, | ||
}; |
Oops, something went wrong.