-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* first commit * add changes * add changes * improve dockerfile and docker-compose.yaml and resolve issue with postgresql initialization on state manager * add changes * add changes * add changes * add changes * add .dockerignore
- Loading branch information
1 parent
6529922
commit 8d50d96
Showing
8 changed files
with
119 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/target/ | ||
/.github | ||
/.vscode | ||
/.git | ||
/cursor.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
POSTGRES_DB=atoma_proxy_db | ||
POSTGRES_USER=atoma_proxy_user | ||
POSTGRES_PASSWORD= | ||
|
||
TRACE_LEVEL=info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ target/ | |
config.toml | ||
logs/ | ||
cursor.toml | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Builder stage | ||
FROM rust:1.76-slim-bullseye as builder | ||
|
||
ARG TRACE_LEVEL | ||
|
||
# Install build dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
build-essential \ | ||
pkg-config \ | ||
libssl-dev \ | ||
curl \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /usr/src/atoma-proxy | ||
|
||
COPY . . | ||
|
||
# Build the application | ||
RUN RUST_LOG=${TRACE_LEVEL} cargo build --release --bin atoma-proxy | ||
|
||
# Final stage | ||
FROM debian:bullseye-slim | ||
|
||
# Install runtime dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
ca-certificates \ | ||
libssl1.1 \ | ||
libpq5 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /app | ||
|
||
# Create necessary directories | ||
RUN mkdir -p /app/logs | ||
|
||
# Copy the built binary from builder stage | ||
COPY --from=builder /usr/src/atoma-proxy/target/release/atoma-proxy /usr/local/bin/atoma-proxy | ||
|
||
# Copy configuration file | ||
COPY config.toml ./config.toml | ||
|
||
# Set executable permissions explicitly | ||
RUN chmod +x /usr/local/bin/atoma-proxy | ||
|
||
# Copy and set up entrypoint script | ||
COPY entrypoint.sh /usr/local/bin/ | ||
RUN chmod +x /usr/local/bin/entrypoint.sh | ||
|
||
# Copy host client.yaml and modify keystore path | ||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] | ||
|
||
# Use full path in CMD | ||
CMD ["/usr/local/bin/atoma-proxy", "--config-path", "/app/config.toml"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
services: | ||
db: | ||
image: postgres:13 | ||
restart: always | ||
environment: | ||
- POSTGRES_DB=${POSTGRES_DB} | ||
- POSTGRES_USER=${POSTGRES_USER} | ||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} | ||
ports: | ||
- "5432:5432" | ||
volumes: | ||
- postgres-data:/var/lib/postgresql/data | ||
networks: | ||
- atoma-network | ||
|
||
atoma-proxy: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
args: | ||
TRACE_LEVEL: ${TRACE_LEVEL:-info} | ||
volumes: | ||
- ./config.toml:/app/config.toml | ||
- ./logs:/app/logs | ||
- ${SUI_CONFIG_PATH:-~/.sui/sui_config}:/root/.sui/sui_config | ||
env_file: | ||
- .env | ||
ports: | ||
- "${ATOMA_SERVICE_PORT:-8080}:8080" # Expose Atoma service port | ||
depends_on: | ||
- db | ||
networks: | ||
- atoma-network | ||
|
||
volumes: | ||
postgres-data: | ||
|
||
networks: | ||
atoma-network: | ||
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
# Ensure the directory exists | ||
mkdir -p /root/.sui/sui_config | ||
|
||
# If client.yaml exists, modify it | ||
if [ -f /root/.sui/sui_config/client.yaml ]; then | ||
sed -i 's|File: .*|File: /root/.sui/sui_config/sui.keystore|' /root/.sui/sui_config/client.yaml | ||
fi | ||
|
||
# Execute the main command passed to the container | ||
exec "$@" |