From 79c47d072d15bf5ded4c8317abbb87b54f080b17 Mon Sep 17 00:00:00 2001 From: Samuel Littley Date: Mon, 25 Jan 2021 21:48:13 +0000 Subject: Add instruction doc for maintainers (#40) * Minor README updates and added some docs for maintainers * Add a reference to the build-arch-gce AUR package --- README.md | 59 ++++++++++++++++++++------------------------ maintaining.md | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 32 deletions(-) create mode 100644 maintaining.md diff --git a/README.md b/README.md index 2b4e1c3..6aa36ee 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,7 @@ Arch Linux installation are the following: resizing. - An additional Pacman repository is used to install and keep the [Linux Guest Environment](https://aur.archlinux.org/packages/google-compute-engine/) and - [growpart](https://aur.archlinux.org/packages/growpart/) packages up to date. - + [growpartfs](https://aur.archlinux.org/packages/growpartfs/) packages up to date. ## Prebuilt Images @@ -54,42 +53,41 @@ $ gcloud compute instances create INSTANCE_NAME \ --image-project=arch-linux-gce --image-family=arch ``` - ## Build Your Own Image You can build the Arch Linux image yourself with the following procedure: -1. Make sure you have required dependencies installed: +1. Install the required dependencies and build the image - ```console - $ sudo pacman -S arch-install-scripts e2fsprogs - ``` + ```console + $ sudo pacman -S --needed arch-install-scripts e2fsprogs + $ git clone https://github.com/GoogleCloudPlatform/compute-archlinux-image-builder.git + $ cd compute-archlinux-image-builder + $ sudo ./build-arch-gce + ``` -2. Run the image building script: + You can also use the `build-arch-gce` package from the AUR, and run + `sudo /usr/bin/build-arch-gce` - ```console - $ sudo ./build-arch-gce - ``` + If the build is successful, this will create an image file named + arch-vDATE.tar.gz in the current directory, where DATE is the current date. - If the script is successful, this will create an image file named - arch-vDATE.tar.gz in the current directory, where DATE is the current date. +2. Install and configure the [Cloud SDK](https://cloud.google.com/sdk/docs/). -3. Install and configure the [Cloud SDK](https://cloud.google.com/sdk/docs/). +3. Copy the image file to Google Cloud Storage: -4. Copy the image file to Google Cloud Storage: + ```console + $ gsutil mb gs://BUCKET_NAME + $ gsutil cp arch-vDATE.tar.gz gs://BUCKET_NAME + ``` - ```console - $ gsutil mb gs://BUCKET_NAME - $ gsutil cp arch-vDATE.tar.gz gs://BUCKET_NAME - ``` +4. Import the image file to Google Cloud Engine as a new custom image: -5. Import the image file to Google Cloud Engine as a new custom image: - - ```console - $ gcloud compute images create IMAGE_NAME \ - --source-uri=gs://BUCKET_NAME/arch-vDATE.tar.gz \ - --guest-os-features=VIRTIO_SCSI_MULTIQUEUE - ``` + ```console + $ gcloud compute images create IMAGE_NAME \ + --source-uri=gs://BUCKET_NAME/arch-vDATE.tar.gz \ + --guest-os-features=VIRTIO_SCSI_MULTIQUEUE + ``` You can now create new instances with your custom image: @@ -100,22 +98,19 @@ $ gcloud compute instances create INSTANCE_NAME --image=IMAGE_NAME The Google Cloud Storage file is no longer needed, so you can delete it if you want: - ```console - $ gsutil rm gs://BUCKET_NAME/arch-vDATE.tar.gz - ``` - +```console +$ gsutil rm gs://BUCKET_NAME/arch-vDATE.tar.gz +``` ## Contributing Changes * See [CONTRIB.md](CONTRIB.md) - ## Licensing All files in this repository are under the [Apache License, Version 2.0](LICENSE) unless noted otherwise. - ## Support Google Inc. does not provide any support, guarantees, or warranty for this diff --git a/maintaining.md b/maintaining.md new file mode 100644 index 0000000..1cdc070 --- /dev/null +++ b/maintaining.md @@ -0,0 +1,78 @@ +# Maintainers Guide + +Note that this document is intended for the owners of this repository who are +maintaining the common images (in the `arch` family), and the gce Pacman repo. +If you're just looking to build your own image, follow the instructions at the +end of README.md. + +## Deploying Public Images + +```console +$ DATE=$(date --utc +%Y%m%d) + +$ sudo pacman -S --needed arch-install-scripts e2fsprogs + +$ sudo ./build-arch-gce + +$ gcloud auth login + +$ gcloud config set project arch-linux-gce + +$ gsutil cp "arch-v${DATE}.tar.gz" gs://arch-linux-gce-work + +$ gcloud compute images create "arch-v${DATE}" \ + --source-uri="gs://arch-linux-gce-work/arch-v${DATE}.tar.gz" \ + --guest-os-features=VIRTIO_SCSI_MULTIQUEUE \ + --description="Arch Linux built on ${DATE}." \ + --family=arch + +$ gsutil rm "gs://arch-linux-gce-work/arch-v${DATE}.tar.gz" + +$ gcloud compute instances create "arch-v${DATE}-test" --image="arch-v${DATE}" + +$ gcloud compute ssh "arch-v${DATE}-test" + +$ gcloud compute instances delete "arch-v${DATE}-test" + +$ gcloud compute images add-iam-policy-binding "arch-v${DATE}" \ + --member='allAuthenticatedUsers' \ + --role='roles/compute.imageUser' +``` + +## Managing the Pacman repo + +See also +https://wiki.archlinux.org/index.php/Pacman/Tips_and_tricks#Custom_local_repository. + +1. Sync the repo to your device + + ```console + $ mkdir -p repo + $ gsutil rsync gs://arch-linux-gce/repo repo/ + ``` + +2. Build packages and copy into the repo + + ```console + $ cd path/to/package + $ PKGEXT=".pkg.tar.zst" makepkg + $ cp PACKAGE_NAME.pkg.tar.zst path/to/repo + ``` + +3. Update repo database + + ```console + $ cd path/to/repo + $ repo-add gce.db.tar.gz PACKAGE_NAME.pkg.tar.zst + ``` + +4. Upload the repo to GCS + + ```console + $ cd .. + $ gsutil rsync repo/ gs://arch-linux-gce/repo + ``` + +Note that if deleting packages (use `repo-remove gce.db.tar.gz PACKAGE_NAME`), +`gsutil rsync` will not delete the old package files. Use `gsutil rm` if +required. -- cgit v1.3