Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc cleanup #327

Merged
merged 9 commits into from
Apr 17, 2020
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ builds:
archives:
- format: tar.gz
wrap_in_directory: false
name_template: 'skywire-v{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
name_template: 'skywire-v{{ .Version }}-{{ .Os }}-{{ .Arch }}'
checksum:
name_template: 'checksums.txt'
snapshot:
Expand Down
26 changes: 18 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,32 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
## 0.2.1 - 2020.04.07

### Changed

- reverted port changes for `skysocks-client`

## 0.2.0 - 2020.04.02

### Added

- Retry logic to messaging server for messaging client.
- added `--retain-keys` flag to `skywire-cli visor gen-config` command
- added `--secret-key` flag to `skywire-cli visor gen-config` command
- added hypervisorUI frontend
- added default values for visor if certain fields of config are empty

### Fixed

- Fixed channel collision for messaging clients.
- fixed deployment route finder HTTP request
- fixed /user endpoint not working when auth is disabled

### Changed

- Improve readability of Skywire CLI output.

## 0.1.0 - 2019.03.04
- changed port of hypervisorUI and applications
- replaced unix sockets for app to visor communication to tcp sockets
- reverted asynchronous sending of router packets

### Added
## 0.1.0 - 2020.04.02

- First release of the mainnet Skywire visor and apps for testing.
First release of Skywire Mainnet.
9 changes: 0 additions & 9 deletions CONTRIBUTING.md

This file was deleted.

2 changes: 1 addition & 1 deletion cmd/hypervisor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Endpoints are documented in the provided [Postman](https://www.getpostman.com/)

## Web UI

UI is served on the same port as the API (`:8000` by default). Directory to search for the build frontend is passed in the `web_dir` field of the hypervisor's config.
UI is served on the same port as the API (`:8000` by default).

### Authentication information

Expand Down
1 change: 1 addition & 0 deletions mainnet_rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Different locations are required due to the fact that we want to spread out the
## Rewards
<br>

* During the migration period, the pool sizes of the ending Skywire testnet and the recently launched Skywire mainnet are one and the same. With that said, the generated uptime in either the Skywire test- or mainnet are being added together with respect to the 75% uptime requirement.
* Eligible for rewards are only the whitelisted nodes, that **comply with the Skywire mainnet rules** and **meet the 75% uptime requirement** during the month.
* The whitelist is being **updated retroactively on a monthly basis** so it is **not important** in which week you are being approved for the whitelist.
* **Official Skyminers are whitelisted by default after purchase.**
Expand Down
4 changes: 3 additions & 1 deletion pkg/util/pathutil/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"io/ioutil"
"os"
"path/filepath"

"github.com/SkycoinProject/skywire-mainnet/pkg/util/rename"
)

const (
Expand Down Expand Up @@ -43,7 +45,7 @@ func AtomicWriteFile(filename string, data []byte) error {
return err
}

if err := os.Rename(tempFilePath, filename); err != nil {
if err := rename.Rename(tempFilePath, filename); err != nil {
return err
}

Expand Down
73 changes: 73 additions & 0 deletions pkg/util/rename/rename.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package rename

import (
"fmt"
"io"
"log"
"os"
)

const crossDeviceError = "invalid cross-device link"

// Rename renames (moves) oldPath to newPath using os.Rename.
// If paths are located on different drives or filesystems, os.Rename fails.
// In that case, Rename uses a workaround by copying oldPath to newPath and removing oldPath thereafter.
func Rename(oldPath, newPath string) error {
if err := os.Rename(oldPath, newPath); err == nil || err.Error() != crossDeviceError {
return err
}

stat, err := os.Stat(oldPath)
if err != nil {
return fmt.Errorf("stat: %w", err)
}

if !stat.Mode().IsRegular() {
return fmt.Errorf("is regular: %w", err)
}

// Paths are located on different devices.
if err := move(oldPath, newPath); err != nil {
return fmt.Errorf("move: %w", err)
}

if err := os.Chmod(newPath, stat.Mode()); err != nil {
return fmt.Errorf("chmod: %w", err)
}

if err := os.Remove(oldPath); err != nil {
return fmt.Errorf("remove: %w", err)
}

return nil
}

func move(oldPath string, newPath string) error {
inputFile, err := os.Open(oldPath) // nolint:gosec
if err != nil {
return fmt.Errorf("open: %w", err)
}

defer func() {
if err := inputFile.Close(); err != nil {
log.Printf("Failed to close file %q: %v", inputFile.Name(), err)
}
}()

outputFile, err := os.Create(newPath)
if err != nil {
return fmt.Errorf("create: %w", err)
}

defer func() {
if err := outputFile.Close(); err != nil {
log.Printf("Failed to close file %q: %v", outputFile.Name(), err)
}
}()

if _, err = io.Copy(outputFile, inputFile); err != nil {
return fmt.Errorf("copy: %w", err)
}

return nil
}
11 changes: 6 additions & 5 deletions pkg/util/updater/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (

"github.com/SkycoinProject/skywire-mainnet/pkg/restart"
"github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo"
"github.com/SkycoinProject/skywire-mainnet/pkg/util/rename"
)

const (
Expand Down Expand Up @@ -180,13 +181,13 @@ func (u *Updater) updateBinary(downloadedBinariesPath, basePath, binary string)
}
}

if err := os.Rename(currentBinaryPath, oldBinaryPath); err != nil {
if err := rename.Rename(currentBinaryPath, oldBinaryPath); err != nil {
return fmt.Errorf("rename %s to %s: %w", currentBinaryPath, oldBinaryPath, err)
}

if err := os.Rename(downloadedBinaryPath, currentBinaryPath); err != nil {
// Try to revert previous os.Rename
if err := os.Rename(oldBinaryPath, currentBinaryPath); err != nil {
if err := rename.Rename(downloadedBinaryPath, currentBinaryPath); err != nil {
// Try to revert previous rename.
if err := rename.Rename(oldBinaryPath, currentBinaryPath); err != nil {
u.log.Errorf("Failed to rename file %q to %q: %v", oldBinaryPath, currentBinaryPath, err)
}

Expand All @@ -201,7 +202,7 @@ func (u *Updater) updateBinary(downloadedBinariesPath, basePath, binary string)
func (u *Updater) restore(currentBinaryPath string, toBeRemoved string) {
u.removeFiles(currentBinaryPath)

if err := os.Rename(toBeRemoved, currentBinaryPath); err != nil {
if err := rename.Rename(toBeRemoved, currentBinaryPath); err != nil {
u.log.Errorf("Failed to rename file %q to %q: %v", toBeRemoved, currentBinaryPath, err)
}
}
Expand Down
6 changes: 2 additions & 4 deletions static/skywire-manager-src/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Skywire Manager

Frontend application that allows to manage a group of Skywire nodes through a Hypervisor instance.

Note: The software is still under heavy development and the current version is intended for public testing purposes only.
Frontend application that allows to manage a group of Skywire visors through a Hypervisor instance.

## Prerequisites

Expand Down Expand Up @@ -38,7 +36,7 @@ change any of the source files.

## Build

Run `npm run build` to build the project. The build artifacts will be stored in the `dist/` directory.
Run `make build-ui` in the top directory of this repo to rebuild the UI. The build artifacts will be stored in the `dist/` directory.

## Translations

Expand Down