Commit Graph

137 Commits

Author SHA1 Message Date
mpl 753bd38ca9 misc/docker/server: build with make.go
So far, when building camlistored docker image for CoreOS, we were not
using make.go, and we were neither running gopherjs nor embedding the
resources (but rather provide the UI resources at their default
filesystem location).

Now that we're using gopherjs for the web UI, it is a hard dependency
for the camlistore server.
We could reproduce the steps in make.go to build gopherjs, run it to
build the web ui resources, and then move the resources at the right
place, but since make.go already does the equivalent work it seems
to make more sense to use it, which is the main point of this CL.

Similarly, it seems to make more sense to now build a binary with the
resources embedded, which is the default make.go behaviour, instead of
building a "raw" camlistored, and provide the resources as additional
directories in the container image, so this CL takes that approach too.

Finally, it was necessary to add the "-static" flag to make.go, so we
can keep on building a static camlistored binary, that does not rely on
libc for DNS. Because our container image is FROM SCRATCH, with just the
necessary binaries, in order to get a container image of a reasonable
size.

One drawback of now using make.go in
misc/docker/server/build-camlistore-server.go is we're doing some
unnecessary (since we're already running in the isolation of a
container) copying to the virtual gopath, but that seems a very tiny
price to pay. Especially considering how rarely we run that code.

Change-Id: I416c86d366cd4ed2d3b8b1636a6a65a83b9f15d7
2017-04-05 02:10:12 +02:00
Steve Armstrong 9e2e35cf6f app/scanningcabinet: move static UI files to folder
Change-Id: I410fbaf0a113732cc2bde319607edab384122678
2017-03-24 21:36:03 -07:00
Mathieu Lonjaret 75424def01 Merge "pkg/server: add files "zipper" to DownloadHandler" 2017-03-17 13:36:40 +00:00
mpl 71090f7c80 pkg/server: add files "zipper" to DownloadHandler
We want to add a feature for clients (the web UI), where they can select
a bunch of files and ask the server for a zip archive of all these files.

This CL modifies the DownloadHandler so it does exactly that upon
reception of a POST request with a query parameter of the form
files=sha1-foo,sha1-bar,sha1-baz

This CL also adds a new button to the contextual sidebar of the web UI,
that takes care of sending the download request to the server.

known limitations: only permanodes with file as camliContent are
accepted as a valid selection (i.e. no sets, or static-dirs, etc) for
now.

Implementation detail:
We're creating an ephemeral DOM form on the fly to send the request.
The reason is: if we sent it as a Go http request, we'd have to read
the response manually and then we'd have no way of writing it to disk.
If we did it with an xhr, we could write the response to disk by
creating a File or Blob and then using URL.createObjectURL(), but we'd
have to keep the response in memory while doing so, which is
unacceptable for large enough archives.

Fixes #899

Change-Id: I104f7c5bd10ab3369e28d33752380dd12b5b3e6b
2017-03-17 00:59:19 +01:00
Steve Armstrong ab86174bc6 app/scanningcabinet: Compile scancab during make.go
Change-Id: Ia44afa903dfce6246d391b5d11a8b1e397f12e0c
2017-03-14 08:35:12 -07:00
mpl ceb5ea5b10 web UI: add "About" menu entry and dialog
This change adds an "About" entry to the header menu, that pops up an
"About" dialog when clicked on.

But, under this innocent sounding feature is actually a more important
change: this feature is partly added through the use of gopherjs
generated code. In addition, the element added (a menu item) is
integrated
seamlessly into the menu as a React element, thanks to the use of
github.com/myitcv/gopherjs/react.

pkg/env had to be broken with build tags, because importing
"cloud.google.com/go/compute/metadata" (or one of its deps) seems to be
breaking the generated javascript.
https://github.com/camlistore/camlistore/issues/904

github.com/myitcv/gopherjs/react at rev
c04b811da4a086defd882a94cc1901da2d2158b0

honnef.co/go/js/dom at rev 24aa052bc5c63cfb9383bf59493ee48621ca788c

Issue #904
Fixes #798

Change-Id: Ic09b94014d520277f8178727293787ece468babd
2017-03-07 00:24:07 +01:00
mpl 0167d40164 vendor: update gopherjs to 1.8-1
rev b9bcb1da229a59cc1e1d168401662cb6450aae08

Also added pkg/misc/fakefsnotify just so we only have to do:
-       "github.com/fsnotify/fsnotify"
+       fsnotify "camlistore.org/pkg/misc/fakefsnotify"
in vendor/github.com/gopherjs/gopherjs/build/build.go
in order to avoid vendoring fsnotify, without having to grossly
patch the gopherjs code as we previously did.

Change-Id: Ic106a6afa1117d2061415355c236433f835895f1
2017-02-18 01:06:58 +01:00
mpl 912af01da2 make.go: make it work for gopherjs again
The default location for the gopherjs go version needed to be adjusted
for when CAMLI_GOPHERJS_GOROOT is not provided.

Change-Id: Ieda2e6dbc002891e977684be50577753f3ae9a7e
2017-02-17 01:17:25 +01:00
mpl c35cd68b5c make.go: switch to Go 1.8
Same with friends under misc/, and travis CI.

Change-Id: Iadf67a81b0eb044684f3acf24415ccf12dc24e96
2017-02-17 00:23:03 +01:00
mpl 5a24ffd854 new app: scanning cabinet
WARNING: this app is still experimental, and even its data schema might
change. Do not use in production.

This change adds a Camlistore-based port of the scanning cabinet app
originally created by Brad Fitzpatrick:
https://github.com/bradfitz/scanningcabinet

Some of it is inspired from the App Engine Go port of Patrick Borgeest:
https://bitbucket.org/pborgeest/nometicland

The data schema is roughly as follows:

-a scan is a permanode, with the node type: "scanningcabinet:scan".
-a scan's camliContent attribute is set to the actual image file.
-a scan also holds the "dateCreated" attribute, as well as the
"document" attribute, which references the document this scan is a part
of (if any).

-a document is a permanode, with the node type: "scanningcabinet:doc".
-a document page, is modeled by the "camliPath:sha1-xxx" = "pageNumber"
relation, where sha1-xxx is the blobRef of a scan.
-a document can also hold the following attributes: "dateCreated",
"tag", "locationText", "title", "startDate", and "paymentDueDate".

Known caveats, in decreasing order of concern:
-the data schema might still change.
-the scancab tool, to actually create and upload the files from physical
documents, is practically untested (since I do not own a scanner).
-some parts, in particular related to searches, are probably
sub-optimized.
-the usual unavoidable bugs.

Change-Id: If6afc509e13f7c21164a3abd276fec075a3813bb
2017-02-15 17:14:45 +01:00
Filippo Valsorda 87b283cde5 make.go: always populate gopherjsGoroot
The change in I7c80976d46ce8d69e394d226c685c8554176ea0f wasn't working
for me.  make.go might be a little smarter by requiring the exact Go
version that it knows the pinned gopherjs needs, instead of just
checking it is not devel, but in any case it seems sensible to always
respect the env var.

Successfully built like this after this patch:

    CAMLI_GOPHERJS_GOROOT=$(go env GOROOT) go1.8rc3 run make.go

Change-Id: I58f398531cd65847b5bf82f9b9d0aa26bbe9b90d
2017-02-04 23:37:21 +00:00
mpl 02548899a8 make.go: increase, and enforce, git rev to 10 chars
Issue #839 suggests to not cut the rev at all, and let it be user
defined. I have no good argument against, but I'm taking the more
conservative approach suggested by others in issue #888.

Fixes #888

Change-Id: Id65b1b074e6646a756353119a12081330775e066
2017-01-30 17:35:33 +01:00
Mathieu Lonjaret e6cb7e372e Merge "make: fix version check for go1.8beta and go1.8rc" 2017-01-19 16:39:30 +00:00
Tamás Gulácsi 6fe477614d make: fix version check for go1.8beta and go1.8rc
CAMLI_GOPHERJS_GOROOT has effect only if verifyGopherjsGoroot is called,
which only happened if go version was "devel".

This CL runs the verifyGopherjsGoroot check for go1.8rc and go1.8beta
versions too.

