Browse Source

ipfs on arm

wip
Yann Autissier 2 months ago
parent
commit
ba3727c5cd
  1. 20
      Makefile
  2. 9
      docker/ipfs/Dockerfile
  3. 11
      docker/ipfs/ipfs-config.sh
  4. 21
      make/apps/common.mk
  5. 2
      make/apps/myos/def.setup.mk
  6. 2
      make/apps/myos/setup.mk
  7. 11
      make/def.mk
  8. 4
      stack/node.mk
  9. 9
      stack/node/node.yml

20
Makefile

@ -3,7 +3,7 @@ include make/include.mk
##
# APP
app-bootstrap: setup-binfmt setup-nfsd setup-sysctl
app-bootstrap: bootstrap-docker bootstrap-host bootstrap-user
app-build: user install-build-config
$(call make,docker-compose-build docker-compose-up)
@ -15,3 +15,21 @@ app-install: ansible-run
app-tests: ansible-tests
app-start: ssh-add
##
# BOOTSTRAP
# target bootstrap-docker: Install and configure docker
# on local host
.PHONY: bootstrap-docker
bootstrap-docker: install-bin-docker setup-docker-group setup-binfmt setup-nfsd setup-sysctl
# target bootstrap-host: Fire node target
# on local host
.PHONY: bootstrap-host
bootstrap-host: node
# target bootstrap-user: Fire User target
# on local host
.PHONY: bootstrap-user
bootstrap-user: User

9
docker/ipfs/Dockerfile

@ -0,0 +1,9 @@
FROM ipfs/go-ipfs:v0.13.0-rc1 as dist
LABEL maintainer aynic.os <support+docker@asycn.io>
ARG DOCKER_BUILD_DIR
COPY ${DOCKER_BUILD_DIR}/*.sh /container-init.d/
RUN chmod +rx /container-init.d/*.sh
FROM dist as master
ARG DOCKER_BUILD_DIR

11
docker/ipfs/ipfs-config.sh

@ -0,0 +1,11 @@
#!/bin/sh
## fix following error on arm64/linux with 2Gb RAM
# ERROR p2pnode libp2p/rcmgr_defaults.go:107 ===> OOF! go-libp2p changed DefaultServiceLimits
# => changes ('test' represents the old value):
# {"op":"test","path":"/SystemLimits/Memory","value":1073741824}
# {"op":"replace","path":"/SystemLimits/Memory","value":256560128}
# => go-libp2p SetDefaultServiceLimits update needs a review:
# Please inspect if changes impact go-ipfs users, and update expectedDefaultServiceLimits in rcmgr_defaults.go to remove this message
# FATAL p2pnode libp2p/rcmgr_defaults.go:115 daemon will refuse to run with the resource manager until this is resolved
ipfs config --json Swarm.ResourceMgr.Enabled false

21
make/apps/common.mk

@ -3,28 +3,13 @@
# target bootstrap: Update application files and start dockers
# on local host
.PHONY: bootstrap
bootstrap: bootstrap-app bootstrap-host bootstrap-user app-bootstrap ## Update application files and start dockers
.PHONY: bootstrap app-bootstrap
bootstrap: bootstrap-app app-bootstrap ## Update application files and start dockers
# target bootstrap-app: Fire install-bin-git
.PHONY: bootstrap-app
bootstrap-app: install-bin-git
# target bootstrap-docker: Install and configure docker
# on local host
.PHONY: bootstrap-docker
bootstrap-docker: install-bin-docker setup-docker-group setup-sysctl
# target bootstrap-host: Fire node target
# on local host
.PHONY: bootstrap-host
bootstrap-host: node
# target bootstrap-user: Fire User target
# on local host
.PHONY: bootstrap-user
bootstrap-user: User
# target build: Build application docker images to run
# on local host
.PHONY: build
@ -180,7 +165,7 @@ stack:
# target stack-%: Call docker-compose-% target on STACK
## it splits % on dashes and extracts stack from the beginning and command from
## the last part of %
## ex: stack-User-up will fire the docker-compose-up target in the User stack
## ex: stack-node-up will fire the docker-compose-up target in the node stack
.PHONY: stack-%
stack-%:
$(eval stack := $(subst -$(lastword $(subst -, ,$*)),,$*))

2
make/apps/myos/def.setup.mk

@ -1,5 +1,5 @@
ENV_VARS += SETUP_SYSCTL_CONFIG
SETUP_BINFMT ?= false
SETUP_BINFMT ?= $(if $(filter-out amd64 x86_64,$(PROCESSOR_ARCHITECTURE)),true,false)
SETUP_BINFMT_ARCH ?= all
SETUP_NFSD ?= false
SETUP_NFSD_OSX_CONFIG ?= nfs.server.bonjour=0 nfs.server.mount.regular_files=1 nfs.server.mount.require_resv_port=0 nfs.server.nfsd_threads=16 nfs.server.async=1

2
make/apps/myos/setup.mk

@ -27,7 +27,7 @@ endif
.PHONY: setup-sysctl
setup-sysctl:
ifeq ($(SETUP_SYSCTL),true)
$(SUDO) sysctl -q -w $(SETUP_SYSCTL_CONFIG)
$(RUN) $(SUDO) sysctl -q -w $(SETUP_SYSCTL_CONFIG)
endif
# target setup-binfmt: Install binfmt abstraction layer

11
make/def.mk

@ -69,7 +69,7 @@ GIT_VERSION ?= $(shell git describe --tags $(BRANCH) 2>/dev/
HOSTNAME ?= $(shell hostname 2>/dev/null |sed 's/\..*//')
IGNORE_DRYRUN ?= false
IGNORE_VERBOSE ?= false
INSTALL ?= $(SUDO) $(subst &&,&& $(SUDO),$(INSTALL_CMD))
INSTALL ?= $(RUN) $(SUDO) $(subst &&,&& $(RUN) $(SUDO),$(INSTALL_CMD))
INSTALL_CMDS ?= APK_INSTALL APT_INSTALL
$(foreach cmd,$(INSTALL_CMDS),$(if $(CMD_$(cmd)),$(eval INSTALL_CMD ?= $(CMD_$(cmd)))))
LOG_LEVEL ?= $(if $(DEBUG),debug,$(if $(VERBOSE),info,error))
@ -126,13 +126,8 @@ OPERATING_SYSTEM := cygwin
else ifeq ($(OS),Windows_NT)
OPERATING_SYSTEM := Windows_NT
else
UNAME_S := $(shell uname -s 2>/dev/null)
ifeq ($(UNAME_S),Linux)
OPERATING_SYSTEM := Linux
endif
ifeq ($(UNAME_S),Darwin)
OPERATING_SYSTEM := Darwin
endif
PROCESSOR_ARCHITECTURE := $(shell uname -m 2>/dev/null)
OPERATING_SYSTEM := $(shell uname -s 2>/dev/null)
endif
ifeq ($(OPERATING_SYSTEM),Darwin)

4
stack/node.mk

@ -1,4 +1,6 @@
ENV_VARS += DOCKER_HOST_IFACE DOCKER_HOST_INET
ENV_VARS += DOCKER_HOST_IFACE DOCKER_HOST_INET IPFS_PROFILE
IPFS_PROFILE ?= $(if $(filter-out amd64 x86_64,$(PROCESSOR_ARCHITECTURE)),lowpower,server)
# target node: Fire docker-network-create-% for DOCKER_NETWORK_PUBLIC node-ssl-certs stack-node-up
.PHONY: node

9
stack/node/node.yml

@ -65,7 +65,14 @@ services:
volumes:
- ssl-certs:/certs
ipfs:
image: ipfs/go-ipfs:latest
build:
args:
- DOCKER_BUILD_DIR=docker/ipfs
context: ../..
dockerfile: docker/ipfs/Dockerfile
image: ${DOCKER_REPOSITORY_NODE}/ipfs:${DOCKER_IMAGE_TAG}
environment:
- IPFS_PROFILE=${IPFS_PROFILE}
labels:
- SERVICE_4001_NAME=${COMPOSE_SERVICE_NAME}-ipfs-4001
- SERVICE_5001_NAME=${COMPOSE_SERVICE_NAME}-ipfs-5001

Loading…
Cancel
Save