Coder Social home page Coder Social logo

gardenlinux / ostree-image-builder Goto Github PK

View Code? Open in Web Editor NEW
5.0 7.0 0.0 333 KB

Proof of Concept for building OSTree-based systems with the Garden Linux Builder

Home Page: https://blogs.sap.com/2023/07/10/making-an-immutable-image-based-operating-system-out-of-garden-linux/

License: MIT License

Shell 49.04% Python 42.87% Dockerfile 5.86% Makefile 2.23%
debian gardenlinux image-based immutable linux ostree

ostree-image-builder's Introduction

OSTree Image Builder for Garden Linux and Debian

Repo Image

Important

This repository is part of a proof of concept. The Garden Linux team does not provide any support or guarantee for this repository. Feel free to open an issue if something does not work, but please be aware of the experimental status of this repository.

Builder for OSTree-based operating system images using the Garden Linux Builder.

See this blog post series for background information on the PoC and its motivation.

Refer to the Garden Linux README for setup instructions for the Builder.

Repo Structure

The debian directory contains a build for a debian trixie image. It takes packages from the Debian apt repositories.

The gardenlinux directory contains a build for a gardenlinux today image. It takes packages from the Garden Linux apt repositories. This directory contains a lot of code taken from the gardenlinux/gardenlinux repo.

Building

This repo contains two os builder definitions.

Builds can be parameterized to change certain default values. To change any of the values, create a file using the parameter name inside the feature directory. This might be needed in both the ostreeRepo and the ostreeImage feature.

  • REMOTE_URL: Hostname to use as OSTree remote, default value is http://ostree.gardenlinux.io
  • OS_NAME: OS Name (Stateroot) used for OSTree, default value is either debian or gardenlinux, change this if you want to build a custom OS
  • REMOTE_NAME: Name for the OSTree remote (similar to remote 'origin' in git), default value is main

Debian

To build the debian image yourself, run inside the debian directory:

# Optional: To build the OSTree Repo
$ ./build ostreeRepo
# To build the bootable image
$ ./build ostreeImage

Note

The ostreeImage will download a copy of the OSTree repository from the Garden Linux artifact storage. You don't need to run ostreeRepo locally. To build an image based on your self-created repo, copy the output file from the ostreeRepo build to debian/features/ostreeImage/ostree-debian-repo-(amd64/arm64).tar.gz, depending on your local architecture. This applies both to the Garden Linux and the Debian builder.

Garden Linux

Additionally to the build parameters defined above, the Garden Linux build has another parameter called BUILD_VARIANT.

To build the Garden Linux yourself, run inside the gardenlinux directory:

# Required: Set the platform. Must match between what is set in the BUILD_VARIANT file and in the repo argument.
# Allowed values for PLATFORM: kvm, metal
$ PLATFORM=kvm
$ echo $PLATFORM > features/ostreeRepo/BUILD_VARIANT
$ echo $PLATFORM > features/ostreeImage/BUILD_VARIANT
# Optional: To build the OSTree Repo
$ ./build "$PLATFORM"_dev_curl-ostreeRepo
# To build the bootable image
$ ./build ostreeImage

Note

The ostreeImage will download a copy of the OSTree repository from the Garden Linux artifact storage. You don't need to run ostreeRepo locally. To build an image based on your self-created repo, copy the output file from the ostreeRepo build to gardenlinux/features/ostreeImage/ostree-gardenlinux-repo-$(PLATFORM)-(amd64/arm64).tar.gz, depending on your local architecture and the selected platform. This applies both to the Garden Linux and the Debian builder.

Alternatively, use the ./ostree-build.sh script:

./ostree-build.sh kvm
./ostree-build.sh metal

Running

To boot any of the images, use the start-vm script from the root of this repository:

$ gardenlinux/bin/start-vm debian/.build/*ostreeImage-*-trixie-*.ostree.raw
$ gardenlinux/bin/start-vm gardenlinux/.build/*ostreeImage-*-today-*.ostree.raw

Check for the actual name of the image in the .build directory.

Upgrading

Inside the booted vm, you can run the ostree-upgrade script to upgrade your OS to the latest version.

More information

Refer to the OSTree command man page for instructions of using the cli.

ostree-image-builder's People

Contributors

dependabot[bot] avatar fwilhe avatar gardener-robot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ostree-image-builder's Issues

Address failed systemd-units at boot

What happened: When booting the images, a few units fail
Screenshot 2023-11-24 at 14 55 03

Screenshot 2023-11-24 at 14 54 43

What you expected to happen: Units don't fail at boot. Either their configuration can be fixed, or they are not needed and should not be included in the image.

How to reproduce it (as minimally and precisely as possible): Build the gardenlinux kvm image and boot it using start-vm and observe the boot logs.

Anything else we need to know:

Environment:

Disk image is too large

What happened: When building the images, one gets a huge disk image. Proper gardenlinux optimizes the disk size on build, this has not been done here yet.

What you expected to happen: The disk is not 6gig on disk when building when it could also be 1gig, but still the disk should be able to grow when needed (so enough space for updates is available).

How to reproduce it (as minimally and precisely as possible): Run the build commands from the readme and observe the size of the created raw files.

Anything else we need to know:

Environment:

Implement Garden Linux "Features" for OSTree

What would you like to be added: The gardenlinux/gardenlinux repo has a lot of features which are not reflected in this repo. Some of the features just add packages and can be built into the base image, but for some features it might make also sense to package them as a system extension or by other means.

Why is this needed:
It is not sustainable to make too many image variants (like with curl or without curl), so having the _curl image as a system extension that can be easily enabled would make more sense compared to baking it into the image itself. This approach won't work for all features, so they need to be categorised and analysed.

partitioning patch

What would you like to be added:
You said the partitioning needed to be more dynamic, so here is a stab at it. It builds images with the defined sizes.
What I could not get to work was predefined UUIDs for the partitions. So there is something up with the '-u' option for the various make_ scripts in builder. I have not investigated it closer.
Also, there is no error checking in this patch, it is more a proof of concept, and for that, it will do.

Why is this needed:
Images may need to be smaller or larger depending on the usecase.


patch.zip

Build should be more configurable

What would you like to be added:

The build currently has quite some hardcoded values that should be configurable without changing the source code of the builder, but they should have default values.

The idea is to configure via files inside the feature directory like it's already done for the BUILD_VARIANT config.

Potential configurable settings:

BUILD_VARIANT: Only applies to Garden Linux, possible values kvm, metal, potentially also gcp, azure, aws

REMOTE_URL: Base URL for the remote repo, default value http://ostree.gardenlinux.io, would need to be changed for consumers who wish to use their own remote repo.

OS_NAME: OSTree stateroot/osname, currently hardcoded to gardenlinux/debian, would have to be changed for custom distros.

REMOTE_NAME: Path component of the URL used for the OSTree remote, currently hard coded to a schema usable for Garden Linux
โš ๏ธ
"REMOTE_NAME" is a terrible identifier because it might easily be confused with this "remote name":
Screenshot 2023-11-27 at 11 17 42
This needs to be renamed.

The "remote name" is currently hardcoded to origin which does not make a lot of sense semantically. It should also be configurable.

Why is this needed:
This repo should be generic enough so it is useful for Building/maintaining custom OSTree images.

Build for cloud providers

What would you like to be added: Have image variants for azure, aws and gcp both for amd64 and arm64.

Why is this needed:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.