-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unified installer for machine images #44
Draft
jdpleiness
wants to merge
50
commits into
main
Choose a base branch
from
jdp/sourcegraph-installer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Methods available for determining if a distro is: - Amazon Linux - RHEL - Fedora - Debian - Ubuntu - if SELinux is enabled
Add pkg it manage the install of containerd
Add kernel package to set kernel parameters for Sourcegraph install.
Add package to install and configure K3s on a system using the K3s air gap install method. K3s binaries, install.sh, and container images are embedded into the installer binary. This allows for strict version pinning, faster deployment, and future air-gap installation considerations.
Add image package for pulling, saving, and loading images used for Sourcegraph deployments.
Add helm package for installing helm onto the system. This package embeds the helm binary into the installer binary. This allows for strict version pinning, faster deployment, and future air-gap installation considerations.
Add sourcegraph package for installing sourcegraph to a system. This package embeds the ingress, configmap, and helm charts needed for sourcegraph.
Add .editorconfig to be inline with main sourcegraph repo style.
Add systemd oneshot service to run on first boot and complete sourcegraph setup.
Add daemon to handle sourcegraph updates and installation tasks.
Add functions to update sourcegraph helm install as well as check for upgrades
Add check that checks for existing install Add update check
jasonhawkharris
approved these changes
Jun 9, 2023
Add `integration` flag for run Go tests that have side effects like installing software. To run integration test run `go test -integration`.
jac
reviewed
Jun 30, 2023
} | ||
|
||
// LinkDataVolumes will setup the k3s storage and persistent volume pod storage on our data disk. | ||
func LinkDataVolumes() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe it is just me but it would be nice if these were logically grouped to make it easier to parse related statements
e.g.
func LinkDataVolumes() error {
{
mkdir
symlink
}
{
mkdir
mkdir
symlink
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR introduces a new unified installer written in Go as outlined in PR-FAQ: Delivering Confidence.
This unified installer aims to replace the following install scripts:
Current project status
While the installer was initially scoped to address problems with the current machine image deployment pipeline, components could be easily changed to fit any new machine image deployment models that may arise in the future. New deployment models with new requirements may also result in being able to drastically simplify the installer code.
Objectives
Initial success at reducing project build times (see below) by roughly 43%. Build times could be reduced further if offline images were no longer needed.
Components
The installer is composed of the following components:
sginstall
The
sginstall
component is the main installation process. This will do the necessary system configuration (disk, kernel, user, images, containerd, k3s, etc...)sourcegraphd
The
sourcegraphd
component is a system daemon that monitors the current version of sourcegraph and if an update is needed. This component could also serve a diagnostics page in the future rather than the current404
if there is an issue booting the machine image.sginit
The
sginit
component is is a systemd oneshot service that will finalize the system configuration and setup upon first boot of the image.Progress
Test with GCP installTest generic installBuild
At current time, this project utilized Git LFS to handle large files that are embedded in the final Go binary to enable offline installation. Please make sure Git LFS is installed on your system before proceeding.
Building the Go binary:
To build the Go binary, run
./build.sh
from the base of the project. This will output three files:cmd/install/bin/sg-init
cmd/install/bin/sourcegraphd
bin/sginstall
These files will be used by Packer in the next step.
Building the AMI:
To create an AMI that will use the installer, run the following:
packer build -var "instance_version=5.0.4" ./packer/dev/dev-builder.pkr.hcl
This will produce an AMI using Amazon Linux 2023 that is ready to be run.