Skip to content

Commit 068973d

Browse files
committed
feat(cookbook): add Flox Catalog Store setup cookbook
1 parent c626694 commit 068973d

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

Diff for: docs/cookbook/infrastructure/flox-store.md

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
title: Create Your Catalog Store
3+
description: Create a Catalog Store for publishing your own Flox packages
4+
---
5+
6+
# Setting up a Catalog Store
7+
8+
Publishing your own software to your organization's Flox Catalog requires some
9+
initial setup, but the process is relatively straightforward. Flox supports
10+
publishing packages to a Catalog Store, which will exist in an AWS S3 bucket
11+
that is managed by your organization. In order to use this bucket to store
12+
binaries, you will need to set ingress and egress URIs on the catalog using
13+
a utility published by Flox. Then, all you need to do to publish built software
14+
is to call `flox publish` with an optional `--signing-key` argument, and Flox
15+
will take care of the rest.
16+
17+
## Configure an AWS S3 Bucket
18+
19+
The first step in setting up your Catalog Store is creation and configuration of
20+
an AWS S3 Bucket. There are numerous ways to accomplish this, including the AWS
21+
Console, the AWS CLI, and Terraform (or another infrastructure-as-code tool),
22+
to name a few. These processes are well documented, but to get started,
23+
it's best to refer directly to AWS documentation.
24+
25+
- [What is Amazon S3?][amazon-s3]{:target="\_blank"}
26+
- [AWS S3 CLI Reference][aws-cli-reference-s3]{:target="\_blank"}
27+
- [Amazon Simple Storage Service API Reference][aws-s3-api-reference]{:target="\_blank"}
28+
29+
Once your S3 bucket is set up and configured with the access policies deemed
30+
necessary by your organization's internal policies, you're ready to proceed to
31+
the next step; however, Flox can help you if you run into trouble during the
32+
setup process. Simply reach out to your designated point of contact, and we'll
33+
work with you to get you up and running.
34+
35+
[amazon-s3]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/Welcome.html
36+
[aws-cli-reference-s3]: https://docs.aws.amazon.com/cli/latest/reference/s3/
37+
[aws-s3-api-reference]: https://docs.aws.amazon.com/AmazonS3/latest/API/Welcome.html
38+
39+
## Ensure the `nix daemon` Has Access to the S3 Bucket
40+
41+
As you probably know by now, the underlying technology powering Flox is Nix.
42+
Accordingly, we need to take a couple steps to ensure that the `nix daemon`
43+
has access to the S3 bucket you've just created. To do so,
44+
you have a couple of options:
45+
46+
1. Set `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and, if applicable, `AWS_SESSION_TOKEN`
47+
as environment variables
48+
1. Use the `aws configure` command provided,
49+
[as described in the CLI reference][aws-cli-configure-command]{:target="\_blank"},
50+
to set those same values
51+
52+
If you follow the second set of steps, you can confirm that everything is set
53+
up correctly by inspecting the values stored in `$HOME/.aws/credentials`.
54+
55+
[aws-cli-configure-command]: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/configure/index.html#configure
56+
57+
## Set Catalog Store Ingress and Egress URIs
58+
59+
Once you have your S3 bucket configured, the next step is to set an ingress URI
60+
and egress URI for your Catalog Store. Flox provides a utility for you
61+
that does exactly what you need, within a Flox environment. To use this,
62+
you'll need to run the following command:
63+
64+
```sh
65+
flox activate -r flox/flox-catalog-util
66+
```
67+
68+
When you run this command, you'll see the following output:
69+
70+
```console
71+
✅ You are now using the environment 'flox/flox-catalog-util (remote)'.
72+
To stop using this environment, type 'exit'
73+
```
74+
75+
Within the active Flox environment, you can simply run the following command:
76+
77+
```sh
78+
catalog-util store --catalog "<my-catalog-name>" set --store-config '{ "store-type": "nix-copy", "ingress_uri": "s3://<my-bucket>", "egress_uri": "s3://<my-bucket>" }'
79+
```
80+
81+
You'll note that it's possible to set the ingress and egress URIs to the same
82+
value, if you wish to do so.
83+
84+
## Set Signing Key When Publishing Your Package
85+
86+
At this point, you should have an appropriately Catalog Store to which you can
87+
publish your own software via the `flox publish` command. The last thing you
88+
need to worry about is configuring a signing key for publishing packages:
89+
90+
```sh
91+
flox config --set publish.signing_key "</path/to/signing-key>"
92+
```
93+
Now you're ready to use Flox publish your own software to the Catalog Store
94+
that you just set up.

0 commit comments

Comments
 (0)