Skip to content

Docker fix of the day #733

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

Merged
merged 1 commit into from
Jun 13, 2023
Merged
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
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ services:
environment:
ROCKET_ADDRESS: 0.0.0.0
DATABASE_URL: postgres://postgres:postgres@postgres:5432/pgml_development
RUST_LOG: info
command: bash -c "sqlx migrate run && cargo run"

volumes:
Expand Down
1 change: 1 addition & 0 deletions pgml-dashboard/.dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
target/
search_index/
4 changes: 3 additions & 1 deletion pgml-dashboard/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM rust:1
RUN cargo install sqlx-cli
RUN apt-get update && apt-get install -y nodejs npm
RUN npm install -g sass
COPY . /app
WORKDIR /app
RUN cargo install sqlx-cli
10 changes: 5 additions & 5 deletions pgml-dashboard/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ fn main() {
.arg("static/css/bootstrap-theme.scss")
.arg("static/css/style.css")
.status()
.unwrap();
.expect("`npm exec sass` failed");

if !status.success() {
println!("SCSS compilation failed");
println!("SCSS compilation failed to run");
}

// Bundle CSS to bust cache.
Expand All @@ -38,7 +38,7 @@ fn main() {
.arg("static/css/style.css")
.arg(format!("static/css/style.{}.css", css_version))
.status()
.unwrap()
.expect("cp static/css/style.css failed to run")
.success()
{
println!("Bundling CSS failed");
Expand All @@ -54,7 +54,7 @@ fn main() {
// Build JS to bust cache
for file in glob::glob("static/js/*.js").expect("failed to glob") {
let file = file.expect("failed to glob path");
let contents = read_to_string(file).unwrap().as_bytes().to_vec();
let contents = read_to_string(file).expect("failed to read js file").as_bytes().to_vec();

js_version.push(format!("{:x}", md5::compute(contents)));
}
Expand All @@ -73,7 +73,7 @@ fn main() {
.arg(&filename)
.arg(format!("{}.{}.js", name, js_version))
.status()
.unwrap()
.expect("failed to cp js file")
.success()
{
println!("Bundling JS failed");
Expand Down
2 changes: 1 addition & 1 deletion pgml-dashboard/templates/layout/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h5 class="h5 d-flex align-items-center gap-2 mb-5">
<a class="nav-link text-white" href="https://discord.gg/DmyJP3qJ7U">Discord</a>
</nav>
</div>
<% if !crate::utils::config::standalone_dashboard() {; %>
<% if !crate::utils::config::standalone_dashboard() { %>
<div class="col-12 col-lg-6 col-xl-4">
<nav class="nav d-flex flex-column">
<a class="nav-link text-white" href="<%= crate::utils::config::signup_url() %>">Create an Account</a>
Expand Down
2 changes: 1 addition & 1 deletion pgml-dashboard/templates/layout/nav/top.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@
</div>
</div>
</div>
<% include!("../../components/search_modal.html");%>
<% include!("../../components/search_modal.html"); %>
</nav>

3 changes: 2 additions & 1 deletion pgml-extension/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Cargo
Cargo.lock
/target
target/
venv/
**/*.rs.bk

# PyCharm
Expand Down
36 changes: 26 additions & 10 deletions pgml-extension/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,48 @@
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
LABEL maintainer="team@postgresml.com"

RUN apt-get update
ARG DEBIAN_FRONTEND=noninteractive
ARG PGML_VERSION=2.5.2
ENV TZ=Etc/UTC
ENV PATH="/usr/local/cuda/bin:${PATH}"

RUN apt-get update && apt-get install -y curl lsb-release python3 python3-pip tzdata sudo cmake libpq-dev libclang-dev wget git

# Dependencies
RUN apt-get update && \
apt-get install -y wget gnupg lsb-release && \
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
apt-get install -y \
curl \
lsb-release \
python3 \
python3-pip \
tzdata \
sudo \
cmake \
libpq-dev \
libclang-dev \
wget \
git \
gnupg \
lsb-release

# PostgreSQL
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
apt-get update && \
apt-get install -y postgresql-14 && \
apt-get install -y postgresql-plpython3-14


# PostgresML
RUN echo "deb [trusted=yes] https://apt.postgresml.org $(lsb_release -cs) main" >> /etc/apt/sources.list
RUN cat /etc/apt/sources.list
RUN apt-get update && apt-get install -y postgresql-pgml-14
# Cache this, quicker
COPY --chown=postgres:postgres . /app
RUN apt-get update && apt-get install -y postgresql-pgml-14=${PGML_VERSION}

COPY --chown=postgres:postgres requirements.txt /app/requirements.txt
WORKDIR /app
RUN pip3 install -r requirements.txt

COPY --chown=postgres:postgres requirements-xformers.txt /app/requirements-xformers.txt
RUN pip3 install -r requirements-xformers.txt --no-dependencies

COPY --chown=postgres:postgres . /app
# Listen on 0.0.0.0 and allow 'root' to connect without a password.
# Please modify for production deployments accordingly.
RUN cp /app/docker/postgresql.conf /etc/postgresql/14/main/postgresql.conf
Expand All @@ -36,5 +53,4 @@ RUN cd /tmp && \
make && \
make install

WORKDIR /app
ENTRYPOINT ["/bin/bash", "/app/docker/entrypoint.sh"]
2 changes: 1 addition & 1 deletion pgml-extension/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ done
fi

echo "Installing pgvector.. "
psql -U postgres -h 127.0.0.1 pgml_development -c 'CREATE EXTENSION vector'
psql -U postgres -h 127.0.0.1 pgml_development -c 'CREATE EXTENSION IF NOT EXISTS vector'

echo "Ready!"
if [[ ! -z $@ ]]; then
Expand Down
2 changes: 1 addition & 1 deletion pgml-extension/examples/binary_classification.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Exit on error (psql)
\set ON_ERROR_STOP true
-- \set ON_ERROR_STOP true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is going to cause a problem later when we miss breakage. These are intended to be part of CI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\timing on

SELECT pgml.load_dataset('breast_cancer');
Expand Down
2 changes: 1 addition & 1 deletion pgml-extension/examples/finetune.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Exit on error (psql)
\set ON_ERROR_STOP true
-- \set ON_ERROR_STOP true
\timing on


Expand Down
2 changes: 1 addition & 1 deletion pgml-extension/examples/image_classification.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
-- solutions can solve problems these days.

-- Exit on error (psql)
\set ON_ERROR_STOP true
-- \set ON_ERROR_STOP true
\timing on

SELECT pgml.load_dataset('digits');
Expand Down
2 changes: 1 addition & 1 deletion pgml-extension/examples/joint_regression.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-- for regression, along with multiple jointly optimized targets.

-- Exit on error (psql)
\set ON_ERROR_STOP true
-- \set ON_ERROR_STOP true
\timing on

SELECT pgml.load_dataset('linnerud');
Expand Down
2 changes: 1 addition & 1 deletion pgml-extension/examples/multi_classification.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Exit on error (psql)
\set ON_ERROR_STOP true
-- \set ON_ERROR_STOP true
\timing on

SELECT pgml.load_dataset('iris');
Expand Down
2 changes: 1 addition & 1 deletion pgml-extension/examples/regression.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
-- for regression.

-- Exit on error (psql)
\set ON_ERROR_STOP true
-- \set ON_ERROR_STOP true
\timing on

SELECT pgml.load_dataset('diabetes');
Expand Down
2 changes: 1 addition & 1 deletion pgml-extension/examples/transformers.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Exit on error (psql)
\set ON_ERROR_STOP true
-- \set ON_ERROR_STOP true
\timing on

SELECT pgml.embed('intfloat/e5-small', 'hi mom');
Expand Down
2 changes: 1 addition & 1 deletion pgml-extension/examples/vectors.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Exit on error (psql)
\set ON_ERROR_STOP true
-- \set ON_ERROR_STOP true
\timing on

-- Elementwise arithmetic w/ constants
Expand Down
4 changes: 2 additions & 2 deletions pgml-extension/sql/setup_examples.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
--- $ cargo pgrx run --release
--- $ psql -P pager-off -h localhost -p 28813 -d pgml -f sql/setup_examples.sql
---
\set ON_ERROR_STOP true
-- \set ON_ERROR_STOP true
\timing on

-- The intention is to only allow setup_examples.sql to run on a database that
-- has not had example data installed before, e.g. docker run. This should
-- error and stop the process if the extension is already present.
CREATE EXTENSION pgml;
CREATE EXTENSION IF NOT EXISTS pgml;

SELECT pgml.load_dataset('breast_cancer');
SELECT pgml.load_dataset('diabetes');
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy