Code Monkey home page Code Monkey logo

navio's People

Contributors

iamrajiv avatar pcaderno avatar richecr avatar simonwaldherr avatar u5surf avatar viniciusbds avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

navio's Issues

Allow containers to run in background

What would you like to be added:

Once we are inside the shell (via navio run ubuntu /bin/bash, for example), there should be some way to get out without killing the process

Documentation of exported functions

Document all the source code that contains the [TODO]: Document. Doesn't need document the unexported functions

e.x:

// Execute executes the root command.
// [TODO]: Document this function
func Execute() {
	if err := rootCmd.Execute(); err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
}

Progress

  • assert/assert.go
  • cmd/root.go
  • images/images.go
  • src/containers/containers.go
  • src/logger/logger.go
  • src/util/util.go

Error on ShowDownloadedImages

What happened:

When we move the navio bin to a new directory, a error on navio get images appears: the directory doesn't exists

vinicius_barbosa_silva@experiments:/usr/local/bin$ ./navio get images
[ERROR] 12:33AM --> open ./images: no such file or directory
[ERROR] 12:33AM --> invalid argument

What you expected to happen:

Check if the dir exists and if not is the case, create it

Configure Cgroups

What would you like to be added:

Configure Cgroups to allow the user to limit resources using parameters

  • Memory

  • CPU

  • I/O

  • Process numbers

Add more images

  • Ubuntu Fossa 20.04 LTS
  • Alpine Linux
  • Busybox
  • Arch Linux
  • Debian

And others ...

Fix golangci-lint Errors

run golangci-lint
  Running [/home/runner/golangci-lint-1.32.2-linux-amd64/golangci-lint run --out-format=github-actions --enable goimports] in [] ...
  Error: `naiveSelf` is unused (deadcode)
  Error: `imgTag` is unused (deadcode)
  Error: Error return value of `insForm.Exec` is not checked (errcheck)
  Error: Error return value of `insForm.Exec` is not checked (errcheck)
  Error: Error return value of `insForm.Exec` is not checked (errcheck)
  Error: Error return value of `delForm.Exec` is not checked (errcheck)
  Error: Error return value of `Insert` is not checked (errcheck)
  Error: Error return value of `Remove` is not checked (errcheck)
  Error: Error return value of `Pull` is not checked (errcheck)
  Error: Error return value of `Pull` is not checked (errcheck)
  Error: Error return value of `Pull` is not checked (errcheck)
  Error: Error return value of `RemoveAll` is not checked (errcheck)
  Error: Error return value of `removeContainer` is not checked (errcheck)
  Error: Error return value of `removeContainerDB` is not checked (errcheck)
  Error: Error return value of `CreateContainer` is not checked (errcheck)
  Error: Error return value of `Remove` is not checked (errcheck)
  Error: Error return value of `CreateContainer` is not checked (errcheck)
  Error: Error return value of `CreateContainer` is not checked (errcheck)
  Error: Error return value of `images.PrepareRootFS` is not checked (errcheck)
  Error: Error return value of `updateStatus` is not checked (errcheck)
  Error: Error return value of `updateStatus` is not checked (errcheck)
  Error: Error return value of `os.Mkdir` is not checked (errcheck)
  Error: Error return value of `os.Mkdir` is not checked (errcheck)
  Error: Error return value of `os.Mkdir` is not checked (errcheck)
  Error: Error return value of `Remove` is not checked (errcheck)
  Error: Error return value of `rootCmd.MarkFlagRequired` is not checked (errcheck)
  Error: Error return value of `images.Untar` is not checked (errcheck)
  Error: Error return value of `io.Copy` is not checked (errcheck)
  Error: Error return value of `containers.CreateContainer` is not checked (errcheck)
  Error: Error return value of `containers.Exec` is not checked (errcheck)
  Error: Error return value of `io.Tar` is not checked (errcheck)
  Error: Error return value of `images.Insert` is not checked (errcheck)
  Error: Error return value of `rootCmd.MarkFlagRequired` is not checked (errcheck)
  Error: Error return value of `containers.CreateContainer` is not checked (errcheck)
  Error: Error return value of `containers.Exec` is not checked (errcheck)
  Error: Error return value of `containers.UpdateName` is not checked (errcheck)
  Error: File is not `goimports`-ed (goimports)
  Error: S1008: should use 'return len(strings.TrimSpace(imageName)) == 0' instead of 'if len(strings.TrimSpace(imageName)) == 0 { return true }; return false' (gosimple)
  Error: SA9003: empty branch (staticcheck)
  Error: SA9003: empty branch (staticcheck)
  Error: SA1006: printf-style function with dynamic format string and no further arguments should use print-style function instead (staticcheck)
  Error: SA1006: printf-style function with dynamic format string and no further arguments should use print-style function instead (staticcheck)
  
  Error: issues found
  Ran golangci-lint in 8253ms

