fix(startup): Exiting if server can't stop

This commit is contained in:
Chris Troutner
2021-12-29 17:46:05 -08:00
parent d6c3635c6a
commit b41f819783
39 changed files with 574 additions and 10 deletions
@@ -0,0 +1,4 @@
W
" µb
7M#Ąű˝ż!w{© VŻ«b˘‡‚Ě%Ľbgj.QmQGiYLVAdSHJQKYFRTJZMG4BXBHqKperaZtyKGmCRLmsFś

@@ -0,0 +1,4 @@
.
" '␍В▐M╜Э8gит≈─Ж╦%÷S─ж.A92╞√√л )╫about°␍/
" тn╡рАвUр_0Bб%ДFГ║ИсьЛreadmeн

@@ -0,0 +1,3 @@
V
" 謔ラ寞z,!mbャ竚WF・H!詣オV/:dケ.QmejvEPop4D7YUadeGqYWmZxHhLc4JBUCzJJHWMzdcMe2y

@@ -0,0 +1,115 @@
™␍‘␍# 0.1 - Quick Start
This is a set of short examples with minimal explanation. It is meant as
a "quick start".
Add a file to ipfs:
echo "hello world" >hello
ipfs add hello
View it:
ipfs cat <the-hash-you-got-here>
Try a directory:
mkdir foo
mkdir foo/bar
echo "baz" > foo/baz
echo "baz" > foo/bar/baz
ipfs add -r foo
View things:
ipfs ls <the-hash-here>
ipfs ls <the-hash-here>/bar
ipfs cat <the-hash-here>/baz
ipfs cat <the-hash-here>/bar/baz
ipfs cat <the-hash-here>/bar
ipfs ls <the-hash-here>/baz
References:
ipfs refs <the-hash-here>
ipfs refs -r <the-hash-here>
ipfs refs --help
Get:
ipfs get <the-hash-here> -o foo2
diff foo foo2
Objects:
ipfs object get <the-hash-here>
ipfs object get <the-hash-here>/foo2
ipfs object --help
Pin + GC:
ipfs pin add <the-hash-here>
ipfs repo gc
ipfs ls <the-hash-here>
ipfs pin rm <the-hash-here>
ipfs repo gc
Daemon:
ipfs daemon (in another terminal)
ipfs id
Network:
(must be online)
ipfs swarm peers
ipfs id
ipfs cat <hash-of-remote-object>
Mount:
(warning: fuse is finicky!)
ipfs mount
cd /ipfs/<the-hash-here>
ls
Tool:
ipfs version
ipfs update
ipfs commands
ipfs config --help
open http://localhost:5001/webui
Browse:
WebUI:
http://localhost:5001/webui
video:
http://localhost:8080/ipfs/QmVc6zuAneKJzicnJpfrqCH9gSy6bz54JhcypfJYhGUFQu/play#/ipfs/QmTKZgRNwDNZwHtJSjCp6r5FYefzpULfy37JvMt9DwvXse
images:
http://localhost:8080/ipfs/QmZpc3HvfjEXvLWGQPWbHk3AjD5j8NEN4gmFN8Jmrd5g83/cs
markdown renderer app:
http://localhost:8080/ipfs/QmX7M9CiYXjVeFnkfVGf3y5ixTZ2ACeSGyL1vBJY1HvQPp/mdown
‘␍
@@ -0,0 +1,8 @@
ŽCome hang out in our IRC chat room if you have any questions.
Contact the ipfs dev team:
- Bugs: https://github.com/ipfs/go-ipfs/issues
- Help: irc.freenode.org/#ipfs
- Email: dev@ipfs.io
½
@@ -0,0 +1,3 @@
W
" Ôn²Òá×UÒ_0BÂ%äFç¡éÓØì.QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEBÎ

@@ -0,0 +1,3 @@
W
" '␍÷M­ü8gÉÔ—€ö¸%ŸS€Ö.A92¯––Ì )½.QmQy6xmJhrcC5QLboAcGFcAE1tC8CrwDVkrHdEYJkLscrQœ

@@ -0,0 +1,27 @@
Š IPFS Alpha Security Notes
We try hard to ensure our system is safe and robust, but all software
has bugs, especially new software. This distribution is meant to be an
alpha preview, don't use it for anything mission critical.
Please note the following:
- This is alpha software and has not been audited. It is our goal
to conduct a proper security audit once we close in on a 1.0 release.
- ipfs is a networked program, and may have serious undiscovered
vulnerabilities. It is written in Go, and we do not execute any
user provided data. But please point any problems out to us in a
github issue, or email security@ipfs.io privately.
- security@ipfs.io GPG key:
- 4B9665FB 92636D17 7C7A86D3 50AAE8A9 59B13AF3
- https://pgp.mit.edu/pks/lookup?op=get&search=0x50AAE8A959B13AF3
- ipfs uses encryption for all communication, but it's NOT PROVEN SECURE
YET! It may be totally broken. For now, the code is included to make
sure we benchmark our operations with encryption in mind. In the future,
there will be an "unsafe" mode for high performance intranet apps.
If this is a blocking feature for you, please contact us.
Š
@@ -0,0 +1,3 @@
.
" '␍÷M­ü8gÉÔ—€ö¸%ŸS€Ö.A92¯––Ì )½aboutœ

@@ -0,0 +1,28 @@
ЛГHello and Welcome to IPFS!
в–€в–€в•—в–€в–€в–€в–€в–€в–€в•— в–€в–€в–€в–€в–€в–€в–€в•—в–€в–€в–€в–€в–€в–€в–€в•—
в–€в–€в•‘в–€в–€в•”в•ђв•ђв–€в–€в•—в–€в–€в•”в•ђв•ђв•ђв•ђв•ќв–€в–€в•”в•ђв•ђв•ђв•ђв•ќ
в–€в–€в•‘в–€в–€в–€в–€в–€в–€в•”в•ќв–€в–€в–€в–€в–€в•— в–€в–€в–€в–€в–€в–€в–€в•—
в–€в–€в•‘в–€в–€в•”в•ђв•ђв•ђв•ќ в–€в–€в•”в•ђв•ђв•ќ в•љв•ђв•ђв•ђв•ђв–€в–€в•‘
в–€в–€в•‘в–€в–€в•‘ в–€в–€в•‘ в–€в–€в–€в–€в–€в–€в–€в•‘
в•љв•ђв•ќв•љв•ђв•ќ в•љв•ђв•ќ в•љв•ђв•ђв•ђв•ђв•ђв•ђв•ќ
If you're seeing this, you have successfully installed
IPFS and are now interfacing with the ipfs merkledag!
-------------------------------------------------------
| Warning: |
| This is alpha software. Use at your own discretion! |
| Much is missing or lacking polish. There are bugs. |
| Not yet secure. Read the security notes for more. |
-------------------------------------------------------
Check out some of the other files in this directory:
./about
./help
./quick-start <-- usage examples
./readme <-- this file
./security-notes
Г
@@ -0,0 +1,3 @@
W
" UT†ÐŸi¾&ê›ÌpO)Ê­À¾SvÏ|Ý&к .QmU5k7ter3RdjZXu3sHghsga1UQtrztnQxmTL22nPnsu3gÂ

@@ -0,0 +1 @@
/repo/flatfs/shard/v1/next-to-last/2
@@ -0,0 +1,55 @@
™␍
IPFS -- Inter-Planetary File system
IPFS is a global, versioned, peer-to-peer filesystem. It combines good ideas
from Git, BitTorrent, Kademlia, SFS, and the Web. It is like a single bit-
torrent swarm, exchanging git objects. IPFS provides an interface as simple
as the HTTP web, but with permanence built-in. You can also mount the world
at /ipfs.
IPFS is a protocol:
- defines a content-addressed file system
- coordinates content delivery
- combines Kademlia + BitTorrent + Git
IPFS is a filesystem:
- has directories and files
- mountable filesystem (via FUSE)
IPFS is a web:
- can be used to view documents like the web
- files accessible via HTTP at `http://ipfs.io/<path>`
- browsers or extensions can learn to use `ipfs://` directly
- hash-addressed content guarantees the authenticity
IPFS is modular:
- connection layer over any network protocol
- routing layer
- uses a routing layer DHT (kademlia/coral)
- uses a path-based naming service
- uses BitTorrent-inspired block exchange
IPFS uses crypto:
- cryptographic-hash content addressing
- block-level deduplication
- file integrity + versioning
- filesystem-level encryption + signing support
IPFS is p2p:
- worldwide peer-to-peer file transfers
- completely decentralized architecture
- **no** central point of failure
IPFS is a CDN:
- add a file to the filesystem locally, and it's now available to the world
- caching-friendly (content-hash naming)
- BitTorrent-based bandwidth distribution
IPFS has a name service:
- IPNS, an SFS inspired name system
- global namespace based on PKI
- serves to build trust chains
- compatible with other NSes
- can map DNS, .onion, .bit, etc to IPNS
‘␍
@@ -0,0 +1,5 @@
.
" '␍÷M­ü8gÉÔ—€ö¸%ŸS€Ö.A92¯––Ì )½aboutœ␍-
" UT†ÐŸi¾&ê›ÌpO)Ê­À¾SvÏ|Ý&к helpÂ/
" Ôn²Òá×UÒ_0BÂ%äFç¡éÓØìreadmeÎ

@@ -0,0 +1,9 @@
¿·Some helpful resources for finding your way around ipfs:
- quick-start: a quick show of various ipfs features.
- ipfs commands: a list of all commands
- ipfs --help: every command describes itself
- https://github.com/ipfs/go-ipfs -- the src repository
- #ipfs on irc.freenode.org -- the community IRC channel
·
@@ -0,0 +1,3 @@
W
" ńż|şŚőÖ]C(Ş×ĐMîĘ2Z;jxÚäĂ|ŹťW:.QmQ5vhrL7uv6tuoN9KeVBwd4PwfQkXdVVmDLUZuTNxqgvm

@@ -0,0 +1,30 @@
This is a repository of IPLD objects. Each IPLD object is in a single file,
named <base32 encoding of cid>.data. Where <base32 encoding of cid> is the
"base32" encoding of the CID (as specified in
https://github.com/multiformats/multibase) without the 'B' prefix.
All the object files are placed in a tree of directories, based on a
function of the CID. This is a form of sharding similar to
the objects directory in git repositories. Previously, we used
prefixes, we now use the next-to-last two characters.
func NextToLast(base32cid string) {
nextToLastLen := 2
offset := len(base32cid) - nextToLastLen - 1
return str[offset : offset+nextToLastLen]
}
For example, an object with a base58 CIDv1 of
zb2rhYSxw4ZjuzgCnWSt19Q94ERaeFhu9uSqRgjSdx9bsgM6f
has a base32 CIDv1 of
BAFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA
and will be placed at
SC/AFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA.data
with 'SC' being the last-to-next two characters and the 'B' at the
beginning of the CIDv1 string is the multibase prefix that is not
stored in the filename.
@@ -0,0 +1 @@
{"diskUsage":107729,"accuracy":"initial-exact"}
+160
View File
@@ -0,0 +1,160 @@
{
"API": {
"HTTPHeaders": {}
},
"Addresses": {
"API": "/ip4/0.0.0.0/tcp/5001",
"Announce": [],
"AppendAnnounce": [],
"Gateway": "/ip4/0.0.0.0/tcp/8080",
"NoAnnounce": [],
"Swarm": [
"/ip4/0.0.0.0/tcp/4001",
"/ip6/::/tcp/4001",
"/ip4/0.0.0.0/udp/4001/quic",
"/ip6/::/udp/4001/quic"
]
},
"AutoNAT": {},
"Bootstrap": [
"/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
"/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
"/ip4/104.131.131.82/udp/4001/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
"/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
"/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
"/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb"
],
"DNS": {
"Resolvers": {}
},
"Datastore": {
"BloomFilterSize": 0,
"GCPeriod": "1h",
"HashOnRead": false,
"Spec": {
"mounts": [
{
"child": {
"path": "blocks",
"shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
"sync": true,
"type": "flatfs"
},
"mountpoint": "/blocks",
"prefix": "flatfs.datastore",
"type": "measure"
},
{
"child": {
"compression": "none",
"path": "datastore",
"type": "levelds"
},
"mountpoint": "/",
"prefix": "leveldb.datastore",
"type": "measure"
}
],
"type": "mount"
},
"StorageGCWatermark": 90,
"StorageMax": "10GB"
},
"Discovery": {
"MDNS": {
"Enabled": true,
"Interval": 10
}
},
"Experimental": {
"AcceleratedDHTClient": false,
"FilestoreEnabled": false,
"GraphsyncEnabled": false,
"Libp2pStreamMounting": false,
"P2pHttpProxy": false,
"StrategicProviding": false,
"UrlstoreEnabled": false
},
"Gateway": {
"APICommands": [],
"HTTPHeaders": {
"Access-Control-Allow-Headers": [
"X-Requested-With",
"Range",
"User-Agent"
],
"Access-Control-Allow-Methods": [
"GET"
],
"Access-Control-Allow-Origin": [
"*"
]
},
"NoDNSLink": false,
"NoFetch": false,
"PathPrefixes": [],
"PublicGateways": null,
"RootRedirect": "",
"Writable": false
},
"Identity": {
"PeerID": "12D3KooWQso9eT41jKfmMTVtCWZFBB5SNbvtk7MpPdxS7UoJs9cg",
"PrivKey": "CAESQDUd9ut08eYVCBFG8JBbbo0VEcXv19MkdVhl1sVvYU7L38BK4c8H4VB/C1KFUncWSXWHwqWnnw72o8aYdbqJVJU="
},
"Internal": {},
"Ipns": {
"RecordLifetime": "",
"RepublishPeriod": "",
"ResolveCacheSize": 128
},
"Migration": {
"DownloadSources": [],
"Keep": ""
},
"Mounts": {
"FuseAllowOther": false,
"IPFS": "/ipfs",
"IPNS": "/ipns"
},
"Peering": {
"Peers": null
},
"Pinning": {
"RemoteServices": {}
},
"Plugins": {
"Plugins": null
},
"Provider": {
"Strategy": ""
},
"Pubsub": {
"DisableSigning": false,
"Router": ""
},
"Reprovider": {
"Interval": "12h",
"Strategy": "all"
},
"Routing": {
"Type": "dht"
},
"Swarm": {
"AddrFilters": null,
"ConnMgr": {
"GracePeriod": "20s",
"HighWater": 900,
"LowWater": 600,
"Type": "basic"
},
"DisableBandwidthMetrics": false,
"DisableNatPortMap": false,
"RelayClient": {},
"RelayService": {},
"Transports": {
"Multiplexers": {},
"Network": {},
"Security": {}
}
}
}
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
MANIFEST-000011
@@ -0,0 +1 @@
MANIFEST-000009
@@ -0,0 +1,54 @@
=============== Dec 30, 2021 (UTC) ===============
01:40:36.417814 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed
01:40:36.423433 db@open opening
01:40:36.445535 version@stat F·[] S·0B[] Sc·[]
01:40:36.454968 db@janitor F·2 G·0
01:40:36.455041 db@open done T·31.559625ms
01:40:36.752266 db@close closing
01:40:36.752454 db@close done T·186.336µs
=============== Dec 30, 2021 (UTC) ===============
01:40:36.753800 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed
01:40:36.754065 version@stat F·[] S·0B[] Sc·[]
01:40:36.754088 db@open opening
01:40:36.754203 journal@recovery F·1
01:40:36.788399 journal@recovery recovering @1
01:40:36.791829 memdb@flush created L0@2 N·12 S·1KiB "/pi..ZmM,v10":"/pr..crQ,v12"
01:40:36.792228 version@stat F·[1] S·1KiB[1KiB] Sc·[0.25]
01:40:36.799053 db@janitor F·3 G·0
01:40:36.799100 db@open done T·44.997864ms
01:40:36.841246 db@close closing
01:40:36.841429 db@close done T·182.047µs
=============== Dec 30, 2021 (UTC) ===============
01:40:36.992695 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed
01:40:36.993075 version@stat F·[1] S·1KiB[1KiB] Sc·[0.25]
01:40:36.993129 db@open opening
01:40:36.993269 journal@recovery F·1
01:40:36.993485 journal@recovery recovering @3
01:40:36.997495 memdb@flush created L0@5 N·6 S·1KiB "/F5..JFI,v19":"/pi..rty,v14"
01:40:36.999812 version@stat F·[2] S·2KiB[2KiB] Sc·[0.50]
01:40:37.009050 db@janitor F·4 G·0
01:40:37.009291 db@open done T·15.935965ms
01:40:37.017612 db@close closing
01:40:37.017690 db@close done T·75.73µs
=============== Dec 30, 2021 (UTC) ===============
01:40:37.156239 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed
01:40:37.156573 version@stat F·[2] S·2KiB[2KiB] Sc·[0.50]
01:40:37.156601 db@open opening
01:40:37.156713 journal@recovery F·1
01:40:37.158093 journal@recovery recovering @6
01:40:37.176714 version@stat F·[2] S·2KiB[2KiB] Sc·[0.50]
01:40:37.187301 db@janitor F·4 G·0
01:40:37.187366 db@open done T·30.73385ms
01:40:37.195634 db@close closing
01:40:37.195772 db@close done T·136.412µs
=============== Dec 30, 2021 (UTC) ===============
01:40:37.313437 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed
01:40:37.313754 version@stat F·[2] S·2KiB[2KiB] Sc·[0.50]
01:40:37.313780 db@open opening
01:40:37.313888 journal@recovery F·1
01:40:37.317383 journal@recovery recovering @8
01:40:37.326459 version@stat F·[2] S·2KiB[2KiB] Sc·[0.50]
01:40:37.334827 db@janitor F·4 G·0
01:40:37.335050 db@open done T·21.239308ms
01:45:43.301715 db@close closing
01:45:43.301815 db@close done T·99.2µs
@@ -0,0 +1 @@
{"mounts":[{"mountpoint":"/blocks","path":"blocks","shardFunc":"/repo/flatfs/shard/v1/next-to-last/2","type":"flatfs"},{"mountpoint":"/","path":"datastore","type":"levelds"}],"type":"mount"}
+1
View File
@@ -0,0 +1 @@
11
+3 -3
View File
@@ -33,8 +33,8 @@ WORKDIR /home/safeuser
#RUN runuser -l safeuser -c "npm config set prefix '~/.npm-global'"
# Update to the latest version of npm.
# Working with npm@7.21.1
RUN npm install -g npm@7.23.0
#RUN npm install -g npm@7.23.0
RUN npm install -g npm
# npm mirror to prevent direct dependency on npm.
RUN npm set registry http://94.130.170.209:4873/
@@ -66,7 +66,7 @@ RUN npm run docs
VOLUME /home/safeuser/keys
# Expose the port the API will be served on.
EXPOSE 5001
EXPOSE 5010
# Start the application.
COPY start-production.sh start-production.sh
+26 -4
View File
@@ -1,6 +1,6 @@
# Start the service with the command 'docker-compose up -d'
version: '2'
version: '3.9'
services:
mongo-ipfs-service:
@@ -13,6 +13,29 @@ services:
command: mongod --logpath=/dev/null # -- quiet
restart: always
ipfs:
image: ipfs/go-ipfs:latest
container_name: ipfs
environment:
MY_ENV_VAR: 'placeholder'
ports:
- 4001:4001
- 5001:5001
- 8080:8080
volumes:
- ../data/go-ipfs/data:/data/ipfs
- ../data/go-ipfs/export:/export
# https://docs.docker.com/compose/compose-file/compose-file-v3/#command
# https://github.com/ipfs/go-ipfs/blob/91c52657166bcf86f2476926e4fe56694dc26562/Dockerfile#L115
command:
[
'daemon',
'--migrate=true',
'--agent-version-suffix=docker',
'--enable-pubsub-experiment'
]
restart: always
ipfs-service:
build: .
container_name: ipfs-service
@@ -24,10 +47,9 @@ services:
mem_limit: 500mb
links:
- mongo-ipfs-service
- ipfs
ports:
- '5001:5001' # <host port>:<container port>
- '5268:5268' # IPFS TCP
- '5269:5269' # IPFS WS
- '5010:5010' # <host port>:<container port>
volumes:
- ../data/ipfsdata:/home/safeuser/ipfs-service-provider/.ipfsdata
restart: always
+7 -3
View File
@@ -26,12 +26,16 @@ export DEBUG_LEVEL=1
export DBURL=mongodb://172.17.0.1:5555/ipfs-service-prod
# Configure IPFS ports
export IPFS_TCP_PORT=5268
export IPFS_WS_PORT=5269
#export IPFS_TCP_PORT=5268
#export IPFS_WS_PORT=5269
# Configure REST API port
export PORT=5001
export PORT=5010
# Production settings using external go-ipfs node.
export SVC_ENV=production
export IPFS_HOST=172.17.0.1
export IPFS_API_PORT=5001
npm start