Skip to content

clustercrypto/skywire

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Skywire requires a Golang version of 1.16 or higher.

Skywire

Commands and Subcommands

Documentation on skywire-cli interface as well as available flags for skywire-visor

App documentation

Apps are not executed by the user, but hosted by the visor process

further documentation can be found in the skywire wiki

Installing Skywire

Pre-compiled resouces

Build Overview

A high-level overview of the process for building skywire from source and the paths and files which comprise the package-based installation is contained in the PKGBUILD

this and other build variants can be built into a package with a single command, using yay on archlinux

installing skywire-bin will install the release binaries provided by the release section of this repo

yay -S skywire-bin

to build the debian packages using the release binaries

yay --mflags " -p cc.deb.PKGBUILD " -S skywire-bin

installing skywire will compile binaries using the source archive for the latest version release

yay -S skywire

build from git sources to the develop branch

yay --mflags " -p git.PKGBUILD " -S skywire

Dependencies

Runtime Deps

  • glibc or libc6 unless statically compiled

Build Deps

  • golang
  • git (optional)
  • musl and kernel-headers-musl or equivalent - for static compilation

For more information on static compilation, see docs/static-builds.md.

Prepare

The standard procedure for building software with go uses the GOPATH which is conventionally $HOME/go

Software sources are cloned via git to a path such as $HOME/go/src/github.com/skycoin/skywire

Optionally, the source archive of a versioned release is downloaded from the release section

The binaries which are compiled may optionally be placed in the GOBIN and then GOBIN may be added to the PATH in order that any binaries placed in the GOBIN will then appear as commands available to execute in the shell or terminal.

basic setup of go is further described here

Such a setup is optional, but it is documented below, and other examples will refer to this

mkdir -p "${HOME}/go/src/github.com/skycoin/" "${HOME}"/go/bin "${HOME}"/go/apps || true
cd "${HOME}/go/src/src/github.com/skycoin/"
git clone https://github.com/skycoin/skywire
#optionally checkout any branch
git checkout develop

Build

the code below is a rough approximation of make install which is used in the build function of the skywire packages

export GOPATH="${HOME}/go"
export GOBIN="${GOPATH}/bin"
export _GOAPPS="${GOPATH}/apps"
export GOOS=linux
#use musl-gcc for static compilation
export CC=musl-gcc

cd "${HOME}/go/src/github.com/skycoin/skywire"

#binary versioning
local _version=$(make version)
DMSG_BASE="github.com/skycoin/dmsg"
BUILDINFO_PATH="${DMSG_BASE}/buildinfo"
BUILDINFO_VERSION="${BUILDINFO_PATH}.version=${_version}"
BUILDINFO="${BUILDINFO_VERSION} ${BUILDINFO_DATE} ${BUILDINFO_COMMIT}"

#create the skywire binaries
_pkggopath=github.com/skycoin/skywire
cd "${HOME}"/go/src/${_pkggopath}
_cmddir="${HOME}"/go/src/${_pkggopath}/cmd
cd "${_cmddir}"/apps
_app="$(ls)"
for _i in ${_app}; do
echo "building ${_i} binary"
cd "${_cmddir}/apps/${_i}"
go build -trimpath --ldflags="" --ldflags "${BUILDINFO} -s -w -linkmode external -extldflags '-static' -buildid=" -o $_GOAPPS .
done
echo "building skywire-visor binary"
cd "${_cmddir}"/skywire-visor
go build -trimpath --ldflags="" --ldflags "${BUILDINFO} -s -w -linkmode external -extldflags '-static' -buildid=" -o $GOBIN .
echo "building skywire-cli binary"
cd "${_cmddir}"/skywire-cli
go build -trimpath --ldflags="" --ldflags "${BUILDINFO} -s -w -linkmode external -extldflags '-static' -buildid=" -o $GOBIN .

Install

The installation paths for the skywire as present in the skywire package are detailed below

Note that make install-system-linux will place the binaries into the system where the package would install them, and is best used for quickly testing changes to ensure they work with the autoconfig script included with the package

#to install directly into the system, use "/"
_pkgdir="/"

#use the appropriate systemd unit installation path for your linux distribution (i.e./etc/systemd/system on .deb distros
_systemddir="usr/lib/systemd/system"

#the base path where skywire is installed
_dir="opt/skywire"

#application binaries ; started by the visor process
_apps="${_dir}/apps"

#main binaries go here
_bin="${_dir}/bin"

#scripts included
_scripts="${_dir}/scripts"

#create the directories
mkdir -p "${_pkgdir}/usr/bin"
mkdir -p "${_pkgdir}/${_dir}/bin"
mkdir -p "${_pkgdir}/${_dir}/apps"
mkdir -p "${_pkgdir}/${_dir}/scripts"
mkdir -p "${_pkgdir}/${_systemddir}"
#the local folder is otherwise produced by the visor on startup
mkdir -p "${_pkgdir}/${_dir}/local"

