diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e3e0c56..dfd9ccf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,11 +5,6 @@ on: tags: - "v[0-9]+.[0-9]+.[0-9]+*" -permissions: - contents: write - packages: write - id-token: write - env: REGISTRY: ghcr.io IMAGE_NAME: cloudboss/easyto-builder @@ -24,6 +19,8 @@ jobs: runs-on: ubuntu-24.04 needs: - test-build + permissions: + contents: write steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 @@ -41,6 +38,9 @@ jobs: runs-on: ubuntu-24.04 needs: - test-build + permissions: + contents: read + packages: write outputs: image-tag: ${{ steps.meta.outputs.tags }} steps: @@ -63,9 +63,8 @@ jobs: uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} + flavor: | + latest=false - name: Build and push Docker image uses: docker/build-push-action@v5 @@ -82,6 +81,9 @@ jobs: runs-on: ubuntu-24.04 needs: - build-push-image + permissions: + id-token: write + contents: read steps: - uses: actions/checkout@v4 @@ -116,6 +118,9 @@ jobs: runs-on: ubuntu-24.04 needs: - build-ami + permissions: + id-token: write + contents: read strategy: matrix: region: diff --git a/CHANGELOG.md b/CHANGELOG.md index 31d0506..de94e57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,32 @@ # Changelog +## [0.6.0] - 2026-02-03 + +### Added + +- Add container image source to ctr2image, instead of assuming a remote image. This will enable building AMIs from a local image in the future. +- Add a number of new tests. +- Add `SSL_CERT_FILE` parameter to the kernel command line, which will be passed to init as an environment variable. +- Add `version` subcommand to print the easyto version. +- Add a new *fast* build mode. When this is enabled, the Packer build instance will have easyto preinstalled instead of being pushed to the instance duing build. By default, an official AMI with easyto preinstalled will be searched for in the user's AWS account and in the easyto AWS account. If not found, easyto will fall back to slow mode. New command line options have also been added to enable specifying a custom build AMI. +- Add a Dockerfile for the official build image. +- Add a `copy-builder` subcommand to make it easy to copy the official build AMI to your own AWS account. +- Add the ability to make images public. + +### Changed + +- Update Go to 1.25. +- Modify functions to take an AferoFS parameter wherever possible to enable easier testing. +- Update documentation with fixes and new functionality. +- Update Actions workflow to publish official images. + +### Removed + +- Remove link from /proc/net/pnp to /etc/resolv.conf. Network configuration is now done by easyto-init. +- Clean up obsolete and unused code. +- Remove external dependencies during provisioning. The ctr2disk command now handles partitioning and creation of filesystems rather than using external utilities before running it. The unmounting of filesystems after provisioning is also now done in ctr2disk instead of by external utilities after it runs. +- Remove symlink from /.easyto/lib/modules to /lib/modules. The included modprobe command now has the /.easyto path compiled in. + ## [0.5.0] - 2026-01-03 ### Changed @@ -58,6 +85,7 @@ Initial release +[0.6.0]: https://github.com/cloudboss/easyto/releases/tag/v0.6.0 [0.5.0]: https://github.com/cloudboss/easyto/releases/tag/v0.5.0 [0.4.0]: https://github.com/cloudboss/easyto/releases/tag/v0.4.0 [0.3.0]: https://github.com/cloudboss/easyto/releases/tag/v0.3.0 diff --git a/README.md b/README.md index 03ebe9e..81a1a27 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Download the release and unpack it. The `easyto` binary lives in the `bin` subdi ## Building an image -First make sure your AWS credentials and region are in scope, for example: +Building an image is done with the `ami` subcommand. AWS credentials and region are discovered from the environment or from another source like EC2 instance metadata. For example: ``` export AWS_PROFILE=xyz @@ -34,13 +34,11 @@ easyto ami -a postgres-16.2-bullseye -c postgres:16.2-bullseye -s subnet-e358acd ### Fast vs slow mode -The `ami` subcommand runs in one of *fast* or *slow* build modes. - -In fast mode, the build instance is created from an AMI that has easyto preinstalled. This is the default when the builder AMI matching your easyto version is available in your region. The AMI with the name `ghcr.io-cloudboss-easyto-builder-` is searched for in your own account and in the official easyto account, where `` is the same as the output of running `easyto version`. +The `ami` subcommand will attempt to run in *fast* mode if it finds the official builder AMI with easyto preinstalled in your configured region. It will search in your own AWS account or in the easyto account. A `copy-builder` subcommand is also available to copy to the image to your account. In slow mode, the build uses a Debian base AMI and copies easyto to the instance during the build process. This is slower but works without needing the builder AMI to be available. Slow mode is used automatically as a fallback when the fast mode AMI is not found. -You can also specify a custom builder image with `--builder-image`, with `--builder-image-mode` to specify fast mode if easyto is preinstalled on it. When easyto is preinstalled, it must be the full bundle including assets directory, and the `easyto` executable or a link to it must be on the `PATH`. +You can also specify a custom builder image with `--builder-image` and `--builder-image-mode` to specify fast mode for it. When easyto is preinstalled on your own image, it must be the full bundle including assets directory, and the `easyto` executable or a link to it must be on the `PATH`. ### Command line options @@ -74,10 +72,34 @@ The `ami` subcommand takes the following options: `--ssh-interface`: (Optional, default `public_ip`) - The SSH interface to use to connect to the image builder. This must be one of `public_ip` or `private_ip`. +`--public`: (Optional, default `false`) - If specified, the AMI and its snapshot will be made public. You may need to disable blocking of public access for images in your region, for example by running `aws ec2 disable-image-block-public-access`. + `--debug`: (Optional) - Enable debug output. `--help` or `-h`: (Optional) - Show help output. +## Copying the builder image to your own account + +The `copy-builder` subcommand will copy the official builder image from `us-east-1` to your own account and region. This will help to enable fast mode if the official AMI is not already available in your region. Currently it is published to `ap-northeast-1`, `ap-southeast-1`, `eu-central-1`, `eu-west-1`, `sa-east-1`, `us-east-1`, and `us-west-2`. + +Like with the `ami` subcommand, AWS credentials will be discovered from environment variables or EC2 instance metadata. + +### Command line options + +The `copy-builder` subcommand takes the following options: + +`--copy-tags`: (Optional, default `true`) - Copy tags from the source AMI. + +`--dest-region`: (Optional, defaults to the AWS SDK configured region) - AWS region to copy the AMI to. + +`--name`: (Optional, defaults to source AMI name) - Name for the copied AMI. + +`--public`: (Optional, default `false`) - Make the copied AMI and its snapshots public. + +`--version`: (Optional, defaults to the current easyto version) - Version of the builder AMI to copy. + +`--wait`: (Optional, default `true`) - Wait for the AMI copy to complete. + ## Running an instance Instances are created "the usual way" with the AWS console, AWS CLI, or Terraform, for example. Modifying the startup configuration is different from other EC2 instances however, because the [user data](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-add-user-data.html) format is different. The AMIs are not configured to use [cloud-init](https://cloudinit.readthedocs.io/en/latest/index.html), so just putting a shell script into user data will not work.