Skip to content

Commit

Permalink
Final corrections to application role function and related images
Browse files Browse the repository at this point in the history
  • Loading branch information
zaychenko-sergei committed Sep 24, 2024
1 parent 08fcfcc commit 35241b4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion images/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ IMAGE_JUPYTER_TAG = 0.6.3
KAMU_VERSION = $(shell cargo metadata --format-version 1 | jq -r '.packages[] | select( .name == "kamu") | .version')

SQLX_VERSION = 0.8.2
IMAGE_SQLX_TAG = $(SQLX_VERSION)-0
IMAGE_SQLX_TAG = $(SQLX_VERSION)-1

################################################################################

Expand Down
3 changes: 2 additions & 1 deletion images/sqlx-cli-with-migrations/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ RUN apk --no-cache add \
bash \
curl \
jq \
aws-cli
aws-cli \
postgresql-client

COPY scripts /scripts
RUN chmod -R 0755 /scripts
Expand Down
2 changes: 1 addition & 1 deletion images/sqlx-cli-with-migrations/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ifndef KAMU_VERSION
$(error KAMU_VERSION is not set)
endif

IMAGE_TAG = $(KAMU_VERSION)
IMAGE_TAG = $(KAMU_VERSION).1
IMAGE_SQLX_TAG = latest

################################################################################
Expand Down
3 changes: 1 addition & 2 deletions images/sqlx-cli/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ ARG VERSION
# cargo-binstall: preparation
RUN apk add --no-cache \
curl \
bash \
postgresql-client
bash

# cargo-binstall: install
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
Expand Down
4 changes: 2 additions & 2 deletions migrations/postgres/20240924075552_app_user.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ BEGIN
-- Check role is not present
IF NOT EXISTS (SELECT * FROM pg_roles WHERE rolname = rolename) THEN
-- Create role and grant basic access
EXECUTE format('CREATE ROLE %I WITH LOGIN PASSWORD ''%I''', rolename, role_password);
EXECUTE format('CREATE ROLE %I WITH LOGIN PASSWORD ''%s''', rolename, role_password);
EXECUTE format('GRANT CONNECT ON DATABASE %I TO %I', db_name, rolename);
EXECUTE format('GRANT USAGE ON SCHEMA public TO %I', rolename);
-- Privileges for existing objects
Expand All @@ -15,7 +15,7 @@ BEGIN
-- Default privileges (affects future objects)
EXECUTE format('ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO %I', rolename);
EXECUTE format('ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT USAGE ON SEQUENCES TO %I', rolename);
RETURN 'CREATE ROLE';
RETURN format('CREATE ROLE %I', rolename);
ELSE
-- Role already exists
RETURN format('ROLE ''%I'' ALREADY EXISTS', rolename);
Expand Down

0 comments on commit 35241b4

Please sign in to comment.