# instal binaries - assumes nothing else was already in your GOBIN
 install -Dm755 "${GOBIN}"/* "${_pkgdir}/${_skybin}/"

#Symlink the binaries into the executable path
for _i in "${_pkgdir}/${_skybin}"/* ; do
	ln -rTsf "${_i}" "${_pkgdir}/usr/bin/${_i##*/}"
done

#install the app binaries
install -Dm755 "${_GOAPPS}"/* "${_pkgdir}/${_skyapps}/"
#it is not necessary to symlink these binaries to the executable path but may be useful for debugging
for _i in "${_pkgdir}/${_skyapps}"/* ; do
	ln -rTsf "${_i}" "${_pkgdir}/usr/bin/${_i##*/}"
done

#install the dmsghttp-config.json'
install -Dm644 "${HOME}"/go/src/${_pkggopath}/skywire/dmsghttp-config.json" "${_pkgdir}/${_skydir}/dmsghttp-config.json"

Desktop integration, maintenance scripts, and systemd service files are included in the skywire package from the skywire AUR which is managed as a subtree from github.com/skycoin/aur

${srcdir} in the code below is in reference to the directory containing these other source files

#Install scripts
install -Dm755 "${srcdir}"/skywire-autoconfig "${_pkgdir}/${_skyscripts}/"
ln -rTsf "${_pkgdir}/${_skyscripts}/skywire-autoconfig" "${_pkgdir}"/usr/bin/skywire-autoconfig

#Installing systemd services'
install -Dm644 "${srcdir}"/*.service "${_pkgdir}/${_systemddir}/"

# instal desktop files and icons
mkdir -p "${_pkgdir}"/usr/share/applications/ "${_pkgdir}"/usr/share/icons/hicolor/48x48/apps/
install -Dm644 "${srcdir}"/*.desktop "${_pkgdir}"/usr/share/applications/
install -Dm644 "${srcdir}"/*.png "${_pkgdir}"/usr/share/icons/hicolor/48x48/apps/

Skywire-autoconfig

skywire-autoconfig is a script is provided with the package which is executed as part of the postinstall process. It serves as a utility for automating:

  • config management and updates
  • setting remote hypervisors
  • restarting the skywire process (via systemd)
  • printing helpful text for the user to know what is happening
  • generating configuration on boot (for skybian images / chroot installations of skywire)
  • detecting environmental variables

for more information regarding this script and the skywire package installation, refer to this wiki article

Package tree

/
├── opt
│   └── skywire
│       ├── apps
│       │   ├── skychat
│       │   ├── skysocks
│       │   ├── skysocks-client
│       │   ├── vpn-client
│       │   └── vpn-server
│       ├── bin
│       │   ├── skywire-cli
│       │   └── skywire-visor
│       ├── dmsghttp-config.json
│       ├── local
│       └── scripts
│           └── skywire-autoconfig
└── usr
    ├── bin
    │   ├── skychat -> ../../opt/skywire/apps/skychat
    │   ├── skysocks -> ../../opt/skywire/apps/skysocks
    │   ├── skysocks-client -> ../../opt/skywire/apps/skysocks-client
    │   ├── skywire -> ../../opt/skywire/bin/skywire-visor
    │   ├── skywire-autoconfig -> ../../opt/skywire/scripts/skywire-autoconfig
    │   ├── skywire-cli -> ../../opt/skywire/bin/skywire-cli
    │   ├── skywire-visor -> ../../opt/skywire/bin/skywire-visor
    │   ├── vpn-client -> ../../opt/skywire/apps/vpn-client
    │   └── vpn-server -> ../../opt/skywire/apps/vpn-server
    ├── lib
    │   └── systemd
    │       └── system
    │           ├── skywire-autoconfig.service
    │           ├── skywire.service
    └── share
        ├── applications
        │   ├── skywire.desktop
        │   └── skywirevpn.desktop
        └── icons
            └── hicolor
                └── 48x48
                    └── apps
                        ├── skywire.png
                        └── skywirevpn.png

17 directories, 24 files

Build with make

build the binaries and apps with go build

make build

output tree

├──skywire-cli
└─┬skywire-visor
  └─┬apps
    ├──skychat
    ├──skysocks
    ├──skysocks-client
    ├──vpn-client
    ├──vpn-server
    └──skychat

install these executables to the GOPATH

make install

Build docker image

$ ./ci_scripts/docker-push.sh -t $(git rev-parse --abbrev-ref HEAD) -b

Run from source

Running from source as outlined here does not write the config to disk or explicitly compile any binaries. The config is piped from skywire-cli stdout to the visor stdin, and all are executed via go run.

 mkdir -p $HOME/go/src/github.com/skycoin && cd $HOME/go/src/github.com/skycoin
 git clone https://github.com/skycoin/skywire.git
 cd skywire
 make run-source

Files and folders created by skywire

├──skywire-config.json
└─┬local
  ├──skychat
  ├──skysocks
  ├──apps-pid.txt
  ├──skychat_log.db
  ├──reward.txt
  ├──node-info.json
  └─┬transport_logs
    └──2022-11-12.csv

Some of these files are served via the dmsghttp logserver

Configure Skywire

The skywire visor requires a config to run. This config is produced by skywire-cli config gen

The skywire-autoconfig script included with the skywire package handles config generation and updates for the user

Examples of config generation and command / flag documentation can be found in the cmd/skywire-cli/README.md and cmd/skywire-visor/README.md

The most important flags are noted below

Expose hypervisorUI

In order to expose the hypervisor UI, generate a config file with --is-hypervisor or -i flag:

 skywire-cli config gen -i

Docker container will create config automatically for you, should you want to run it manually, you can do:

 docker run --rm -v <YOUR_CONFIG_DIR>:/opt/skywire \
  skycoin/skywire:test skywire-cli config gen -i

Docker container will create config automatically for you, should you want to run it manually, you can do:

$ docker run --rm -v <YOUR_CONFIG_DIR>:/opt/skywire \
  skycoin/skywire:latest skywire-cli visor gen-config --is-hypervisor

After starting up the visor, the UI will be exposed by default on localhost:8000.

Add remote hypervisor

Every visor can be controlled by one or more hypervisors. To allow a hypervisor to access a visor, the PubKey of the hypervisor needs to be specified in the configuration file. You can add a remote hypervisor to the config with:

skywire-cli config update --hypervisor-pks <public-key>

or

skywire-cli config gen --hvpk <public-key>

alternatively, this can be done with the skywire-autoconfg script

skywire-autoconfig <public-key>

Or from docker image:

docker run --rm -v <YOUR_CONFIG_DIR>:/opt/skywire \
  skycoin/skywire:test skywire-cli config update hypervisor-pks <public-key>

Or from docker image:/* #nosec */

