Commit Graph

175 Commits

Author SHA1 Message Date
Brad Fitzpatrick fb71bb3a5d pkg/server{,init}: delete more remnants of long-deleted setup wizard (take 2)
This is a redo of the previously-reverted b663eacb06 but with
tests fixed this time. (I accidentally ran them earlier with
--exec=true from an earlier refactor.)

Signed-off-by: Brad Fitzpatrick <brad@danga.com>
2024-01-14 19:44:43 -08:00
Brad Fitzpatrick 6746b8cd2b Revert "pkg/server: delete more remnants of long-deleted setup wizard"
This reverts commit b663eacb06.

Reason: broke tests I didn't notice (facepalm). Will redo this
completely while fixing tests later.
2024-01-14 17:05:59 -08:00
Brad Fitzpatrick b663eacb06 pkg/server: delete more remnants of long-deleted setup wizard
Signed-off-by: Brad Fitzpatrick <brad@danga.com>
2024-01-14 16:40:37 -08:00
Julien Bisconti acd5a5dab3 test: replace usage of GoPackagePath with PkSourceRoot 2024-01-14 09:45:59 -08:00
Brad Fitzpatrick 0caf36bc9c Remove CamliNetIP, camnetdns, gpgchallenge
These were all part of an earlier effort to let it be easy for people
to easily deploy their own Perkeep servers and get them on the
internet. The idea was that we'd run a small DNS server which would
map from GPG public keys to their rented cloud IPs which users would
prove to us with the gpgchallenge stuff.

The recently added Tailscale support (see 43f34e5cc5, #1668) makes
most of this redundant.

Also I'd stopped running this infrastructure ages ago and removed the
launcher code recently in b5823a65b9 (and disabled it in
c9f78d02ad). So this was all basically dead code.

Signed-off-by: Brad Fitzpatrick <brad@danga.com>
2024-01-02 13:33:57 -08:00
Brad Fitzpatrick 43f34e5cc5 auth, webserver, serverinit: add Tailscale tsnet support
Updates #1668

Co-authored-by: Will Norris <will@willnorris.com>
Signed-off-by: Brad Fitzpatrick <brad@danga.com>
2024-01-02 12:58:44 -08:00
Brad Fitzpatrick b5823a65b9 pkg/deploy/gce: remove GCE deploy support
We used to have a web-based Perkeep launcher at perkeep.org/launch
that created a GCE-based Perkeep instance for users, where they pay
Google for compute time. (One of those "one click deploy" template things)

Unfortunately, Google broke their APIs for doing the third party VM
creations and we disabled it some years ago. But the code remains. And
now, updating it again, we find that they've broken it again:

   Error: pkg/deploy/gce/deploy.go:358:4: servicemanagement.NewServicesService(s).Enable undefined (type *servicemanagement.ServicesService has no field or method Enable)

It's not worth fighting Google's API breakages. Just remove the GCE
launcher support as it's been unused for years.

We can always resurrect this code from git if really needed. But a
Digital Ocean or Fly launcher would probably be much easier.

Signed-off-by: Brad Fitzpatrick <brad@danga.com>
2023-12-30 12:47:01 -08:00
Oleksandr Redko 63c68c6c5b tests: use T.Setenv instead of os.Setenv 2023-02-18 12:53:16 +02:00
Oleksandr Redko 001c417e73
all: replace deprecated io/ioutil with io and os (#1647) 2023-01-23 10:25:14 -08:00
Michael Hoffmann f06efdb51f misc: remove sha1 from tests, remove testhooks, minor cleanups 2023-01-13 07:58:19 -08:00
kalidor 81682f009a Fixing tests:
* Adding 'vendor' argument to generate configuration.
* Update json testcases
2022-06-17 07:34:44 -07:00
kalidor eed05eef5b B2 configuration line build s3 config 2022-06-17 07:34:44 -07:00
Michael Hoffmann de11d99fb4
deps: use modernc.org/kv and bump modernc.org/fileutil to latest master to fix arm64 runtime errors (#1600) 2022-04-01 08:51:26 -04:00
Tamás Gulácsi c986ee3c62
Use modernc.org/sqlite (#1581)
* Use modernc.org/sqlite

This way it can be enabled by default, as it is a cgo-free, Go-only package.
No need for build tags, conditional compilation (whether libsqlite3-dev is installed).

* make.go: Remove unused -sqlite flag

* Remove use of -sqlite flag
2021-12-27 12:18:08 -08:00
aviau c9bb3f4df8 pk-put+perkeepd config: support fingerprints
- Key ids in the `0xXXXXXXXXXXXXXXXX` format are now accepted.

- Key ids in the `02A6 ACA0 5F16 9329 D94A  FFB8 C804 D0BA 9F70 883D`
  format are also accepted. With or without spaces.

- Help texts now use long keyids so that its clear that we support
  them.
2021-01-23 19:27:23 -05:00
aviau e2a6f3bc44 genconfig: support blobpacked in cloud replicas
Cloud-backed storage currently does not use blobpacked
if they are a replica. This causes issues if they become
the main storage.

Example use case where this would cause issues:
 - Create a configuration with s3, blobPath, and packRelated.
 - Add objects
 - Remove blobPath
 - `pk list`
 - All blobs are gone because the s3-only config uses blobpacked
   but the s3 replica was not.
2021-01-14 20:40:02 -05:00
Angel 3dbb01138f pkg/importer: add "instapaper" importer for Instapaper service
A working importer for the Instapaper service. The importer imports
bookmarks, full text articles, and highlights. A blob item handler for
Instapaper highlight permanodes is included to show summarized highlight
content from the server UI.

Also, this CL updates github.com/garyburd.com/go-auth to rev
bca2e7f09a178fd36b034107a00e2323bca6a82e in order to get support for
XAuth requests.

Fixes #1208

Change-Id: I72e0c40b245c7eec4a44bb475fcaa96a0ee9a1c5
2018-11-26 07:57:08 -05:00
mpl 7f17c0483f pkg/serverinit: call readFields on GCE too
Fixes #1193

Change-Id: Ic82af5ec94e010d5d0d4d63df814daf4ad9e0542
2018-06-19 18:28:33 +02:00
Stephen Searles a462466f37 perkeepd: added --keep-going flag to start after index/recovery errors
In order to facilitate manual recovery in severe scenarios, the
--keep-going flag will make the server come back online even when there
are index or recovery errors. This will allow further querying on the
unhealthy server to identify missing data or to extract data for
migration to a new/healthy instance.

Fixes #1166

Change-Id: I4153905757d9e7d8014780dd5660a862cb8ba1ab
2018-05-18 22:29:12 -04:00
Brad Fitzpatrick 41ed0359e1 client, serverinit: fix tests from API change in earlier change
I forgot to fix these as part of 8e71a705d.

Fixes #1171

Change-Id: I22402dfad36bc26fc598b760ab4514cee71e1e38
2018-05-18 09:48:17 -07:00
Brad Fitzpatrick 05d5ea0ab0 Merge "pkg/serverinit: remove reindex parameter to InstallHandlers" 2018-05-18 02:53:14 +00:00
Brad Fitzpatrick cd5413ff54 pkg/serverinit: revert change that enabled https if cert or key was specified
My previous commit (f3f38f0c76) made a change that https became true
if httpsCert or httpsKey was enabled. This broke devcam server, which
always sets the cert+key fields in config/dev-server-config.json but
always set "https" to either true or false.

Instead, make it an error to omit "https" if the cert or key is
specified. (It's still currently legal to specify https==false but
specify a cert or key files, so devcam server now works, but it's not
clear that that's a good idea. I might revisit this later when I
update dev-server-config.json to the upcoming TOML format.)

Fixes #1168

Change-Id: I29d000c5eb9472cc901fbd4cb91159a6c293570e
2018-05-15 09:14:18 -07:00
Brad Fitzpatrick 8e71a705db pkg/serverinit: remove reindex parameter to InstallHandlers
Push it down into the index.

Change-Id: I327bfcbc314b652d5f24a457e1b62b138a187db5
2018-05-14 23:13:32 -04:00
Brad Fitzpatrick 89ee36e9ec pkg/serverinit: make receiver names consistent
c is good for a config.

Change-Id: I89fe738e3c3b26cb26e471d37d55c24284fc5d2c
2018-05-13 18:48:30 -07:00
Brad Fitzpatrick 1dff48c6e3 Stop using the legacy variable name "conn" for http.ResponseWriter values.
They were named conn because nearly 8 years ago the pre-ResponseWriter
type was named *http.Conn:

    https://golang.org/doc/devel/weekly.html#2010-09-29

Time to modernize.

Change-Id: I68d1a5f16dfa6fc2e7a1f863e5d9edb7308527dc
2018-05-13 18:48:12 -07:00
Brad Fitzpatrick f3f38f0c76 perkeepd, serverinit, gce: opaque-ify serverinit.Config, trim camlistored.go
This change has two major parts, which were interwoven enough to do
them in one change:

1) make serverinit.Config fully opaque, in prep for TOML configs #1134

2) shrink the massive server/perkeepd/camlistored.go file. It was out
   of control and had a bunch of code that better belonged
   elsewhere. This change moves a few hundred lines of code from
   camlistored.go into more logical places: internal/osutil/gce for
   GCE stuff, serverinit for config stuff (KeyRingAndId), etc.

I also added a TODO to make it possible to compile perkeepd without
any GCE stuff, which I saw as a possible and worthy goal only after
moving everything away.

Updates #1134

Change-Id: Iea6f84c5aca9c70b97806f4a201ec35e0f630e3b
2018-05-13 15:50:10 -07:00
Brad Fitzpatrick aef92f7e14 pkg/serverinit: start making serverinit.Config representation more opaque
Updates #1134

Change-Id: I56fa1c565c267dad0e1ca69f7d36338828ac954e
2018-05-13 11:16:18 -07:00
mpl b76a4f6727 internal/osutil: revert to using "test safe" func for identitySecretRing
And while we're at it, rename said func (CamliConfigDir) to
PerkeepConfigDir.

Fixes #1161

Change-Id: Ia8c9b5826046437b77c8e16ee91912e31ad319a3
2018-05-12 02:12:03 +02:00
Brad Fitzpatrick 245bb63fff osutil: fix Windows use old Camlistore-named APPDATA directory
Fixes #1150

Change-Id: Ia2843437abbaba96e936c1c0f46bf8b171a2e28e
2018-05-07 20:52:13 -07:00
Brad Fitzpatrick 3d5c28511f Log instead of panicking in HTTP handler on GET to /index/ (no Fetcher)
And change two Camlistore instances to Perkeep.

Change-Id: Id515480ecdc0c997e1700204d63ef4cc6a8c8cc4
2018-04-27 13:29:01 -07:00
Brad Fitzpatrick ca76a40bbc Rename camlistored to perkeepd.
Updates #981

Change-Id: I8fe43c240c149074c23128a89ab426af9cbf94b4
2018-04-21 11:06:09 -07:00
Brad Fitzpatrick b0401489f1 serverinit: add some more comments
Change-Id: Ieddb7d47f2ad0e5873af434e174ca9687d0df6e3
2018-03-22 22:15:43 -07:00
mpl f964148bbe pkg/serverinit: force long GPG identity when generating low-level conf
The index and search pkg now rely on the GPG identity to be in the long
form (16 chars). But the server configuration historically was using the
short form (8 chars).

This change therefore forces the GPG identity ending up in the generated
low-level config to be in the long form.

Also, fix the functions in pkg/jsonsign to generate the long form as well,
to ease the consistent use of it everywhere else.

Fixes #1047

Change-Id: I1333150316caa2c5e179dde0c92b850a362ad17e
2018-02-20 17:30:05 +01:00
Mathieu Lonjaret 4d65ed951b Merge "pkg/search: start to make funcs use a GPG key ID instead of blobRef" 2018-02-06 23:57:16 +00:00
mpl b89bf256d1 pkg/search: start to make funcs use a GPG key ID instead of blobRef
Introduction of an Owner type  in pkg/index.
Related changes in pkg/index and pkg/serverinit.

Fixes #1047

Change-Id: Ifc316865833349d5202b5085e8f2c1235f3f2220
2018-02-07 00:54:38 +01:00
Paul Lindner 84b2c6b3e4 all: various lint fixes
- correct logging that logged functions instead of their value
- use ID vs Id naming
- use correct function names in comments

Change-Id: I61562cef7ebac7337ec6c85312cdf7915cb1a84b
2018-02-05 11:59:00 -08:00
Paul Lindner 459c75410e all: more renaming of Camlistore to Perkeep
Change-Id: I118e3cbcf20d80afeffc84f001388c4556f21628
2018-01-30 03:02:56 -08:00
Brad Fitzpatrick 194d4f9443 blobserver, all: add contexts to ReceiveBlob, Fetch & million resulting deps
I had intended for this to be a small change.

I was going to just add context.Context to the BlobReceiver interface,
but then I saw blob.Fetcher could also use one, so I decided to do two
in one CL.

And then it got a bit infectious and ended up touching everything.

I ended up doing SubFetch in the process by necessity.

At a certain point I finally started using context.TODO() in a few
spots, but not too many. But removing context.TODO() will come in the
future. There are more blob storage interfaces lacking context, too,
like RemoveBlobs.

Updates #733

Change-Id: Idf273180b3f8e397ac5929c6d7f520ccc5cdce08
2018-01-18 16:22:16 -08:00
Brad Fitzpatrick 38f10a7bd0 all, testhooks: use sha224 by default, add hook for some tests to use sha-1
Remove the blob.SHA{1,224}From{Bytes,String} constructors too. No
longer used. This adds blob.RefFromBytes which was missing. We had
blob.RefFromString. Now everything uses blob.RefFrom* instead of
specifying a hash function.

Some tests set a flag to force use of SHA-1 because there was too much
golden data to update. We can remove those one-by-one over time as we
fix up tests.

Updates #537

Change-Id: Ibe6428089a6221594c2b751f53f98b03b5a28dc2
2018-01-09 20:03:38 -08:00
Paul Lindner 67ad77491c pkg/serverinit: improve error message to help people find config file with errors
Change-Id: I5a09a50a1fbdaea0f83dc9a586c65b83e0160f53
2018-01-09 23:12:37 +00:00
mpl 7ea897cd84 pkg/serverinit: keep DBNames compatibility for existing GCE instances
followup of 7eda9fd502

We want existing Perkeep instances on GCE to be able to keep on running
with their DBNames-style existing databases.

To that end, we introduce the "perkeep-config-version" metadata key,
which will be set by the launcher from now on.

When perkeep configuration starts, it can lookup that key. If it is set,
it means we're in a newly created instance, and we don't need to care
about DBNames compatibility. If not, we modify the low level
configuration on the fly, so that it keeps on using the old DBNames
values that were set for a GCE instance.

Change-Id: I611811fdb9c68777c2ba799e9047d00ec0bae040
2018-01-05 21:52:42 +01:00
mpl 7eda9fd502 pkg/serverinit: remove DBNames and provide consistent default instead
DBNames is supposed to provide configuration for the various databases
names. However,
1) I contend that nobody needs or wants to configure them as long as we
provide sane defaults.
2) it seems the only obvious user we have for this is to set up some of
the names on GCE.
3) having another external source for names complicates the code
further, especially when we already have the distinction between
database names for DBMS and file names for file-based databases.
4) writing a correct documentation for it is awkward.

Therefore, in this CL, I propose that we remove DBNames. Instead,
genconfig.go now sets some consistent default names for the various
queues and indexes set up on a DBMS (MySQL, PostGres, Mongo). To that
end, we introduce the new, but optional, DBUnique configuration
parameter, that is used as a part of all the database names, in order to
be able to run several Perkeep instances on the same DBMS, without name
conflicts.

In addition, the queue for the bs->index synchandler is now set up on
the same DBMS that is already in use for the index itself, instead of
using a file-base database.
And i think we could proceed likewise for the other queues.

Fixes #951

Change-Id: Ib6a638f088a563d881e3957e4042e932382b44f4
2018-01-04 04:01:34 +01:00
Brad Fitzpatrick 57648c6b83 all: update copyright holder from Google Inc to The Perkeep Authors
The AUTHORS file is the list of copyright holders.
2018-01-03 16:52:49 -08:00
Brad Fitzpatrick 8a0a3e8649 Rename camdeploy to pk-deploy.
Updates #981

Change-Id: I4c6c16135f3239bb4b8d2d187e9537a4abf7a3fe
2018-01-02 22:10:37 -08:00
Brad Fitzpatrick c3d05cdce9 Move more packages out of pkg/ and into internal/
Moved hashutil, httputil, osutil, netutil,
images, media, magic, video, and rollsum.
2018-01-02 21:03:30 -08:00
Brad Fitzpatrick d6a0b05df0 Rename import paths from camlistore.org to perkeep.org.
Part of the project renaming, issue #981.

After this, users will need to mv their $GOPATH/src/camlistore.org to
$GOPATH/src/perkeep.org. Sorry.

This doesn't yet rename the tools like camlistored, camput, camget,
camtool, etc.

Also, this only moves the lru package to internal. More will move to
internal later.

Also, this doesn't yet remove the "/pkg/" directory. That'll likely
happen later.

This updates some docs, but not all.

devcam test now passes again, even with Go 1.10 (which requires vet
checks are clean too). So a bunch of vet tests are fixed in this CL
too, and a bunch of other broken tests are now fixed (introduced from
the past week of merging the CL backlog).

Change-Id: If580db1691b5b99f8ed6195070789b1f44877dd4
2018-01-01 16:03:34 -08:00
Brad Fitzpatrick 9ca28d644b Merge "pkg/serverinit: on GCE, reset name if instance name is in camlistore.net" 2017-12-31 02:04:05 +00:00
Paul Lindner 7ae6e00368 pkg/serverinit/testdata: fix tests broken by changing error message for golint
Change-Id: Id48a2ebaed056e50f1ac6b34c4869b07590d55d3
2017-12-13 11:33:30 -08:00
Paul Lindner 15feaeb24c all: lint fixes for 'error strings should not be capitalized or end with punctuation or a newline'
Change-Id: I9c3766a51ac8be694ae76befff4b6fa9a85e34eb
2017-12-11 06:13:25 -08:00
mpl 28bc007676 pkg/serverinit: add low-level config generation for Backblaze B2
Fixes #971

Change-Id: Iba944e3597009b18a380007b72fba5127e9a1698
2017-10-26 19:59:01 +02:00