Problem on the directory to download images

Problem on the directory to download images

What happened:
The navio pull command download the image in the directory where we run the navio binary.

What you expected to happen:

Is better define a default directory to put these images

Add `golangci-lint`

Description

golangci-lint is a fast Go linters runner. It runs linters in parallel, uses caching, supports yaml config, has integrations with all major IDE, and has dozens of linters included.

References

https://golangci-lint.run/

Bug on container creation

What happened

When we interrupt the create command (with a CTRL + C) while the Navio is downloading a new image, we enter a state of inconsistency. Only a part of the image is downloaded and the system breaks when execute a new container that use the inconsistent image.

example (How to reproduce it)

Screenshot from 2020-07-01 16-28-36

What you expected to happen:

The command should remove the inconsistent image and download it again

Navio get images

Develop a command that list all available images in the /images directory

This command is util after we use the pull command, to see that we have downloaded the image

Improve the images package

Refactore it.

l.Log("INFO", fmt.Sprintf("Downloading %s  from %s ...", file, url))
	wgetCmd := exec.Command("wget", url)
	mkdirCmd := exec.Command("mkdir", "-p", imagePath)
	tarCmd := exec.Command("tar", "-C", imagePath, "-xf", file)
	rmFileCmd := exec.Command("rm", file)

	util.Must(wgetCmd.Run())
	util.Must(mkdirCmd.Run())
	util.Must(tarCmd.Run())
	util.Must(rmFileCmd.Run())

Maybe is better use the os package directly ex.:

os.Mkdir(imagePath)

instead of

exec.Command("mkdir", "-p", imagePath)

Debug the vscode golang project using root privilege

O vscode não consegue testar o seguinte código de teste go.

package logger

import (
	"testing"

	"github.com/viniciusbds/navio/src/container"
)

func TestLog(t *testing.T) {
	result := container.CreateContainer([]string{"run", "ls", ""})
	expected := "oi"

	if result != expected {
		t.Errorf("[ERROR] expected %s, result %s", expected, result)
	}
}

O motivo é que para executar o código do pacote github.com/viniciusbds/navio/src/container é necessário que o usuário tenha permissões de super usuário.

Mensagem de erro

Running tool: /usr/local/go/bin/go test -timeout 30s -coverprofile=/tmp/vscode-go9DQZ83/go-code-cover github.com/viniciusbds/navio/src/logger

ERROR fork/exec ./navio: operation not permitted
FAIL	github.com/viniciusbds/navio/src/logger	0.001s
FAIL
Error: Tests failed.


Networking error

When we run navio run ubuntu /bin/bash the container is create perfectly

Screenshot from 2020-04-28 20-27-49

But there is some bug on the process, because this error appears when we type: apt-get update

Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu focal-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

Navio commands

  • navio ps : mostra todos os containeres, indicando id, nome, status ...

  • navio build . --t [image-name] : gera uma imagem com base no arquivo Naviofile

  • navio run [image-name] [command] [args...]

  • navio pull image [image-name]

  • navio get images #10

  • navio remove image [image-name] #10

  • navio describe image [image-name]

Criar um agente de log com registro nivelado

Criar um agente de log com registro nivelado.

O registro nivelado é um meio de categorizar seus registros para que você possa procurar seus registros para tipos específicos de eventos. Os níveis que vamos colocar no nosso agente de log são:


O nível info, que representa eventos do tipo informação que informam o usuário de uma ação, como Program started ou Email sent. Isso nos ajuda a depurar e rastrear partes do nosso programa para ver se o comportamento esperado está acontecendo.

O nível warning. Esses tipos de eventos identificam quando algo inesperado está acontecendo e que não é um erro, como Email failed to send, retrying. Eles nos ajudam a ver partes do nosso programa que não estão rodando tão bem quanto esperávamos que estivessem.

O nível error , que significa que o programa encontrou um problema, como File not found. Frequentemente, isso resultará na falha da operação do programa.

fonte: https://www.digitalocean.com/community/tutorials/understanding-package-visibility-in-go-pt#visibilidade-dentro-de-m%C3%A9todos

Criar um diagrama com as entidades do sistema

What would you like to be added:
Adicionar um diagrama com todas as entidades do sistema. Ex.: Container, Imagem, etc ...
Why is this needed:
Fará com que novos contribuidores entendam melhor a organização do projeto, para que possam contribuir com o mesmo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.