updated ipfs state

This commit is contained in:
Paul 2021-01-17 17:44:22 +01:00
parent 3db698db57
commit 4d6b8dd50d
9 changed files with 149 additions and 88 deletions

41
states/ipfs/config.sls Normal file
View File

@ -0,0 +1,41 @@
---
ipfs-set-storagemax:
cmd.run:
- name: /usr/local/sbin/ipfs config Datastore.StorageMax "20GB"
- runas: ipfs
- cwd: /var/lib/ipfs
- watch-in:
- service: ipfs-service
ipfs-set-headers-1:
cmd.run:
- name: ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]'
- runas: ipfs
- cwd: /var/lib/ipfs
- watch-in:
- service: ipfs-service
ipfs-set-headers-2:
cmd.run:
#- name: ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://localhost:8888", "http://127.0.0.1:5001", "https://webui.ipfs.io"]'
- name: ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
- runas: ipfs
- cwd: /var/lib/ipfs
- watch-in:
- service: ipfs-service
ipfs-set-api:
cmd.run:
- name: /usr/local/sbin/ipfs config Addresses.API "/ip4/0.0.0.0/tcp/5001"
- runas: ipfs
- cwd: /var/lib/ipfs
- watch-in:
- service: ipfs-service
ipfs-set-gateway:
cmd.run:
- name: /usr/local/sbin/ipfs config Addresses.Gateway "/ip4/0.0.0.0/tcp/8888"
- runas: ipfs
- cwd: /var/lib/ipfs
- watch-in:
- service: ipfs-service

View File

@ -0,0 +1,9 @@
---
ipfs:
enabled: true
install_dir: /usr/local/apps
release_dir: /usr/local/apps/releases
mirror: https://dl.google.com/go/
version: 1.15.5
os: linux
arch: amd64

View File

@ -1,89 +1,5 @@
--- ---
ipfs-group: include:
group.present: - .install
- name: ipfs - .config
- gid: 899 - .service
ipfs-user:
user.present:
- name: ipfs
- uid: 899
- gid: 899
- home: /var/lib/ipfs
- allow_uid_change: true
- allow_gid_change: true
ipfs-dir:
file.directory:
- name: /var/lib/ipfs
- user: ipfs
- group: ipfs
- mode: 0750
- recurse:
- user
ipfs-init:
cmd.run:
- name: /usr/local/sbin/ipfs init
- runas: ipfs
- cwd: /var/lib/ipfs
- success_retcodes:
- 0
- 1
- watch-in:
- service: ipfs-service
ipfs-set-storagemax:
cmd.run:
- name: /usr/local/sbin/ipfs config Datastore.StorageMax "20GB"
- runas: ipfs
- cwd: /var/lib/ipfs
- watch-in:
- service: ipfs-service
ipfs-set-headers-1:
cmd.run:
- name: ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]'
- runas: ipfs
- cwd: /var/lib/ipfs
- watch-in:
- service: ipfs-service
ipfs-set-headers-2:
cmd.run:
#- name: ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://localhost:8888", "http://127.0.0.1:5001", "https://webui.ipfs.io"]'
- name: ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
- runas: ipfs
- cwd: /var/lib/ipfs
- watch-in:
- service: ipfs-service
ipfs-set-api:
cmd.run:
- name: /usr/local/sbin/ipfs config Addresses.API "/ip4/0.0.0.0/tcp/5001"
- runas: ipfs
- cwd: /var/lib/ipfs
- watch-in:
- service: ipfs-service
ipfs-set-gateway:
cmd.run:
- name: /usr/local/sbin/ipfs config Addresses.Gateway "/ip4/0.0.0.0/tcp/8888"
- runas: ipfs
- cwd: /var/lib/ipfs
- watch-in:
- service: ipfs-service
ipfs-service-file:
file.managed:
- name: /etc/systemd/system/ipfs.service
- source: salt://ipfs/ipfs.service
- watch-in:
- service: ipfs-service
ipfs-service:
service.running:
- name: ipfs
- enable: true
- require:
- file: ipfs-dir

34
states/ipfs/install.sls Normal file
View File

@ -0,0 +1,34 @@
---
ipfs-group:
group.present:
- name: ipfs
- gid: 899
ipfs-user:
user.present:
- name: ipfs
- uid: 899
- gid: 899
- home: /var/lib/ipfs
- allow_uid_change: true
- allow_gid_change: true
ipfs-dir:
file.directory:
- name: /var/lib/ipfs
- user: ipfs
- group: ipfs
- mode: 0750
- recurse:
- user
ipfs-init:
cmd.run:
- name: /usr/local/sbin/ipfs init
- runas: ipfs
- cwd: /var/lib/ipfs
- success_retcodes:
- 0
- 1
- watch-in:
- service: ipfs-service

View File

@ -0,0 +1,12 @@
---
Linux:
os: "linux"
Darwin:
os: "darwin"
FreeBSD:
os: "freebsd"
NetBSD:
os: "netbsd"

14
states/ipfs/map.jinja Normal file
View File

@ -0,0 +1,14 @@
{%- import_yaml "golang/defaults.yaml" as default_settings -%}
{%- import_yaml "golang/kernelmap.yaml" as kernelmap -%}
{%- import_yaml "golang/osarchmap.yaml" as osarchmap -%}
{%- set defaults = salt['grains.filter_by'](default_settings,
default='golang',
merge=salt['grains.filter_by'](osarchmap, grain='osarch',
merge=salt['grains.filter_by'](kernelmap, grain='kernel')
)
)
-%}
{%- set golang = salt['pillar.get']('golang', default=defaults, merge=True) -%}

View File

@ -0,0 +1,21 @@
---
amd64:
arch: "amd64"
x86_64:
arch: "amd64"
386:
arch: "386"
arm64:
arch: "arm64"
armv6l:
arch: "armv6l"
armv7l:
arch: "armv6l"
armhf:
arch: "armv6l"

14
states/ipfs/service.sls Normal file
View File

@ -0,0 +1,14 @@
---
ipfs-service-file:
file.managed:
- name: /etc/systemd/system/ipfs.service
- source: salt://ipfs/ipfs.service
- watch-in:
- service: ipfs-service
ipfs-service:
service.running:
- name: ipfs
- enable: true
- require:
- file: ipfs-dir