-
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.
- Loading branch information
0 parents
commit f5f68c3
Showing
8 changed files
with
102 additions
and
0 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 @@ | ||
data/ |
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,18 @@ | ||
FROM ubuntu:22.04 | ||
#FROM jrei/systemd-ubuntu:22.04 | ||
MAINTAINER Chris Troutner <chris.troutner@gmail.com> | ||
|
||
# Work from the /root directory | ||
WORKDIR /root | ||
|
||
# Setup the container with required software. | ||
COPY setup-config.sh setup-config.sh | ||
RUN bash setup-config.sh | ||
|
||
COPY start-ipfs.sh start-ipfs.sh | ||
CMD ["./start-ipfs.sh"] | ||
|
||
# Launch a dummy app to keep the process alive so that I can debug issues. | ||
# This command is overwritten by the docker-compose file. | ||
#COPY dummyapp.js dummyapp.js | ||
#CMD ["node", "dummyapp.js"] |
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 @@ | ||
# trickle-ipfs | ||
|
||
This is a Docker container that wraps go-ipfs/kubo in the [Trickle](https://wiki.archlinux.org/title/trickle) Linux command line app, so that bandwidth consumption can be controlled by the adminstrator. | ||
|
||
A quick search for 'bandwidth ipfs' will reveal a lot of frustrated stories of people wanting to use go-ipfs but not being able to control the amount of bandwidth that it uses. This Docker container solve that problem. Bandwidth shaping is controlled by Trickle, which wraps the go-ipfs binary. |
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 @@ | ||
#!/bin/bash | ||
|
||
# Remove all untagged docker images. | ||
docker rmi $(docker images | grep "^<none>" | awk '{print $3}') | ||
|
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,36 @@ | ||
# This is an example docker-compose file that can be used to customize and | ||
# control the IPFS daemon. Things to pay attention to: | ||
# - envrionment | ||
# - volume | ||
# - memory limit | ||
# - ports | ||
|
||
version: '3.9' | ||
|
||
services: | ||
trickle-ipfs: | ||
image: christroutner/trickle-ipfs:v1.0.0 | ||
#build: | ||
# context: ./ | ||
# dockerfile: Dockerfile | ||
container_name: trickle-ipfs | ||
environment: | ||
IPFS_DAEMON_ARGUMENTS: '--enable-pubsub-experiment --migrate=true --agent-version-suffix=docker --routing=dhtclient' | ||
UPLOAD_KBPS: '100' | ||
DOWNLOAD_KBPS: '100' | ||
logging: | ||
driver: 'json-file' | ||
options: | ||
max-size: '10m' | ||
max-file: '10' | ||
mem_limit: 1000mb | ||
ports: | ||
- 4001:4001 | ||
- 5001:5001 | ||
- 8080:8080 | ||
command: [ | ||
'./start-ipfs.sh' | ||
] | ||
volumes: | ||
- ./data/go-ipfs:/root/.ipfs | ||
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,11 @@ | ||
/* | ||
A dummy app for keeping a docker container running, so that I log into it | ||
and debug. | ||
*/ | ||
|
||
"use strict" | ||
|
||
setInterval(function() { | ||
const now = new Date() | ||
console.log(`Timestamp: ${now.toLocaleString()}`) | ||
}, 60000) |
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,19 @@ | ||
#!/bin/bash | ||
|
||
# This script setups up the Docker image and installed needed software. | ||
# This script assumes its being run by root. | ||
|
||
apt-get update | ||
apt-get install -y curl wget nano wget snapd trickle | ||
|
||
#Install Node and NPM | ||
#curl -sL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh | ||
#bash nodesource_setup.sh | ||
#rm nodesource_setup.sh | ||
#apt-get install -y nodejs build-essential | ||
|
||
# Install IPFS | ||
wget https://dist.ipfs.io/go-ipfs/v0.14.0/go-ipfs_v0.14.0_linux-amd64.tar.gz | ||
tar -xvf go-ipfs_v0.14.0_linux-amd64.tar.gz | ||
rm go-ipfs_v0.14.0_linux-amd64.tar.gz | ||
/root/go-ipfs/install.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,7 @@ | ||
#!/bin/bash | ||
|
||
# This bash script file starts IPFS with arguments passed from the | ||
# docker compose file. | ||
|
||
ipfs init --profile=server | ||
trickle -s -u $UPLOAD_KBPS -d $DOWNLOAD_KBPS ipfs daemon $IPFS_DAEMON_ARGUMENTS |