Skip to content
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

build: Add rpm builds to release pipeline #1228

Open
wants to merge 1 commit into
base: I0d821aa07ca2a24a98da6c2c58865d2339d73a87
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions readyset/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
name = "readyset"
version = "1.3.0"
publish = false
authors = ["ReadySet Technology, Inc. <info@readyset.io>"]
authors = ["Readyset Technology, Inc. <info@readyset.io>"]
edition = "2021"
license = "BSL 1.1"
description = """\
A real-time SQL caching engine for Postgres and MySQL."""


[dependencies]
Expand Down Expand Up @@ -59,19 +62,29 @@ temp-dir = "0.1"
[features]
failure_injection = ["fail/failpoints", "readyset-client/failure_injection", "readyset-server/failure_injection"]

[package.metadata.generate-rpm]
assets = [
{ source = "target/release/readyset", dest = "/usr/bin/readyset", mode = "755" },
{ source = "pkg/common/readyset.conf", dest = "/etc/readyset/readyset.conf", mode = "600", config = true },
{ source = "pkg/common/readyset.service", dest = "/lib/systemd/system/readyset.service", mode = "644" },
]
# These get set using cargo-generate-rpm --metadata-overwrite=<SCRIPTLETS.TOML> at package build time.
#post_install_script = ...
#pre_uninstall_script = ...
#post_uninstall_script = ...


[package.metadata.deb]
maintainer = "ReadySet Technology <info@readyset.io>"
copyright = "2023, ReadySet Technology, Inc."
maintainer = "Readyset Technology <info@readyset.io>"
copyright = "2024, Readyset Technology, Inc."
license-file = ["../LICENSE", "1"]
extended-description = """\
A real-time SQL caching engine for Postgres and MySQL."""
depends = "$auto"
section = "Databases"
priority = "optional"
assets = [
["target/release/readyset", "usr/bin/", "755"],
["debian/readyset.conf", "/etc/readyset/readyset.conf", "644"],
["debian/systemd/readyset.service", "/lib/systemd/system/readyset.service", "644"],
["pkg/common/readyset.conf", "/etc/readyset/readyset.conf", "600"],
["pkg/common/readyset.service", "/lib/systemd/system/readyset.service", "644"],
]
maintainer-scripts = "debian/scripts"
maintainer-scripts = "pkg/debian"
conf-files = ["/etc/readyset/readyset.conf"]
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ else
deb-systemd-helper update-state readyset.service > /dev/null || true
fi

# Print some instructions if package is being installed or configured. Require the user to
# acknowledge the message, since config update must take place before first run.
# Print some instructions if package is being installed or configured.
if [ "$1" = "configure" ] || [ "$1" = "install" ]; then
cat << EOF

********************************************************************************
Notice: The UPSTREAM_DB_URL and LISTEN_ADDRESS values must be set in
/etc/readyset/readyset.conf before starting the readyset service.

Press <Enter> to acknowledge this message.
********************************************************************************

EOF
read -r REPLY
fi

# Ensure the script exits with a success status
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
75 changes: 75 additions & 0 deletions readyset/pkg/rpm/scriptlets.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
pre_install_script = '''
#!/bin/bash

set -e

RS_USER=readyset
RS_DIR=/var/lib/readyset

# Create readyset:readyset user/group and set homedir to /var/lib/readyset
if [[ $1 -eq 1 ]] ; then
# New installation
if ! id ${RS_USER} > /dev/null 2>&1; then
useradd --home-dir ${RS_DIR} --system --create-home --user-group ${RS_USER}
fi
fi
'''
post_install_script = '''
#!/bin/bash

set -e

if [[ $1 -eq 1 ]] ; then
# New installation
RS_USER=readyset
RS_GROUP=${RS_USER}
RS_HOME_DIR=/var/lib/readyset
RS_HOME_DIR_PERMS=700

# Ensure that the home directory has the correct ownership
chown -R ${RS_USER}:${RS_GROUP} ${RS_HOME_DIR}

# Ensure that the home directory has the correct permissions
chmod ${RS_HOME_DIR_PERMS} ${RS_HOME_DIR}

# Run commands equivalent to what the RPM systemd macros would do
systemctl --no-reload preset readyset.service &>/dev/null
systemctl daemon-reload
systemctl enable readyset.service
fi
cat << EOF

********************************************************************************
Notice: The UPSTREAM_DB_URL and LISTEN_ADDRESS values must be set in
/etc/readyset/readyset.conf before starting the readyset service.

********************************************************************************

EOF

# Ensure the script exits with a success status
exit 0
'''

pre_uninstall_script = '''
#!/bin/bash

set -e

if [[ $1 -eq 0 ]] ; then
# Package removal, not upgrade
# Run commands equivalent to what the RPM systemd macros would do
systemctl --no-reload disable --now readyset.service &>/dev/null
systemctl daemon-reload
fi
'''

post_uninstall_script = '''
#!/bin/bash -e

if [[ $1 -ge 0 ]] ; then
# Run commands equivalent to what the RPM systemd macros would do
systemctl try-restart readyset.service &>/dev/null 2>&1
systemctl daemon-reload
fi
'''