From acdd42935b7e71461d51ab2bb92610bfec8a6601 Mon Sep 17 00:00:00 2001 From: Miro Prasil Date: Mon, 30 Sep 2019 13:54:06 +0100 Subject: [PATCH 1/2] Add sqlite binary into the docker images This is done to enable backup functionality in the admin interface while we're waiting for the libsqlite-sys 0.17 to bubble up in the upstream dependencies. Then we can start using `VACUUM INTO` This also extends the check for the sqlite binary to also try `sqlite3` as this is the name of the binary in baseimage distributions we use. --- docker/aarch64/sqlite/Dockerfile | 1 + docker/amd64/postgresql/Dockerfile | 1 + docker/amd64/postgresql/Dockerfile.alpine | 1 + docker/amd64/sqlite/Dockerfile | 1 + docker/amd64/sqlite/Dockerfile.alpine | 1 + docker/armv6/sqlite/Dockerfile | 1 + docker/armv7/sqlite/Dockerfile | 1 + src/api/admin.rs | 6 +++++- 8 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docker/aarch64/sqlite/Dockerfile b/docker/aarch64/sqlite/Dockerfile index 097e6de..02e76fd 100644 --- a/docker/aarch64/sqlite/Dockerfile +++ b/docker/aarch64/sqlite/Dockerfile @@ -82,6 +82,7 @@ RUN apt-get update && apt-get install -y \ openssl \ ca-certificates \ curl \ + sqlite3 \ && rm -rf /var/lib/apt/lists/* RUN mkdir /data diff --git a/docker/amd64/postgresql/Dockerfile b/docker/amd64/postgresql/Dockerfile index fd33b0d..3f7677e 100644 --- a/docker/amd64/postgresql/Dockerfile +++ b/docker/amd64/postgresql/Dockerfile @@ -81,6 +81,7 @@ RUN apt-get update && apt-get install -y \ openssl \ ca-certificates \ curl \ + sqlite3 \ libpq5 \ && rm -rf /var/lib/apt/lists/* diff --git a/docker/amd64/postgresql/Dockerfile.alpine b/docker/amd64/postgresql/Dockerfile.alpine index 0a13b8e..75990b7 100644 --- a/docker/amd64/postgresql/Dockerfile.alpine +++ b/docker/amd64/postgresql/Dockerfile.alpine @@ -64,6 +64,7 @@ RUN apk add --no-cache \ openssl \ postgresql-libs \ curl \ + sqlite \ ca-certificates RUN mkdir /data diff --git a/docker/amd64/sqlite/Dockerfile b/docker/amd64/sqlite/Dockerfile index b03a284..febcb8f 100644 --- a/docker/amd64/sqlite/Dockerfile +++ b/docker/amd64/sqlite/Dockerfile @@ -81,6 +81,7 @@ RUN apt-get update && apt-get install -y \ openssl \ ca-certificates \ curl \ + sqlite3 \ && rm -rf /var/lib/apt/lists/* RUN mkdir /data diff --git a/docker/amd64/sqlite/Dockerfile.alpine b/docker/amd64/sqlite/Dockerfile.alpine index cea8204..8f84c01 100644 --- a/docker/amd64/sqlite/Dockerfile.alpine +++ b/docker/amd64/sqlite/Dockerfile.alpine @@ -63,6 +63,7 @@ ENV SSL_CERT_DIR=/etc/ssl/certs RUN apk add --no-cache \ openssl \ curl \ + sqlite \ ca-certificates RUN mkdir /data diff --git a/docker/armv6/sqlite/Dockerfile b/docker/armv6/sqlite/Dockerfile index 3aeb2ea..68e172e 100644 --- a/docker/armv6/sqlite/Dockerfile +++ b/docker/armv6/sqlite/Dockerfile @@ -82,6 +82,7 @@ RUN apt-get update && apt-get install -y \ openssl \ ca-certificates \ curl \ + sqlite3 \ && rm -rf /var/lib/apt/lists/* RUN mkdir /data diff --git a/docker/armv7/sqlite/Dockerfile b/docker/armv7/sqlite/Dockerfile index 21bb210..4dbb376 100644 --- a/docker/armv7/sqlite/Dockerfile +++ b/docker/armv7/sqlite/Dockerfile @@ -82,6 +82,7 @@ RUN apt-get update && apt-get install -y \ openssl \ ca-certificates \ curl \ + sqlite3 \ && rm -rf /var/lib/apt/lists/* RUN mkdir /data diff --git a/src/api/admin.rs b/src/api/admin.rs index 222b18b..23925b3 100644 --- a/src/api/admin.rs +++ b/src/api/admin.rs @@ -37,7 +37,11 @@ pub fn routes() -> Vec { } lazy_static! { - static ref CAN_BACKUP: bool = cfg!(feature = "sqlite") && Command::new("sqlite").arg("-version").status().is_ok(); + static ref CAN_BACKUP: bool = cfg!(feature = "sqlite") && + ( + Command::new("sqlite").arg("-version").status().is_ok() || + Command::new("sqlite3").arg("-version").status().is_ok() + ); } #[get("/")] From d6e9af909be8be79bf4f301d25a343df6108efd7 Mon Sep 17 00:00:00 2001 From: Miro Prasil Date: Tue, 1 Oct 2019 10:40:22 +0100 Subject: [PATCH 2/2] Remove the unnecessary check for sqlite The binary we use is called `sqlite3` so no need to check for other name variants as we won't use those anyways. --- src/api/admin.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/api/admin.rs b/src/api/admin.rs index 23925b3..b127c46 100644 --- a/src/api/admin.rs +++ b/src/api/admin.rs @@ -37,11 +37,7 @@ pub fn routes() -> Vec { } lazy_static! { - static ref CAN_BACKUP: bool = cfg!(feature = "sqlite") && - ( - Command::new("sqlite").arg("-version").status().is_ok() || - Command::new("sqlite3").arg("-version").status().is_ok() - ); + static ref CAN_BACKUP: bool = cfg!(feature = "sqlite") && Command::new("sqlite3").arg("-version").status().is_ok(); } #[get("/")]