mirror of
https://github.com/aljazceru/pubky-docker.git
synced 2025-12-17 07:24:35 +01:00
intial docker compose setup
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
.env
|
||||
storage
|
||||
.storage
|
||||
64
Readme.md
Normal file
64
Readme.md
Normal file
@@ -0,0 +1,64 @@
|
||||
# 💻 Pubky Docker
|
||||
|
||||
One click setup to run locally an example full Pubky Social (App) stack. This orchestration will run:
|
||||
|
||||
- [Pkarr relay](https://github.com/pubky/pkarr):
|
||||
- [Pubky Homeserver](https://github.com/pubky/pubky/tree/main/pubky-homeserver): Instance of pubky decentralized data storage.
|
||||
- [Pubky Nexus](https://github.com/pubky/pubky-nexus): aggregator and indexer of `/pub/pubky.app` data that creates a powerful social-media-like API
|
||||
- [Pubky App](https://github.com/pubky/pubky-app): client for the pubky social media app.
|
||||
|
||||
## ⚠️ Warning
|
||||
|
||||
Running the full stack is overkill if your goal is only to develop an application using Pubky.
|
||||
|
||||
For application development, use the official client libraries instead:
|
||||
|
||||
- JavaScript: https://www.npmjs.com/package/@synonymdev/pubky
|
||||
- Rust: https://crates.io/crates/pubky
|
||||
|
||||
Only run this full orchestration if you're specifically experimenting with the complete stack with interest on the Nexus indexer and the social frontend client.
|
||||
|
||||
## ⚙️ Setup
|
||||
|
||||
This repo uses `pubky/pkarr`, `pubky/pubky`, `pubky/pubky-nexus` and `pubky/pubky-app` as directly as the moment as we are not releasing Docker images just yet.
|
||||
|
||||
Make a copy of `.env-sample` into `.env` and set your preferences for `mainnet` or `testnet`.
|
||||
|
||||
```bash
|
||||
docker compose up
|
||||
```
|
||||
|
||||
## 📁 Directory Structure Requirement
|
||||
|
||||
Before running `docker compose up`, ensure the following four repositories are cloned **at the same directory level** as `pubky-docker`. This is necessary because the Docker setup references them via relative paths.
|
||||
|
||||
Your directory should look like this:
|
||||
|
||||
```
|
||||
your_working_directory/
|
||||
├── pubky-docker/ # this project!
|
||||
├── pkarr/
|
||||
├── pubky/
|
||||
├── pubky-nexus/
|
||||
├── pubky-app/
|
||||
```
|
||||
|
||||
Clone each required repository:
|
||||
|
||||
```
|
||||
git clone https://github.com/pubky/pubky-docker.git # this repository
|
||||
git clone https://github.com/pubky/pkarr.git
|
||||
git clone https://github.com/pubky/pubky.git
|
||||
git clone https://github.com/pubky/pubky-nexus.git
|
||||
git clone https://github.com/pubky/pubky-app.git
|
||||
```
|
||||
|
||||
Then navigate into `pubky-docker`, configure your `.env`, and run:
|
||||
|
||||
```
|
||||
cd pubky-docker
|
||||
cp .env-sample .env
|
||||
# edit .env to choose between mainnet or testnet
|
||||
docker compose up
|
||||
```
|
||||
|
||||
122
docker-compose.yml
Normal file
122
docker-compose.yml
Normal file
@@ -0,0 +1,122 @@
|
||||
services:
|
||||
# 1. Pkarr server
|
||||
pkarr:
|
||||
container_name: pkarr
|
||||
build:
|
||||
context: ../pkarr
|
||||
volumes:
|
||||
- ./pkarr.config.toml:/config.toml
|
||||
- .storage/pkarr:/cache
|
||||
command: pkarr-server --config=/config.toml
|
||||
# networks:
|
||||
# - default
|
||||
# ports:
|
||||
# - 6882:6882
|
||||
network_mode: host
|
||||
|
||||
# 2. Pubky Homeserver
|
||||
homeserver:
|
||||
container_name: homeserver
|
||||
restart: always
|
||||
build:
|
||||
context: ../pubky-core
|
||||
volumes:
|
||||
- ./homeserver.config.toml:/config.toml
|
||||
- ./homeserver.entrypoint.sh:/entrypoint.sh
|
||||
- .storage/homeserver:/homeserver
|
||||
env_file:
|
||||
- ./.env
|
||||
entrypoint: [ "/bin/sh", "-c", "/entrypoint.sh" ]
|
||||
# networks:
|
||||
# - default
|
||||
# ports:
|
||||
# - 6287:6287
|
||||
# depends_on:
|
||||
# - pkarr
|
||||
network_mode: host
|
||||
|
||||
# 3 Nexus
|
||||
# 3.1 Pubky Nexus Daemon
|
||||
nexusd:
|
||||
container_name: nexusd
|
||||
build:
|
||||
context: ../pubky-nexus
|
||||
# Simplified internal config path
|
||||
command: nexusd --config-dir=/config
|
||||
volumes:
|
||||
# Mount static files path
|
||||
- .storage/static:/static
|
||||
# Mount the config file
|
||||
- ./pubky-nexus-config-${NETWORK:-testnet}.toml:/config/config.toml
|
||||
# ports:
|
||||
# - 8080:8080
|
||||
# networks:
|
||||
# - default
|
||||
network_mode: host
|
||||
depends_on:
|
||||
- nexus-neo4j
|
||||
- nexus-redis
|
||||
|
||||
# 3.2 Pubky Nexus Graph
|
||||
nexus-neo4j:
|
||||
image: neo4j:5.26.7-community
|
||||
container_name: nexus-neo4j
|
||||
restart: unless-stopped
|
||||
# ports:
|
||||
# - 7474:7474
|
||||
# - 7687:7687
|
||||
# networks:
|
||||
# - default
|
||||
network_mode: host
|
||||
volumes:
|
||||
# Mount the neo4j configuration file to container
|
||||
- .storage/neo4j/conf:/conf
|
||||
# Mount the data to container
|
||||
- .storage/neo4j/data:/data
|
||||
- .storage/neo4j/logs:/logs
|
||||
- ./pubky-nexus/docker/db-graph:/db-graph
|
||||
env_file:
|
||||
- ./neo4j.env
|
||||
|
||||
# 3.3 Pubky Nexus Index
|
||||
nexus-redis:
|
||||
image: redis/redis-stack:7.2.0-v11
|
||||
container_name: nexus-redis
|
||||
# ports:
|
||||
# - 6379:6379
|
||||
# - 8001:8001 # Redis Insight http://localhost:8001/
|
||||
# networks:
|
||||
# - default
|
||||
network_mode: host
|
||||
volumes:
|
||||
- .storage/redis/data:/data
|
||||
- ./redis.conf:/usr/local/etc/redis/redis.conf
|
||||
restart: always
|
||||
|
||||
# 4. Pubky.app Social UI
|
||||
client:
|
||||
container_name: client
|
||||
build:
|
||||
context: ../pubky-app
|
||||
args:
|
||||
NEXT_PUBLIC_HOMESERVER: ${NEXT_PUBLIC_HOMESERVER:-8pinxxgqs41n4aididenw5apqp1urfmzdztr8jt4abrkdn435ewo}
|
||||
NEXT_PUBLIC_NEXUS: ${NEXT_PUBLIC_NEXUS:-http://localhost:8080}
|
||||
NEXT_PUBLIC_TESTNET: ${NEXT_PUBLIC_TESTNET:-true}
|
||||
NEXT_PUBLIC_DEFAULT_HTTP_RELAY: ${HTTP_RELAY:-http://localhost:15412/link/}
|
||||
NEXT_PUBLIC_PKARR_RELAYS: ${NEXT_PUBLIC_PKARR_RELAYS:-["https://pkarr.pubky.app","https://pkarr.pubky.org"]} # Ignored when using Testnet
|
||||
NEXT_ENABLE_PLAUSIBLE: ${NEXT_ENABLE_PLAUSIBLE:-false}
|
||||
env_file:
|
||||
- ./.env
|
||||
command: [ "npm", "run", "serve:prod" ]
|
||||
# networks:
|
||||
# - default
|
||||
# ports:
|
||||
# - 4200:4200
|
||||
network_mode: host
|
||||
|
||||
networks:
|
||||
default:
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
backend_storage:
|
||||
8
homeserver.config.toml
Normal file
8
homeserver.config.toml
Normal file
@@ -0,0 +1,8 @@
|
||||
[general]
|
||||
# The mode for the signup. Default: "token_required" Options:
|
||||
# "open" - anyone can signup.
|
||||
# "token_required" - a signup token is required to signup.
|
||||
signup_mode = "token_required"
|
||||
|
||||
[pkdns]
|
||||
icann_domain = "localhost"
|
||||
9
homeserver.entrypoint.sh
Executable file
9
homeserver.entrypoint.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
|
||||
#!/bin/sh
|
||||
|
||||
# Check the NETWORK environment variable and execute the appropriate command
|
||||
if [ "$NETWORK" = "mainnet" ]; then
|
||||
exec homeserver
|
||||
else
|
||||
exec homeserver --homeserver-config=/config.toml
|
||||
fi
|
||||
16
neo4j.env
Normal file
16
neo4j.env
Normal file
@@ -0,0 +1,16 @@
|
||||
# Neo4J free does not support custon db_name and db_username
|
||||
# the default ones are neo4j
|
||||
# NEO4J_DB_NAME=neo4j
|
||||
# NEO4J_DB_USERNAME=neo4j
|
||||
# NEO4J_PASSWORD=12345678
|
||||
# NEO4J_initial_dbms_default__database=${NEO4J_DB_NAME}
|
||||
# IMPORTANT: If you change the auth params and you have already created the config files, will not take effect
|
||||
# To restart: docker compose down -v
|
||||
NEO4J_AUTH=neo4j/12345678 # ${NEO4J_DB_USERNAME}/${NEO4J_PASSWORD}
|
||||
# https://neo4j.com/docs/operations-manual/current/docker/configuration/
|
||||
# Modify the default configuration
|
||||
# Raise memory limits
|
||||
NEO4J_server_memory_pagecache_size=2G
|
||||
NEO4J_server_memory_heap_initial__size=4G
|
||||
NEO4J_server_memory_heap_max__size=8G
|
||||
NEO4J_apoc_uuid_enabled=false
|
||||
11
pkarr.config.toml
Normal file
11
pkarr.config.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
relay_port = 6882
|
||||
dht_port = 6882
|
||||
cache_path = "/cache"
|
||||
cache_size = 1_000_000
|
||||
resolvers = []
|
||||
minimum_ttl = 300
|
||||
maximum_ttl = 86400
|
||||
[rate_limiter]
|
||||
behind_proxy = false
|
||||
per_second = 2
|
||||
burst_size = 10
|
||||
24
pubky-nexus-config-testnet.toml
Normal file
24
pubky-nexus-config-testnet.toml
Normal file
@@ -0,0 +1,24 @@
|
||||
[api]
|
||||
name = "nexusd.api"
|
||||
public_addr = "127.0.0.1:8080"
|
||||
|
||||
[watcher]
|
||||
name = "nexusd.watcher"
|
||||
testnet = true
|
||||
testnet_host = "homeserver"
|
||||
homeserver = "8pinxxgqs41n4aididenw5apqp1urfmzdztr8jt4abrkdn435ewo"
|
||||
events_limit = 1000
|
||||
watcher_sleep = 100
|
||||
moderation_id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
moderated_tags = []
|
||||
|
||||
[stack]
|
||||
log_level = "debug"
|
||||
files_path = "/static/files/"
|
||||
|
||||
[stack.db]
|
||||
redis = "redis://localhost:6379"
|
||||
|
||||
[stack.db.neo4j]
|
||||
uri = "bolt://localhost:7687"
|
||||
password = "12345678"
|
||||
8
redis.conf
Normal file
8
redis.conf
Normal file
@@ -0,0 +1,8 @@
|
||||
# Redis configuration
|
||||
maxmemory 17179869184 # Set it to 16GB or adjust according to your system's memory
|
||||
tcp-keepalive 0
|
||||
tcp-backlog 65536
|
||||
maxclients 30000
|
||||
save 900 1
|
||||
save 300 10
|
||||
save 60 10000
|
||||
Reference in New Issue
Block a user