+++ title = "Quick Start" weight = 10 sort_by = "weight" template = "documentation.html" +++ Let's start your Garage journey! In this chapter, we explain how to deploy Garage as a single-node server and how to interact with it. ## What is Garage? Before jumping in, you might be interested in reading the following pages: - [Goals and use cases](@/documentation/design/goals.md) - [List of features](@/documentation/reference-manual/features.md) ## Scope of this tutorial Our goal is to introduce you to Garage's workflows. Following this guide is recommended before moving on to [configuring a multi-node cluster](@/documentation/cookbook/real-world.md). Note that this kind of deployment should not be used in production, as it provides no redundancy for your data! ## Get a binary Download the latest Garage binary from the release pages on our repository: Place this binary somewhere in your `$PATH` so that you can invoke the `garage` command directly (for instance you can copy the binary in `/usr/local/bin` or in `~/.local/bin`). You may also check whether your distribution already includes a [binary package for Garage](@/documentation/cookbook/binary-packages.md). If a binary of the last version is not available for your architecture, or if you want a build customized for your system, you can [build Garage from source](@/documentation/cookbook/from-source.md). If none of these option work for you, you can also run Garage in a Docker container. For simplicity, a minimal command to launch Garage using Docker is provided in this quick start guide. We recommend reading the tutorial on [configuring a multi-node cluster](@/documentation/cookbook/real-world.md) to learn about the full Docker workflow for Garage. ## Configuring and starting Garage ### Generating a first configuration file This first configuration file should allow you to get started easily with the simplest possible Garage deployment. We will create it with the following command line to generate unique and private secrets for security reasons: ```bash cat > garage.toml < ~/.awsrc <=1.29.0` or `>=2.13.0`, otherwise you need to specify `--endpoint-url` explicitly on each `awscli` invocation. Now, each time you want to use `awscli` on this target, run: ```bash source ~/.awsrc ``` *You can create multiple files with different names if you have multiple Garage clusters or different keys. Switching from one cluster to another is as simple as sourcing the right file.* ### Example usage of `awscli` ```bash # list buckets aws s3 ls # list objects of a bucket aws s3 ls s3://default-bucket # copy from your filesystem to garage aws s3 cp /proc/cpuinfo s3://default-bucket/cpuinfo.txt # copy from garage to your filesystem aws s3 cp s3://default-bucket/cpuinfo.txt /tmp/cpuinfo.txt ``` Note that you can use `awscli` for more advanced operations like creating a bucket, pre-signing a request or managing your website. [Read the full documentation to know more](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/index.html). Some features are however not implemented like ACL or policy. Check [our S3 compatibility list](@/documentation/reference-manual/s3-compatibility.md). ### Other tools for interacting with Garage The following tools can also be used to send and receive files from/to Garage: - [minio-client](@/documentation/connect/cli.md#minio-client) - [s3cmd](@/documentation/connect/cli.md#s3cmd) - [rclone](@/documentation/connect/cli.md#rclone) - [Cyberduck](@/documentation/connect/cli.md#cyberduck) - [WinSCP](@/documentation/connect/cli.md#winscp) An exhaustive list is maintained in the ["Integrations" > "Browsing tools" section](@/documentation/connect/_index.md). ## Manual configuration This section provides instructions that are equivalent to using the `--single-node` and `--default-bucket` flags for automatic configuration. If you are using an older version of Garage (before v2.3.0), you must follow these instructions as automatic configuration is not available. We will have to run quite a few `garage` administration commands to get started. If you ever get lost, don't forget that the `help` command and the `--help` flags can help you anywhere, the CLI tool is self-documented! Two examples: ``` garage help garage bucket allow --help ``` ### Configuring the `garage` CLI Remember that the `garage` CLI needs to know the path of your `garage.toml` configuration file. If it is not in the default location of `/etc/garage.toml`, you can specify it either: - by setting the `GARAGE_CONFIG_FILE` environment variable; - by adding the `-c` flag to each `garage` command, for example: `garage -c ./garage.toml status`. If you are running Garage in a Docker container, you can set the following alias to provide a fake `garage`command that uses the Garage binary inside your container: ```bash alias garage="docker exec -ti /garage" ``` You can test that your `garage` CLI is configured correctly by running a basic command such as `garage status`. ### Creating a cluster layout When you first start a cluster without automatic configuration, the output of `garage status` will look as follows: ``` ==== HEALTHY NODES ==== ID Hostname Address Tags Zone Capacity DataAvail Version 563e1ac825ee3323 linuxbox 127.0.0.1:3901 NO ROLE ASSIGNED v2.3.0 ``` Creating a cluster layout for a Garage deployment means informing Garage of the disk space available on each node of the cluster using the `-c` flag, as well as the name of the zone (e.g. datacenter) each machine is located in using the `-z` flag. For our test deployment, we are have only one node with zone named `dc1` and a capacity of `1G`, though the capacity is ignored for a single node deployment and can be changed later when adding new nodes. ```bash garage layout assign -z dc1 -c 1G ``` where `` corresponds to the identifier of the node shown by `garage status` (first column). You can enter simply a prefix of that identifier. For instance here you could write just `garage layout assign -z dc1 -c 1G 563e`. The layout then has to be applied to the cluster, using: ```bash garage layout apply --version 1 ``` ### Creating buckets and keys Let's take an example where we want to deploy NextCloud using Garage as the main data storage. We will suppose that we want to create a bucket named `nextcloud-bucket` that will be accessed through a key named `nextcloud-app-key`. #### Create a bucket First, create the bucket with the following command: ``` garage bucket create nextcloud-bucket ``` Check that the bucket was created properly: ``` garage bucket list garage bucket info nextcloud-bucket ``` #### Create an API key The `nextcloud-bucket` bucket now exists on the Garage server, however it cannot be accessed until we add an API key with the proper access rights. Note that API keys are independent of buckets: one key can access multiple buckets, multiple keys can access one bucket. Create an API key using the following command: ``` garage key create nextcloud-app-key ``` The output should look as follows: ``` Key name: nextcloud-app-key Key ID: GK3515373e4c851ebaad366558 Secret key: 7d37d093435a41f2aab8f13c19ba067d9776c90215f56614adad6ece597dbb34 Authorized buckets: ``` Check that the key was created properly: ``` garage key list garage key info nextcloud-app-key ``` #### Allow a key to access a bucket Now that we have a bucket and a key, we need to give permissions to the key on the bucket: ``` garage bucket allow \ --read \ --write \ --owner \ nextcloud-bucket \ --key nextcloud-app-key ``` You can check at any time the allowed keys on your bucket with: ``` garage bucket info nextcloud-bucket ``` You should now be able to read and write objects to the bucket using the credentials created above.