Code Monkey home page Code Monkey logo

snapweb's Introduction

Build Status Coverage Status

Building

Prerequisites

This assumes you have a working go environment with a GOPATH env var setup, and nodejs and npm installed:

sudo apt install nodejs-legacy npm snapcraft bzr

Install global npm modules without sudo:

cat > ~/.npmrc <<-EOF
root = $HOME/node/lib/node_modules
prefix = $HOME/node
binroot = $HOME/node/bin
manroot = $HOME/node/man
EOF

Setup the environment:

mkdir ~/node
export PATH=$PATH:$HOME/node/bin:$GOPATH/bin
export NODE_PATH=$HOME/node/lib/node_modules

Branch:

mkdir -p $GOPATH/src/github.com/snapcore
cd $GOPATH/src/github.com/snapcore
git clone [email protected]:snapcore/snapweb.git
cd snapweb

Install:

# this script does a npm install using yarn and fixes some extra issues
# with dependencies
./scripts/npm-install.sh
./scripts/get-go-deps.sh

Building

cd $GOPATH/src/github.com/snapcore/snapweb
# omit the architecture specified below ('amd64') to build for all architectures at once
./build.sh amd64

Installing

Once you have a snap built locally, you can test it on your system by doing:

 snap install snapweb_<version>.snap --dangerous

The --dangerous flag is necessary for installing locally built snaps, which have not been signed by the store.

Using

Connect to the Snapweb interface with this URL: [http://localhost:4200/]

Snapweb will automatically redirect to HTTPS on port 4201, using a self-signed certificate.

Warning : if testing snapweb inside a VM with redirected ports, be sure to connect directly to the HTTPS socket, as the HTTP redirect won't work.

For example, starting a VM with:

 kvm -m 768 -redir :8022::22 -redir :8201::4201 -hda snappy.img

Point the browser directly to [https://localhost:8201]

Note that in all cases you will now need an access token to use snapweb. Depending on where you installed the snap package (locally or in a vm) run the following command (possibly via ssh in the case of a vm):

 sudo snapweb.generate-token

Then copy/paste the token in the Web UI when requested.

API

/api/v2/packages/

To install a package:

 curl -H "Content-Type: application/json" -d '{"package":"xkcd-webserver"}' http://localhost:4200/api/v2/packages/

To uninstall a package:

curl -X DELETE http://localhost:4200/api/v2/packages/xkcd-webserver

To list packages:

 curl http://localhost:4200/api/v2/packages/

To get a specific package:

 curl http://localhost:4200/api/v2/packages/xkcd-webserver

Dependencies handling

To generate dependencies.tsv you need godeps, so

go get launchpad.net/godeps

To obtain the correct dependencies for the project, run:

godeps -t -u dependencies.tsv

If the dependencies need updating

godeps -t ./... > dependencies.tsv

snapweb's People

Contributors

alexandreabreu avatar anthonydillon avatar barrymcgee avatar bartaz avatar bpierre avatar chipaca avatar come-maiz avatar didrocks avatar iahmad9 avatar lool avatar marcustomlinson avatar mvo5 avatar sergiusens avatar stevenwilkin avatar

Stargazers

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

Watchers

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

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.