-
Notifications
You must be signed in to change notification settings - Fork 1
Api v3 refactor #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b870c9c
d727b4c
5f9aeae
2208f65
8af2044
021fd3c
857ad55
64a5de4
84dc775
db7df89
c28041d
21355a0
77be4b8
2437d29
ea1b420
7892bb6
23d34da
b75280b
8afdd6b
d256b31
e392719
90aeaf4
9b7e261
9cc7bb3
e977b62
99111bc
0122890
aaaebb7
bd84c92
5436d40
54a20d2
a12b82b
c5d7920
c2ad5a8
f84df9a
16d9a85
2f59115
49f934a
066e518
a6fa7df
b5afea3
2db45bc
4b281b4
5599cc0
a70b1fd
b996b14
c41c14b
78a3cb9
78d9fa3
6f2f3a5
c5965f6
50cd6d9
ef54a76
8f98211
82ac884
e04ddec
cea097e
cb3de4f
4a4bcf8
ff5d072
7773310
d9251cf
fd794cb
5840800
4fde20a
9cc3da7
76c7e0d
676170f
9d8b82d
0306813
931b378
dd1e2d1
7ee365f
bfb1d64
7a40cd2
51bd2e2
7fd3a58
d8fc41a
98616ae
a2fd797
56a30c0
0f24593
fb71000
9c4d986
8d3ae21
c0ef69c
830fd53
1ebc4c0
cc8c740
48260f9
de58608
2abbb66
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,28 +1,34 @@ | ||
| ## Environment Variables | ||
|
|
||
| ARCH=amd64 | ||
| NEST_PORT=3033 | ||
| HOST=0.0.0.0 | ||
| BRANCH_NAME=main | ||
| HOST=127.0.0.1 | ||
|
|
||
| # !!! Path should be with " / " at the start !!! | ||
| # NestJS | ||
| NEST_PORT=3033 | ||
| NEST_PREFIX=/api | ||
| SECRET= | ||
| JWT_EXPIRATION=30 | ||
| API_HOST=https://api.sourcescan.dev | ||
|
|
||
| # NGINX | ||
| NGINX_PORT=33 | ||
|
|
||
| # IPFS | ||
| IPFS_HOST=sscan-ipfs | ||
| IPFS_PORT=5001 | ||
|
|
||
| # Used for external comunication with ipfs | ||
| SWARM_PORT=4001 | ||
| GATE_PORT=8080 | ||
| SWARM_PORT=4001 | ||
| QUICKNODE_API_KEY= | ||
|
|
||
| # External IP for IPFS swarm announce (auto-detected if empty) | ||
| IPFS_EXTERNAL_IP= | ||
|
|
||
| # IPFS WebUI auth | ||
| IPFS_ADMIN_USER=admin | ||
| IPFS_ADMIN_PASS= | ||
|
|
||
| # Near module env | ||
| # NEAR | ||
| NEAR_MAINNET_RPC=https://rpc.mainnet.near.org | ||
| NEAR_MAINNET_ACCOUNT_ID= | ||
| NEAR_MAINNET_PRIVATE_KEY= | ||
| NEAR_TESTNET_RPC=https://rpc.testnet.near.org | ||
| NEAR_TESTNET_ACCOUNT_ID= | ||
| NEAR_TESTNET_PRIVATE_KEY= | ||
| NEAR_TESTNET_PRIVATE_KEY= |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,4 +50,5 @@ pnpm-lock.yaml | |
|
|
||
| docker-data | ||
|
|
||
| dist/ | ||
| dist/ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,32 @@ | ||
| # SourceScan NestJS Back-end and API | ||
|
|
||
| ## Installation | ||
|
|
||
| 1. Create .env file | ||
| `cp .env.example .env` | ||
| ``` | ||
| cp .env.example .env | ||
| ``` | ||
| 2. Build and run containers | ||
| `docker compose up -d --build` | ||
| 3. Add these lines to **./docker-data/ipfs/config** to open this node to global ipfs | ||
| ``` | ||
| docker compose up -d --build | ||
| ``` | ||
|
|
||
| ## Firewall Configuration | ||
|
|
||
| **Open these ports (public access required):** | ||
| | Port | Protocol | Service | Description | | ||
| |------|----------|---------|-------------| | ||
| | 33 | TCP | Nginx | API proxy (NGINX_PORT) | | ||
| | 4001 | TCP+UDP | IPFS Swarm | P2P communication (SWARM_PORT) | | ||
|
|
||
| **Keep closed (internal only, bound to 127.0.0.1):** | ||
| | Port | Service | Description | | ||
| |------|---------|-------------| | ||
| | 3033 | NestJS | Backend API (NEST_PORT) | | ||
| | 5001 | IPFS API | Admin interface (IPFS_PORT) | | ||
| | 8080 | IPFS Gateway | Content gateway (GATE_PORT) | | ||
|
|
||
| `"AppendAnnounce": [ "/ip4/{hostname}/tcp/{swarm_port}", "/ip4/{hostname}/udp/{swarm_port}/quic", "/ip4/{hostname}/udp/{swarm_port}/quic-v1", "/ip4/{hostname}/udp/{swarm_port}/quic-v1/webtransport" ]` | ||
| ## IPFS WebUI | ||
|
|
||
| After that you need to restart IPFS container | ||
| - Local: http://localhost:5001/webui | ||
| - Via nginx: http://localhost:33/ipfs-admin/webui (requires IPFS_ADMIN_USER/PASS) |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| services: | ||
| sscan-nest: | ||
| build: | ||
| context: nest | ||
| platform: linux/amd64 | ||
| container_name: ${BRANCH_NAME:-main}_sscan-nest | ||
| restart: always | ||
| networks: | ||
| - nwk | ||
| ports: | ||
| - '127.0.0.1:${NEST_PORT}:${NEST_PORT}' | ||
| volumes: | ||
| - ./nest/scripts:/app/scripts | ||
| env_file: | ||
| - .env | ||
| privileged: true | ||
|
|
||
| sscan-ipfs: | ||
| image: ipfs/kubo:v0.39.0 | ||
| container_name: ${BRANCH_NAME:-main}_sscan-ipfs | ||
| restart: always | ||
| environment: | ||
| - IPFS_PROFILE=server | ||
| - IPFS_PATH=/ipfsdata | ||
| - IPFS_EXTERNAL_IP=${IPFS_EXTERNAL_IP} | ||
| - SWARM_PORT=${SWARM_PORT} | ||
| networks: | ||
| - nwk | ||
| ports: | ||
| - "${SWARM_PORT}:4001" | ||
| - "${SWARM_PORT}:4001/udp" | ||
| - "127.0.0.1:${IPFS_PORT}:5001" | ||
| - "127.0.0.1:${GATE_PORT}:8080" | ||
| volumes: | ||
| - ./docker-data/ipfs:/ipfsdata | ||
| - ./ipfs/001-configure.sh:/container-init.d/001-configure.sh:ro | ||
| healthcheck: | ||
| test: ["CMD-SHELL", "ipfs swarm peers | head -1"] | ||
| interval: 10s | ||
| timeout: 5s | ||
| retries: 5 | ||
|
|
||
| sscan-nginx: | ||
| image: nginx:1.27 | ||
| container_name: ${BRANCH_NAME:-main}_sscan-nginx | ||
| restart: always | ||
| ports: | ||
| - '${HOST}:${NGINX_PORT}:${NGINX_PORT}' | ||
| networks: | ||
| - nwk | ||
| volumes: | ||
| - ./nginx/:/etc/nginx/templates/ | ||
| - ./nginx/scripts/entrypoint.sh:/entrypoint.sh:ro | ||
| entrypoint: /entrypoint.sh | ||
| command: ["nginx", "-g", "daemon off;"] | ||
| environment: | ||
| - NGINX_PORT=${NGINX_PORT} | ||
| - NEST_PORT=${NEST_PORT} | ||
| - GATE_PORT=${GATE_PORT} | ||
| - IPFS_PORT=${IPFS_PORT} | ||
| - IPFS_ADMIN_USER=${IPFS_ADMIN_USER} | ||
| - IPFS_ADMIN_PASS=${IPFS_ADMIN_PASS} | ||
| depends_on: | ||
| - sscan-nest | ||
| - sscan-ipfs | ||
|
|
||
| networks: | ||
| nwk: | ||
| name: ${BRANCH_NAME:-main}_nwk | ||
| driver: bridge | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,27 @@ | ||||||
| #!/bin/sh | ||||||
| set -ex | ||||||
|
|
||||||
| # Configure IPFS API for WebUI access through nginx proxy | ||||||
| ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]' | ||||||
| ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST", "GET"]' | ||||||
| ipfs config --json API.HTTPHeaders.Access-Control-Allow-Headers '["Authorization", "Content-Type"]' | ||||||
| ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]' | ||||||
|
||||||
| ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]' | |
| ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["false"]' |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
privileged: trueflag gives the container full access to the host system, which is a significant security risk. While this may be needed for Docker-in-Docker functionality, consider: