Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PrivateStorageio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PrivateStorage
PrivateStorageio
Commits
9b2ab301
Commit
9b2ab301
authored
5 years ago
by
Jean-Paul Calderone
Browse files
Options
Downloads
Patches
Plain Diff
[wip] start of a test to get storage, introducer, client speaking
parent
b89a2249
No related branches found
No related tags found
1 merge request
!9
End-to-end system test
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
nixos/modules/private-storage.nix
+12
-1
12 additions, 1 deletion
nixos/modules/private-storage.nix
nixos/modules/tests/private-storage.nix
+118
-13
118 additions, 13 deletions
nixos/modules/tests/private-storage.nix
with
130 additions
and
14 deletions
nixos/modules/private-storage.nix
+
12
−
1
View file @
9b2ab301
...
...
@@ -48,6 +48,14 @@ in
An IPv4 address to advertise for this storage service.
''
;
};
services
.
private-storage
.
introducerFURL
=
lib
.
mkOption
{
default
=
null
;
type
=
lib
.
types
.
null
Or
lib
.
types
.
str
;
example
=
lib
.
literalExample
"pb://<tubid>@<location hint>/<swissnum>"
;
description
=
''
A Tahoe-LAFS introducer node fURL at which this storage node should announce itself.
''
;
};
services
.
private-storage
.
publicStoragePort
=
lib
.
mkOption
{
default
=
8898
;
type
=
lib
.
types
.
int
;
...
...
@@ -78,7 +86,10 @@ in
# We just populate this according to policy/preference of Private
# Storage.
sections
=
{
node
=
{
client
=
if
cfg
.
introducerFURL
==
null
then
{}
else
{
"introducer.furl"
=
cfg
.
introducerFURL
;
};
node
=
# XXX Should try to name that is unique across the grid.
{
nickname
=
"storage"
;
# We have the web port active because the CLI uses it. We may
...
...
This diff is collapsed.
Click to expand it.
nixos/modules/tests/private-storage.nix
+
118
−
13
View file @
9b2ab301
let
pkgs
=
import
<
nixpkgs
>
{
};
# Here are the preconstructed secrets which we can assign to the introducer.
# This is a lot easier than having the introducer generate them and then
# discovering and configuring the other nodes with them.
pemFile
=
pkgs
.
writeTextFile
{
name
=
"node.pem"
;
text
=
''
-----BEGIN CERTIFICATE-----
MIICojCCAYoCAQEwDQYJKoZIhvcNAQELBQAwFzEVMBMGA1UEAwwMbmV3cGJfdGhp
bmd5MB4XDTE5MDkyMDE4NDkzNloXDTIwMDkxOTE4NDkzNlowFzEVMBMGA1UEAwwM
bmV3cGJfdGhpbmd5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1zK4
wH0ZvjFCnFo+PvT/ANBJ2H7pZQDRHFHmhW28VeQ4nCqlifjxJ/MOWpqKYK6rxHOK
DNTDR5MbkFO7l0yquB0/FArP9RErezKakXz8qSLhipDZk7y+0fKWMPxcgdSzm28Z
817Yzp1naXPHQRcno3M3eo58FyoTDAOXP3hiS+bFm8RGVINLSBJtILKoplvgSdyD
/1Xg4zbh2FK+gS0f92jel5JyAaebt3EQPiIxwUrvi5a1w5EQKi13sJ22RK5H6sch
Xg76GMMBCckLs+g8xza5uHLbotMnWb7ddW+pC0SQsrihUxz902lQoUuxq2aJig6o
Ti6wsetUcxtOErfy6wIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQC7ciESyktDoAus
ni6zW30AXnoTxD/LNCf2HMUFcyFF57p5dcaTsAUhUd+aKX/iJyhy6bfgo8GGI5xN
LvhvNQ6Cb6Z9qiCWDvEll+nbfuJNEanEd6bkR06/TX5bK5iDMYZD4Z+SSHsNDNEF
DXJ96zp42UfQTdimxXHmZidAYvtYeLe4EDoJGhpuryEAIUwPdTvsPX+pLfCdtdyP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HhZ0
SEVH2SgChdy7KdPPhxcVhJHqJQKBgQDciwameP0WaazTY77ZRE4Yt+dPyPFkpSer
bibeMmss5d+QVo4B4YEL20CrmaJq+FB9u99nL1d6VsvtWuovvHKMmoM//D8Si7PW
ieAm9mN0L+2Xf25UVFBewQkzNuJJG+z1OtHFfIDDGnNzL2yx//3YFJnR/ehftsK7
lIlXUElzzwKBgGUW1cx1P8lb7k0u1ejtJ/VcpZGCL3A60SewLSezqsLGDgoyK3k7
l8944Nzm/V4gTF66h2COlX5ZDMV819372SrYggH0LuUWfi2pwQwNdPLgfV19JZjn
1aRKQp4DDLc9WDpJ5j0rmH5GTaPbsUaZwL/U1+Y9ehicUsWXa/YfUlWpAoGBAJCZ
7yBTj82UOCbZ7ZZS/MmkOtvLKssMpnf2XzGs6SylA/KFbdK54ny9oydgMmfkrBHk
jtP+7GJgapET3RyzeH/MB2Z6o3grdRyjhf7F6euSSTvd558PMSsPclLMF45L6w/X
IxdTTLGftDa/z4reB7gXucs/qY6oLAIFoA9Jqv9tAoGAIpw4GDw5IQFZhcHuHCOZ
Xrq9L1fR5rYBQa6xcPHkMbWzigcNJz7FnLg0tB1SvF23egpmj5VAcnWyjyj883pn
h2wuwJUFy8LALtjJwqhjUtQfv5LLiT5061/CUrhD3GEBNlYbOO4FA1Z0SIhFYn40
VzowmHAqdxYvlfJsWe91UI0=
-----END PRIVATE KEY-----
''
;
};
tubID
=
"rr7y46ixsg6qmck4jkkc7hke6xe4sv5f"
;
swissnum
=
"2k6p3wrabat5jrj7otcih4cjdema4q3m"
;
introducerPort
=
35151
;
location
=
"tcp:introducer:
${
toString
introducerPort
}
"
;
introducerFURL
=
"pb://
${
tubID
}
@
${
location
}
/
${
swissnum
}
"
;
introducerFURLFile
=
pkgs
.
writeTextFile
{
name
=
"introducer.furl"
;
text
=
introducerFURL
;
};
in
# https://nixos.org/nixos/manual/index.html#sec-nixos-tests
import
<
nixpkgs/nixos/tests/make-test.nix
>
{
nodes
=
rec
{
# Get a machine where we can run a Tahoe-LAFS client node.
client
=
{
config
,
pkgs
,
...
}:
{
environment
.
systemPackages
=
[
pkgs
.
tahoe-lafs
pkgs
.
daemonize
];
};
# Get another machine where we can run a Tahoe-LAFS introducer node. It has the same configuration as the client.
introducer
=
client
;
# Configure a single machine as a PrivateStorage storage node.
machin
e
=
storag
e
=
{
config
,
pkgs
,
...
}:
{
imports
=
[
../private-storage.nix
];
services
.
private-storage
.
enable
=
true
;
services
.
private-storage
.
publicIPv4
=
"storage"
;
services
.
private-storage
.
introducerFURL
=
introducerFURL
;
};
};
# Test the machine with a Perl program (sobbing).
testScript
=
''
# Boot the VM.
$machine->start;
#
# Set up a Tahoe-LAFS introducer.
#
$introducer->start;
$introducer->succeed('tahoe create-introducer --hostname introducer /tmp/introducer');
$introducer->copyFileFromHost('
${
pemFile
}
', '/tmp/introducer/private/node.pem');
$introducer->copyFileFromHost('
${
introducerFURLFile
}
', '/tmp/introducer/private/introducer.furl');
$introducer->succeed('daemonize $(type -p tahoe) run /tmp/introducer');
$introducer->waitForOpenPort(
${
toString
introducerPort
}
);
#
# Get a Tahoe-LAFS storage server up.
#
# Boot the storage VM.
$storage->start;
# The systemd unit should reach the running state.
$
machin
e->waitForUnit(
"
tahoe.storage.service
"
);
$
storag
e->waitForUnit(
'
tahoe.storage.service
'
);
# Some while after that the Tahoe-LAFS node should listen on the web API
# port. The port number here has to agree with the port number set in
# the private-storage.nix module.
$
machin
e->waitForOpenPort(3456);
$
storag
e->waitForOpenPort(3456);
# Once the web API is listening it should be possible to scrape some
# status from the node if it is really working.
$machine->succeed("tahoe -d /var/db/tahoe-lafs/storage status");
$storage->succeed('tahoe -d /var/db/tahoe-lafs/storage status');
#
# Storage appears to be working so try to get a client to speak with it.
#
# Boot another VM.
$client->start;
# Create a Tahoe-LAFS client on it.
$client->succeed('tahoe create-client --shares-needed 1 --shares-happy 1 --shares-total 1 --introducer
${
introducerFURL
}
');
''
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment