Skip to content

Commit

Permalink
chore: create image from template
Browse files Browse the repository at this point in the history
  • Loading branch information
Amninder Kaur committed Feb 21, 2024
1 parent f6febd9 commit e426b98
Show file tree
Hide file tree
Showing 15 changed files with 140 additions and 132 deletions.
2 changes: 0 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,3 @@ linker = "aarch64-linux-gnu-gcc"
[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-musl-gcc"
rustflags = ["-C", "target-feature=-crt-static"]


8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@ MONITOR_POLLING_INTERVAL_IN_SECS=5
MONITOR_TASK_RETENTION_PERIOD_IN_SECS=864000

RUST_LOG=ERROR

# POSTGRES ENV FOR CREATE DB
PG_DATABASE_TEMPLATE=
PG_DATABASE_ADMIN=
SCYLLA_CREATE_DB=

# FOR DROPPING THE DB
#SCYLLA_CLEANUP_MODE=
5 changes: 2 additions & 3 deletions .github/workflows/npm_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
uses: dtolnay/rust-toolchain@stable
if: ${{ !matrix.settings.docker }}
with:
toolchain: stable
toolchain: stable 3 months ago
target: ${{ matrix.settings.target }}
- name: Cache cargo
uses: actions/cache@v4
Expand Down Expand Up @@ -177,5 +177,4 @@ jobs:
- run: ls -R ./scylla_pg_js/artifacts

- name: Publish
run: PATH=$PATH:$(pwd) bin/npm-release.sh # only run on release created or tag

run: PATH=$PATH:$(pwd) bin/npm-release.sh # only run on release created or tag
2 changes: 1 addition & 1 deletion .github/workflows/rust_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v3
- uses: dtolnay/[email protected]
with:
toolchain: stable
toolchain: stable 3 months ago
- run: bin/ubuntu-setup.sh
- run: rustup component add rustfmt clippy
- name: cargo build
Expand Down
161 changes: 76 additions & 85 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ log = { version = "0.4", features = [
"std",
"kv_unstable_serde",
] }
env_logger = "0.10"
7 changes: 5 additions & 2 deletions Dockerfile.scylla_pg_migration
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN adduser \
WORKDIR /tmp
COPY ./ .
# Build binary in release mode
RUN cargo build --release --bin db_migrate
RUN cargo build --release --package scylla_pg_core

#
# Run image based on buster-slim to reduce image size while still using glibc
Expand All @@ -30,7 +30,10 @@ COPY --from=BUILD /etc/passwd /etc/passwd
COPY --from=BUILD /etc/group /etc/group
# Copy binary from build
COPY --from=BUILD /tmp/target/release/db_migrate ./
COPY --from=BUILD /tmp/target/release/db_create ./
COPY --from=BUILD /tmp/target/release/db_delete ./
COPY --from=BUILD /tmp/bin/create_db_and_migrate.sh ./
# Use an unprivileged user
USER ${USER}:${USER}
# Entry point
CMD ["/opt/build/db_migrate"]
CMD ["/opt/build/create_db_and_migrate.sh"]
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ pg.monitor:
db.migrate:
$(call pp,db migrate...)
cargo run --bin db_migrate

## db.create: 🧪 Creates a new DB
db.create:
$(call pp,db migrate...)
cargo run --bin db_create
# cargo run --bin db_delete
truncate:
$(call pp, truncate...)
RUSTFLAGS="" cargo run --bin truncate
Expand Down
5 changes: 4 additions & 1 deletion bin/component-test-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ echo PG_HOST=127.0.0.1 >> .env
echo PG_USER=admin >> .env
echo PG_PASSWORD=admin >> .env
echo PG_DATABASE=scylla >> .env
echo PG_DATABASE_ADMIN=postgres >> .env
echo PG_PORT=5432 >> .env
echo PG_POOL_SIZE=10 >> .env
echo DB_ENV=mig-test >> .env
# run db-migrations
make withenv RECIPE=db.create
# sleep
sleep 3
make withenv RECIPE=db.migrate


Loading

0 comments on commit e426b98

Please sign in to comment.