Skip to content

Commit 77a69ae

Browse files
authored
Build everything (#911)
1 parent d49e8a6 commit 77a69ae

File tree

19 files changed

+293
-3
lines changed

19 files changed

+293
-3
lines changed

.github/workflows/package-extension.yml

Lines changed: 110 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ on:
55
inputs:
66
packageVersion:
77
default: "2.7.4"
8+
pythonVersion:
9+
default: "3.10"
810

911
jobs:
10-
build:
12+
extension:
1113
strategy:
14+
fail-fast: false # Let the other job finish
1215
matrix:
1316
os: ["buildjet-16vcpu-ubuntu-2204-arm", "buildjet-16vcpu-ubuntu-2204-arm"]
1417
runs-on: ${{ matrix.os }}
@@ -147,3 +150,109 @@ jobs:
147150
postgresql-pgml-${pg}_${PACKAGE_VERSION}-ubuntu22.04-${ARCH}.deb \
148151
--codename $(lsb_release -cs)
149152
done
153+
package:
154+
needs: extension
155+
strategy:
156+
max-parallel: 1
157+
fail-fast: false # Let the other job finish, or they can lock each other out
158+
matrix:
159+
os: ["ubuntu-22.04", "buildjet-4vcpu-ubuntu-2204-arm"]
160+
runs-on: ${{ matrix.os }}
161+
steps:
162+
- uses: actions/checkout@v3
163+
- name: Install dependencies
164+
env:
165+
DEBIAN_FRONTEND: noninteractive
166+
TZ: Etc/UTC
167+
run: |
168+
curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.4/deb-s3-0.11.4.gem
169+
sudo gem install deb-s3-0.11.4.gem
170+
dpkg-deb --version
171+
sudo apt install -y python3-pip python3 python3-virtualenv
172+
- name: Build and release package
173+
env:
174+
AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }}
175+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
176+
AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }}
177+
run: |
178+
if [[ $(arch) == "x86_64" ]]; then
179+
export ARCH=amd64
180+
else
181+
export ARCH=arm64
182+
fi
183+
184+
for pg in {11..15}; do
185+
bash packages/postgresml/build.sh ${pg} v${{ inputs.packageVersion }}-1 ${{ inputs.pythonVersion }}
186+
187+
deb-s3 upload \
188+
--lock \
189+
--bucket apt.postgresml.org \
190+
postgresml-${pg}-${{ inputs.packageVersion }}-1-ubuntu22.04-${ARCH}.deb \
191+
--codename $(lsb_release -cs)
192+
193+
rm -f postgresml-${pg}-${{ inputs.packageVersion }}-1-ubuntu22.04-${ARCH}.deb
194+
done
195+
dashboard:
196+
strategy:
197+
fail-fast: false # Let the other job finish
198+
matrix:
199+
os: ["ubuntu-22.04", "buildjet-4vcpu-ubuntu-2204-arm"]
200+
runs-on: ${{ matrix.os }}
201+
steps:
202+
- uses: actions/checkout@v3
203+
- uses: actions-rs/toolchain@v1
204+
with:
205+
toolchain: stable
206+
- name: Install dependencies
207+
env:
208+
DEBIAN_FRONTEND: noninteractive
209+
TZ: Etc/UTC
210+
run: |
211+
curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.4/deb-s3-0.11.4.gem
212+
sudo gem install deb-s3-0.11.4.gem
213+
dpkg-deb --version
214+
- name: Build and release package
215+
env:
216+
AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }}
217+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
218+
AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }}
219+
run: |
220+
if [[ $(arch) == "x86_64" ]]; then
221+
export ARCH=amd64
222+
else
223+
export ARCH=arm64
224+
fi
225+
226+
bash packages/postgresml-dashboard/build.sh ${{ inputs.packageVersion }}
227+
228+
deb-s3 upload \
229+
--lock \
230+
--bucket apt.postgresml.org \
231+
postgresml-dashboard-${{ inputs.packageVersion }}-ubuntu22.04-${ARCH}.deb \
232+
--codename $(lsb_release -cs)
233+
publish-extension-docker-image:
234+
needs: package
235+
strategy:
236+
matrix:
237+
os: ["buildjet-4vcpu-ubuntu-2204"]
238+
runs-on: ${{ matrix.os }}
239+
defaults:
240+
run:
241+
working-directory: pgml-extension/docker/postgresml
242+
steps:
243+
- uses: actions/checkout@v2
244+
- name: Login to GitHub Container Registry
245+
uses: docker/login-action@v1
246+
with:
247+
registry: ghcr.io
248+
username: ${{ github.actor }}
249+
password: ${{ secrets.GITHUB_TOKEN }}
250+
- name: Build and push Docker image
251+
run: |
252+
docker run --privileged --rm tonistiigi/binfmt --install all
253+
docker buildx create --use --name mybuilder
254+
docker buildx build \
255+
--platform linux/amd64,linux/arm64 \
256+
--tag ghcr.io/postgresml/postgresml:${{ inputs.version }} \
257+
--build-arg POSTGRESML_VERSION=${{ inputs.postgresmlVersion }} \
258+
--push .

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ dist/
1515
downloads/
1616
eggs/
1717
.eggs/
18-
lib/
18+
/lib
1919
lib64/
2020
parts/
2121
sdist/
22-
var/
22+
/var
2323
wheels/
2424
share/python-wheels/
2525
*.egg-info/
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Package: postgresml-dashboard
2+
Version: ${PACKAGE_VERSION}
3+
Section: database
4+
Priority: optional
5+
Architecture: ${ARCH}
6+
Depends: openssl
7+
Maintainer: PostgresML <team@postgresml.org>
8+
Homepage: https://postgresml.org
9+
Description: PostgresML Dashboard
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
systemctl daemon-reload
4+
systemctl enable pgml-dashboard
5+
systemctl start pgml-dashboard
6+
7+
echo "ROCKET_SECRET_KEY=$(openssl rand -hex 32)" >> /etc/pgml-dashboard/.env
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
systemctl daemon-reload
4+
rm /etc/pgml-dashboard/.env
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
systemctl stop pgml-dashboard
4+
systemctl disable pgml-dashboard
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
set -e
3+
4+
dir="/tmp/postgresml-dashboard"
5+
deb_dir="$dir/deb-build"
6+
source_dir="$dir/source"
7+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
8+
export PACKAGE_VERSION=${1:-"2.7.4"}
9+
export GITHUB_STARS=$(curl -s "https://api.github.com/repos/postgresml/postgresml" | grep stargazers_count | cut -d : -f 2 | tr -d " " | tr -d ",")
10+
if [[ $(arch) == "x86_64" ]]; then
11+
export ARCH=amd64
12+
else
13+
export ARCH=arm64
14+
fi
15+
16+
rm -rf "$dir"
17+
mkdir -p "$deb_dir"
18+
19+
cp -R ${SCRIPT_DIR}/* "$deb_dir"
20+
rm "$deb_dir/build.sh"
21+
22+
( cd pgml-dashboard && \
23+
cargo build --release && \
24+
cp target/release/pgml-dashboard "$deb_dir/usr/bin/pgml-dashboard" && \
25+
cp -R content "$deb_dir/usr/share/pgml-dashboard/dashboard-content" && \
26+
cp -R static "$deb_dir/usr/share/pgml-dashboard/dashboard-static" )
27+
28+
(cat ${SCRIPT_DIR}/DEBIAN/control | envsubst) > "$deb_dir/DEBIAN/control"
29+
(cat ${SCRIPT_DIR}/etc/systemd/system/pgml-dashboard.service | envsubst) > "$deb_dir/etc/systemd/system/pgml-dashboard.service"
30+
31+
chmod 755 ${deb_dir}/DEBIAN/post*
32+
chmod 755 ${deb_dir}/DEBIAN/pre*
33+
34+
dpkg-deb \
35+
--root-owner-group \
36+
--build "$deb_dir" \
37+
postgresml-dashboard-${PACKAGE_VERSION}-ubuntu22.04-${ARCH}.deb
38+
39+
rm -rf "$dir"

packages/postgresml-dashboard/etc/pgml-dashboard/.gitkeep

Whitespace-only changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[Unit]
2+
Description=PostgresML Dashboard: inspect models, write notebooks, and more.
3+
After=network.target
4+
StartLimitIntervalSec=0
5+
6+
[Service]
7+
Environment=RUST_LOG=info
8+
Environment=DASHBOARD_STATIC_DIRECTORY=/usr/share/pgml-dashboard/dashboard-static
9+
Environment=DASHBOARD_CONTENT_DIRECTORY=/usr/share/pgml-dashboard/dashboard-content
10+
Environment=ROCKET_ADDRESS=0.0.0.0
11+
Environment=GITHUB_STARS=${GITHUB_STARS}
12+
Environment=SEARCH_INDEX_DIRECTORY=/var/lib/pgml-dashboard/search-index
13+
14+
Type=simple
15+
Restart=always
16+
RestartSec=1
17+
ExecStart=/usr/bin/pgml-dashboard
18+
WorkingDirectory=/etc/pgml-dashboard
19+
20+
[Install]
21+
WantedBy=multi-user.target

packages/postgresml-dashboard/usr/bin/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)