docker run --rm -v <YOUR_CONFIG_DIR>:/opt/skywire \
  skycoin/skywire:latest skywire-cli update-config hypervisor-pks <public-key>

Run skywire-visor

skywire-visor hosts apps and is an applications gateway to the Skywire network.

skywire-visor requires a valid configuration to be provided. If you want to run a VPN client locally, run the visor as sudo.

 sudo skywire-visor -c skywire-config.json

if the default skywire-config.json exists in the current dir, this can be shortened to

 sudo skywire-visor

Or from docker image:

# with custom config mounted on docker volume
docker run --rm -p 8000:8000 -v <YOUR_CONFIG_DIR>:/opt/skywire --name=skywire skycoin/skywire:test skywire-visor -c /opt/skywire/<YOUR_CONFIG_NAME>.json
# without custom config (config is automatically generated)
docker run --rm -p 8000:8000 --name=skywire skycoin/skywire:test skywire-visor

skywire-visor can be run on Windows. The setup requires additional setup steps that are specified in the docs.

Using Skywire forwarding for publishing http server over skynet

The skywire-cli subcommand skywire-cli fwd is used to register and connect to http servers over the skynet

Using the Skywire VPN

If you are interested in running the Skywire VPN as either a client or a server, please refer to the following guides:

Creating a GitHub release

To maintain actual skywire-visor state on users' Skywire nodes we have a mechanism for updating skywire-visor binaries. Binaries for each version are uploaded to GitHub releases. We use goreleaser for creating them.

How to create a GitHub release

  1. Make sure that git and goreleaser are installed.
  2. Checkout to a commit you would like to create a release against.
  3. Run go mod vendor and go mod tidy.
  4. Make sure that git status is in clean state. Commit all vendor changes and source code changes.
  5. Uncomment draft: true in .goreleaser.yml if this is a test release.
  6. Create a git tag with desired release version and release name: git tag -a 0.1.0 -m "First release", where 0.1.0 is release version and First release is release name.
  7. Push the created tag to the repository: git push origin 0.1.0, where 0.1.0 is release version.
  8. ̶I̶s̶s̶u̶e̶ ̶a̶ ̶p̶e̶r̶s̶o̶n̶a̶l̶ ̶G̶i̶t̶H̶u̶b̶ ̶a̶c̶c̶e̶s̶s̶ ̶t̶o̶k̶e̶n̶.̶
  9. ̶R̶u̶n̶ ̶̶G̶I̶T̶H̶U̶B̶_̶T̶O̶K̶E̶N̶=̶y̶o̶u̶r̶_̶t̶o̶k̶e̶n̶ ̶m̶a̶k̶e̶ ̶g̶i̶t̶h̶u̶b̶-̶r̶e̶l̶e̶a̶s̶e̶̶
  10. Check the created GitHub release.

About

Skywire Node implementation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 55.4%
  • TypeScript 27.5%
  • HTML 9.7%
  • SCSS 3.7%
  • JavaScript 1.4%
  • Shell 1.0%
  • Other 1.3%