qmsk / e2

E2 Client, Tally output
Mozilla Public License 2.0
26 stars 7 forks source link

setting up golang, npm and bower #5

Closed dougthebug closed 8 years ago

dougthebug commented 8 years ago

I had some issues getting my environment set up. I'd like to see some form of these instructions included in the readme, as I believe the audience for this project are not typical developers, but video engineers. My hope is that by making this software more accessible, it will be adopted and extended to a greater degree by the community.

Installing golang and qmsk/e2

These instructions are assuming you are using a Raspberry Pi. As far as I know these instructions apply to all hardware revisions.

The following software is required to be installed and configured on a Raspberry Pi to use qmsk/e2:

  1. git - the version control software that qmsk/e2 is maintained with
  2. go - the go programming language, or golang, is the platform qmsk/e2 is written in
  3. bower - does all the web front end stuff
  4. npm - node package manager provides bower
  5. ssh - the secure shell provides remote access to configure your system from another device without having to attach a keyboard or mouse to your Pi
  6. PiBakery - A simple tool for creating customized boot disks for your raspberry pi. At some point most of these instructions could be included in a 'recipe' for PiBakery

Begin by downloading and installing PiBakery (or skip this step if you know what you're doing) from http://www.pibakery.org and create a boot image. You will need about seven gigabytes of disk space. Use PiBakery to enable ssh on boot, change the password or configure an IP address, although I wont describe that here.

Boot your Pi and connect to it over the network. There are a number of tools to discover the IP address of the new device if you did not use PiBakery to assign a static IP address. I will not describe that here. From the terminal of your laptop or desktop computer, connect to your Pi using ssh like this:

ssh pi@192.168.1.25

The first time you connect to the Pi you will be asked to add the ssh 'fingerprint' to a list kept on your computer.
Type 'yes' and then enter the password you set with PiBakery or the default, which is 'raspberry'

The first step, which is not described in the qmsk/e2 readme file is to install go. You can use any version greater than 1.3, which is unfortunately what is included with the stock Raspberry Pi system. To install go (or golang, as it's referred to) visit https://golang.org/doc/install and read up. The short story is to download the precomplied binary for the ARM architecture that the Pi uses and make some directories and save some setting to your .profile file. This is the hardest part. Currently, version 1.7 is the latest, so grab the file at https://storage.googleapis.com/golang/go1.7.1.linux-armv6l.tar.gz by typing the following into your command line after logging in to the Pi:

pi@raspberrypi:~ $ wget https://storage.googleapis.com/golang/go1.7.1.linux-armv6l.tar.gz

which looks like this:

pi@raspberrypi:~ $ wget https://storage.googleapis.com/golang/go1.7.1.linux-armv6l.tar.gz --2016-09-12 15:28:44-- https://storage.googleapis.com/golang/go1.7.1.linux-armv6l.tar.gz Resolving storage.googleapis.com (storage.googleapis.com)... 216.58.192.16, 2607:f8b0:4005:805::2010 Connecting to storage.googleapis.com (storage.googleapis.com)|216.58.192.16|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 69522921 (66M) [application/x-gzip] Saving to: ‘go1.7.1.linux-armv6l.tar.gz’

.7.1.linux-armv6l.t 19%[===> ] 12.92M 2.47MB/s eta 23s

When this is done you will have to install this file to a system directory with the following command:

pi@raspberrypi:~ $ sudo tar -C /usr/local -xzf go1.7.1.linux-armv6l.tar.gz

Which extracts the files to where they belong. Now you have to tell the system that this stuff is there by editing some files. From the golang installation instructions:

(Typically these commands must be run as root or through sudo.)

Add /usr/local/go/bin to the PATH environment variable. You can do this by adding this line to your /etc/profile (for a system-wide installation) or $HOME/.profile:

export PATH=$PATH:/usr/local/go/bin

You will also need a local workspace to install the source files for qmsk/e2. Add the line:

export GOPATH=$HOME/work

Then save that file using your favorite text editor. After you edit and save this file, force the system to read it again by using the source command, i.e.

pi@raspberrypi:~ $ source .profile

Just type the part after the $ or whatever your shell's prompt is.

Be sure to actually create this folder:

pi@raspberrypi:~ $ mkdir work

I highly recommend following the golang tutorial and compiling the hello, world example before continuing.

Now move into the work directory and create another folder, src, and move into it like this:

pi@raspberrypi:~ $ cd work pi@raspberrypi:~/work $ mkdir src pi@raspberrypi:~/work $ cd src pi@raspberrypi:~/work/src $

Now we're back to the original readme file. Install qmsk/e2 with:

git clone https://github.com/qmsk/e2.git

and then cd into the e2 directory and run the go get command from the readme:

go get ./cmd/tally go get ./cmd/server

which looks like:

pi@raspberrypi:~/work/src $ git clone https://github.com/qmsk/e2.git Cloning into 'e2'... remote: Counting objects: 2608, done. remote: Total 2608 (delta 0), reused 0 (delta 0), pack-reused 2608 Receiving objects: 100% (2608/2608), 2.07 MiB | 657.00 KiB/s, done. Resolving deltas: 100% (1527/1527), done. Checking connectivity... done. pi@raspberrypi:~/work/src $ cd e2 pi@raspberrypi:~/work/src/e2 $ go get ./cmd/tally pi@raspberrypi:~/work/src/e2 $ go get ./cmd/server

Now lets install npm and then we'll install bower with npm. This will take a minute.

sudo apt-get install npm

Whose output looks like this:

pi@raspberrypi:~/work/src/e2 $ sudo apt-get install npm Reading package lists... Done Building dependency tree
Reading state information... Done The following extra packages will be installed: gyp libc-ares-dev libjs-node-uuid libjs-underscore libssl-dev libssl-doc libv8-3.14-dev node-abbrev node-ansi node-ansi-color-table node-archy node-async node-block-stream node-combined-stream node-cookie-jar node-delayed-stream node-forever-agent node-form-data node-fstream node-fstream-ignore node-github-url-from-git node-glob node-graceful-fs node-gyp node-inherits node-ini node-json-stringify-safe node-lockfile node-lru-cache node-mime node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt node-normalize-package-data node-npmlog node-once node-osenv node-qs node-read node-read-package-json node-request node-retry node-rimraf node-semver node-sha node-sigmund node-slide node-tar node-tunnel-agent node-underscore node-which nodejs-dev Suggested packages: node-hawk node-aws-sign node-oauth-sign node-http-signature The following NEW packages will be installed: gyp libc-ares-dev libjs-node-uuid libjs-underscore libssl-dev libssl-doc libv8-3.14-dev node-abbrev node-ansi node-ansi-color-table node-archy node-async node-block-stream node-combined-stream node-cookie-jar node-delayed-stream node-forever-agent node-form-data node-fstream node-fstream-ignore node-github-url-from-git node-glob node-graceful-fs node-gyp node-inherits node-ini node-json-stringify-safe node-lockfile node-lru-cache node-mime node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt node-normalize-package-data node-npmlog node-once node-osenv node-qs node-read node-read-package-json node-request node-retry node-rimraf node-semver node-sha node-sigmund node-slide node-tar node-tunnel-agent node-underscore node-which nodejs-dev npm 0 upgraded, 55 newly installed, 0 to remove and 0 not upgraded. Need to get 3,709 kB of archives. After this operation, 13.3 MB of additional disk space will be used. Do you want to continue? [Y/n]

You should probably update your available packages with

sudo apt-get update

before running the above command.

After your coffee has cooled, install bower by typing

sudo npm install -g bower

which will look like:

pi@raspberrypi:~/work/src/e2 $ sudo npm install -g bower /usr/local/bin/bower -> /usr/local/lib/node_modules/bower/bin/bower bower@1.7.9 /usr/local/lib/node_modules/bower pi@raspberrypi:~/work/src/e2 $

Now change directory into static and install bower there like this:

cd static && bower install

Now go back to the original readme and continue from there, knowing you have everything installed!

SpComb commented 8 years ago

Thank you for writing up these installation steps! I took the liberty to transcribe them into the wiki, with some additional formatting: https://github.com/qmsk/e2/wiki

Feel free to further edit them there.

And as per installation instructions in general, here's my thoughts:

SpComb commented 8 years ago

Updated the README with a wiki link, support issues with the "question" label.

Tracking the need for release builds in #6

dougthebug commented 8 years ago

Thank you!

I wasn’t sure how exactly to do this. At first I forked the project and made these notes in my own fork, but then realized that no one else would see them (i think). Then I created this as an issue in the master, which looked to be the best choice.

I’m still wrapping my head around github, and I’ll take a look at drone.

I’m really excited to get this up and running. The functionality you’ve implemented here is huge!

After I posted this I realized I missed a step, and when I tried to run the command to install client I got:

pi@raspberrypi:~/work/src/e2 $ go get ./cmd/client

e2/cmd/client

cmd/client/aux_list.go:15: options.ClientOptions.Client undefined (type client.Options has no field or method Client) cmd/client/list_destinations.go:15: options.ClientOptions.Client undefined (type client.Options has no field or method Client) cmd/client/preset_list.go:15: options.ClientOptions.Client undefined (type client.Options has no field or method Client) cmd/client/preset_show.go:17: options.ClientOptions.Client undefined (type client.Options has no field or method Client) cmd/client/screen_list.go:15: options.ClientOptions.Client undefined (type client.Options has no field or method Client) cmd/client/screen_show.go:17: options.ClientOptions.Client undefined (type client.Options has no field or method Client) cmd/client/source_list.go:15: options.ClientOptions.Client undefined (type client.Options has no field or method Client)

I can post this as an issue if the answer isn’t totally obvious to you right away.

Thanks again, I look forward to contributing to this project and to getting back into programming.

On Sep 12, 2016, at 10:42 AM, Tero Marttila notifications@github.com wrote:

Thank you for writing up these installation steps! I took the liberty to transcribe them into the wiki, with some additional formatting: https://github.com/qmsk/e2/wiki https://github.com/qmsk/e2/wiki Feel free to further edit them there.

And as per installation instructions in general, here's my thoughts:

The README should cover any E2 specifics related to development and some basic usage. General bits like "how to SSH to your PI", "how to build Go binaries", "how to install bower" etc. are best covered elsewhere, and I suppose the github Wiki is as good a place as any for that.

I updated the README with the Go 1.4 requirement.

There should be versioned releases with automated builds of release binaries. Users shouldn't need to install development tools like Go or NPM/Bower.

I have some manually built binaries at http://users.qmsk.net/~terom/qmsk-e2/dist/ http://users.qmsk.net/%7Eterom/qmsk-e2/dist/ , but this is something that should be automated via some CI system like https://github.com/drone/drone x-msg://12/drone.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/qmsk/e2/issues/5#issuecomment-246429756, or mute the thread https://github.com/notifications/unsubscribe-auth/AHJoOYoOqJULjazQg2S5ZIYu2w0ZIvmkks5qpY8ZgaJpZM4J60Su.