Change-Id: I7c80976d46ce8d69e394d226c685c8554176ea0f
2017-01-19 17:35:27 +01:00
mpl 3e93b66765 make.go: allow dots in mirrored filenames
Fixes #887

Change-Id: I4274f422b417f1f7fd08fe9eea058974455a8895
2017-01-02 22:28:45 +01:00
mpl e1053362a2 make.go: when running with go tip, use Go 1.7 to build gopherjs
Introduce CAMLI_GOPHERJS_GOROOT to that effect.

Fixes #875

Change-Id: I6f5266bbf8b07be565dc0d47ed18d534715f4d0e
2016-11-28 17:48:44 +01:00
mpl 2c4332ada2 make.go: optionally build camnetdns
server/camnetdns: update to cloud.google.com/go imports.

vendor: add github.com/miekg/dns at rev
3f1f7c8ec9ead89493df11f2c3d8bec353a2c2c0 as a dep of server/camnetdns

Change-Id: Ief8e0ad3e09a6c3511c72a7991309808f855d3df
2016-10-04 01:58:50 +02:00
mpl 10aa2b3fbd make.go: use host GOOS and GOARCH when go generating zsearch.go
Because our go generate line is:
//go:generate go run gensearchtypes.go -out zsearch.go

which will run a binary of gensearchtypes.go built for whatever $GOOS is
set to. Which will fail if $GOOS is different from runtime.GOOS (the
cross-compiling case).

I suppose it means that the day pkg/search becomes GOOS differentiated,
we may have to introduce an -os flag to gensearchtypes.go, since it
calls go doc on camlistore.org/pkg/search, whose output might depend on
GOOS?

Change-Id: I1ea32bb9190300120887ee8614dcdd2d1391a954
2016-09-05 18:40:10 +02:00
mpl 5bc0864f81 Switch to Go1.7
vendoring: update gopherjs to rev
45518c130e5bd1525f20110830a4986365a153de

Patch on upstream to remove fsnotify dep added (for reference) as:
vendor/github.com/gopherjs/gopherjs/nofsnotify.diff

make.go: make Go1.7 the required version

Fixes #838

Change-Id: I2013ee4832a26f8be3a8b42f02e40a347674ec9a
2016-08-30 16:46:07 +02:00
mpl bccc0ff7a1 make.go: do not cross-compile gopherjs
Because it needs to run on the native platform, not the one we
cross-compile to.

Fixes #845

Change-Id: Iffaeab8d02dacecc0c1dd579481219c6a542b1b2
2016-08-27 01:48:04 +02:00
mpl f40cfc78bb make.go: generate search types for app/publisher
Using go:generate to call a shell script with some go doc + sed hackery.
we could probably do it better with go/types later if needed.

Change-Id: Ie1cf04d418b8b498f83f7029eb736dbc779feeb5
2016-07-18 17:05:58 +02:00
mpl 3b2ec3af0f make.go: build and run gopherjs for publisher
Run gopherjs to generate trivial javascript code that is used by the
publisher app.

Context:
https://github.com/camlistore/camlistore/issues/798#issuecomment-226902924

github.com/gopherjs vendored in at rev
f3c437955da554f2643747a598b0cc772a749f3f

PLEASE NOTE that this copy of gopherjs has been modified to avoid
depending on fsnotify. Hence the -w flag and the gopherjs serve command
are most likely broken.
Diff for that modification:
https://gist.github.com/mpl/ac9033bb28207401b7cedc3d74e6c096

Dependencies for building gopherjs:

kardianos/osext 29ae4ffbc9a6fe9fb2bc5029050ce6996ea1d3bc
neelance/sourcemap 8c68805598ab8d5637b1a72b5f7d381ea0f39c31
spf13/cobra c678ff029ee250b65714e518f4f5c5cb934955de
spf13/pflag 7f60f83a2c81bc3c3c0d5297f61ddfa68da9d3b7
golang.org/x/crypto/ssh/terminal
c197bcf24cde29d3f73c7b4ac6fd41f4384e8af6
golang.org/x/tools/go/types/typeutil
ac02106e04bdb66a2db0413d931012bea165d7e0

github.com/gopherjs/jquery vendored in at
fbbfc4bbe29a29cb05788b66be44e0ac7f43cac7

jquery vendored in at 2.2.3

Change-Id: I7ff2d8e43e8a963f5ac1d13a2c936f263f7c53fc
2016-07-13 00:06:20 +02:00
mpl 044c7b32d0 make.go: mirror assembly code too
pkg/fs/fs_test.go depends on bazil.org/fuse/syscallx, which in turn
depends on golang.org/x/sys/unix
We already had the assembly code vendored in for golang.org/x/sys/unix,
but we weren't mirroring it in make.go

This didn't show with 'go run make.go' because it only affects a test.
And it didn't show with 'go test ./pkg/fs' either, because the assembly
would then be found in GOPATH.
Only devcam test would detect it.

Change-Id: Ibb90a5fb986a3d0308ff9f1f8df8d5866cfec8c5
2016-05-10 01:01:48 +02:00
mpl 93a7f46720 make.go: remove --use_gopath
Because it makes full integration with gopherjs impossible (without
polluting the user's GOPATH), as long as
https://github.com/gopherjs/gopherjs/issues/415 is not fixed.

Also it is kind of antithetical with the point of make.go anyway.

We still rely on CAMLI_MAKE_USEGOPATH for the integration tests that run
make.go to know that they shouldn't recursively create another temp
GOPATH (when they're already in such a temp dir, because they're started
through devcam test).

Change-Id: Icc6af46ec5976fdf08e9b8bf4249e307a15499cf
2016-05-09 17:22:39 +02:00
mpl bc4dbb0b5a make.go: just build website with -website
That should make it easier to catch missing dependencies. Because
'go run make.go -website' will ignore whatever's in your GOPATH, and
only use what's in our vendor.

Change-Id: I94648633a9fa69a5742b7e83031dab34470b9cde
2016-04-30 17:29:12 -07:00
Will Norris 7ec2b0ac2e website: update doc URLs
s/docs/doc/ and s/http/https/ for camlistore.org doc URLs in website and
code.

Change-Id: I875e2acece1f594a304f2bdb63f756fcb315abc8
2016-04-27 08:48:50 -07:00
mpl 63d6e384bb path fixes for third_party move
A few more left in in misc/docker that I'll do separately

Related: 75d60962f6

Change-Id: Id5f6a3729e33aca97f8664ca8ef91afc64461891
2016-04-21 12:25:17 -07:00
Brad Fitzpatrick 75d60962f6 Move remaining stuff in third_party/* to vendor/*
Change-Id: Ifbcc02817083cba68d8c1acec3e6ec50e8f61149
2016-04-20 16:49:15 -07:00
mpl fafc3d11de make.go: build for ARM in its own versioned gopath dir
Fixes issues #691 #692

Change-Id: I47dcd1c672c0c810ebe47bce1a6badcedfca139b
2016-03-11 21:47:27 +01:00
mpl d3058bb716 make.go: make GOARM default to 7, fix TODO
Issue #691

Change-Id: I2d0c123cbad8f0ef765b243f66013dd7bc74086d
2016-03-11 18:35:53 +01:00
Mathieu Lonjaret 1d7df7ceb4 Merge "misc/docker: stamp version as well to binaries" 2016-03-11 16:10:23 +00:00
mpl d4bc2d1f35 make.go: add TODO about cross-compiling on ARMvx to ARMvy
Change-Id: I14e39220c5ae83482ca12cfe3b1a08ff3ab2a007
2016-03-11 16:11:31 +01:00
Mathieu Lonjaret 9bcfc91a79 Merge "make.go: Add parameters to allow for ARM cross compiling" 2016-03-11 15:07:08 +00:00
mpl 04437c2e49 make.go: typo
Change-Id: I33e77a340bdb5f94afa7dbaa860b88c5399089e0
2016-03-10 01:00:55 +01:00
Steve Armstrong b879e54502 make.go: Add parameters to allow for ARM cross compiling
Change-Id: I670da8025c651d07039781cace879a84d8489bd7
2016-03-09 09:28:05 -08:00
Mathieu Lonjaret 34d292a6f3 Merge "importer/pinboard: kill World after test" 2016-03-03 14:33:52 +00:00
mpl 33a8eec553 make.go: require Go 1.6
Change-Id: I8ebf1c96795adc22348de36917066bbbbb7b8f06
2016-02-24 17:55:42 +01:00
mpl eb0db1f1ff importer/pinboard: kill World after test
Related: Issue #680

Change-Id: I10a1ffc611d159288b4dc9d52e96524bbb385ee1
2016-02-13 00:46:20 +01:00
mpl 21604dbe56 misc/docker: stamp version as well to binaries
Version in binaries will now be:
"X.Y (git rev xxxxx)"
if X.Y is specified with --tarball_version,
"xxxx"
otherwise.

Also uniformized the flags names and use in other programs.

Fixes #665

Change-Id: I958094f69b279437504854a3ff10e924d42c4fb6
2016-02-09 17:31:29 +01:00
mpl 79199b2fe9 make.go: mirror .pb.go files as well
Change-Id: I27c2fe697bb107dc30dec2ea878213e4c5d3796e
2015-12-29 20:56:56 +01:00
Mathieu Lonjaret 0f4ab197d5 Merge "make.go: restore version stamping" 2015-12-07 22:04:24 +00:00
mpl 6c196c2ddb make.go: restore version stamping
And use new ldflags syntax when doing so.

Also refactor buildinfo.

Context: https://camlistore-review.googlesource.com/5586

Change-Id: I811612f1638656a45f0e574ef00b8ee214187ed8
2015-12-07 22:58:19 +01:00
mpl cf08d789f2 website: sidestep failInTests panics from osutil
Because camweb now depends on pkg/deploy/gce, which has global vars
initialized with calls from osutil.

And test website from devcam test

Change-Id: I233c229e96ded5bfde4e2c1fa7a18bbf757ab1fb
2015-12-07 22:48:12 +01:00
mpl 3e37ca9120 devcam test: build things in ./misc/docker too
Fixes issue #651

Change-Id: I10e4b73946dea073399bdb21888202f85a33c1b7
2015-12-03 16:49:11 +01:00
mpl 11ed82555e make.go: default sqlite to "false" instead of "auto"
Even if sqlite libs are installed on the host, since sqlite as an
indexer seems to be less efficient than kvfile (and way less efficient
than leveldb) for us, we should not build camlistored with it, unless
user-specified.

Related: issue #632 (relevant benchmarks posted there).

Change-Id: I6f87e554ee03ccb8dbbcf4d918971dba715647f4
2015-10-30 19:19:20 +01:00
Mathieu Lonjaret 9a42ac9b91 Merge "make.go: do not make a genfileembed.exe when cross-compiling" 2015-08-19 16:24:04 +00:00
Brad Fitzpatrick 06f7accf31 Require Go 1.5 (due out soon), start move from third_party to vendor.
See https://golang.org/s/go15vendor

This commit moves the google.golang.org/cloud/... packages. The rest
of third_party will move later.

This commit is a dependency for some cloud logging work which we'll
develop in Camlistore's tree.
2015-08-15 22:45:11 +02:00
mpl 20659d45f0 make.go: do not make a genfileembed.exe when cross-compiling
Change-Id: I7c58756a6906c146b7bdff479dcb1b5ab9bd6e32
2015-07-24 17:01:23 +02:00
Brad Fitzpatrick 80d0487a22 make.go: more verbose and add option for whether to stamp the version into the binary
Disabled by default temporarily.

Change-Id: I9f40d881dc6f83088f4086fc06b7ebf345725d92
2015-04-13 20:38:41 +02:00
Brad Fitzpatrick 495256cf6b make.go: remove --docker_mode flag
It's fundamentally flawed: the whole point of building in Docker is to
build in a hermetic environment. You can't mix building some parts in
Docker and some parts not. We'll build it only in Docker when making
release images, never depending on the host configuration.

Change-Id: I5fb283b17489fba18e89398e0d3f425c7f6159cd
2015-04-01 01:54:31 -07:00