Skip to content

Commit

Permalink
(#39) | feat : setup build process for avni superset image
Browse files Browse the repository at this point in the history
  • Loading branch information
vedfordev committed Sep 7, 2024
1 parent ca76b04 commit 64e2a46
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ vars/*.tfvars
prod-user-pool.json
*-secret-vars.yml
/configure/certificates/**
/configure/dummy.yml
/configure/dummy.yml
/reportingSystem/superset/superset.env
27 changes: 27 additions & 0 deletions reportingSystem/superset/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
ARG TAG=latest

FROM apache/superset:${TAG}


#Copy avni logo and favicon
ADD --chown=superset https://raw.githubusercontent.com/avniproject/avni-website/master/src/img/avni-logo-color.png /app/superset/static/assets/images/avni.png
ADD --chown=superset https://github.com/avniproject/avni-webapp/raw/master/public/favicon.ico /app/superset/static/assets/images/avni-favicon.ico

# Copy the configuration file, set the environment variable,
COPY --chown=superset ./assets/superset_config.py /app/

#Environment variable
ENV SUPERSET_SECRET_KEY=""
ENV SUPERSET_DB_USER=postgres
ENV SUPERSET_DB_PASSWORD=password
ENV SUPERSET_DB_URL=host.docker.internal
ENV SUPERSET_DB_PORT=5432
ENV SUPERSET_CONFIG_PATH=/app/superset_config.py


# Expose the port
EXPOSE 8088


# Run superset
ENTRYPOINT ["superset", "run", "-h", "0.0.0.0", "-p", "8088", "--with-threads", "--reload", "--debugger"]
41 changes: 41 additions & 0 deletions reportingSystem/superset/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
IMAGE := vedfordocker/superset
TAG ?= 4.0.1

build-image:
@echo "building image $(IMAGE):$(TAG)"
docker image build --build-arg TAG=$(TAG) -t $(IMAGE):$(TAG) .

re-build-image:delete-image
@echo "building image $(IMAGE):$(TAG)"
docker image build --build-arg version=$(TAG) -t $(IMAGE):$(TAG) .

delete-image:
@if docker image inspect $(IMAGE):$(TAG) > /dev/null 2>&1; then \
echo "Image $(IMAGE):$(TAG) found. Deleting..."; \
docker image rm -f $(IMAGE):$(TAG); \
else \
echo "Image $(IMAGE):$(TAG) not found."; \
fi

push-image:
docker push $(IMAGE):$(TAG)


inspect-image:
docker image inspect $(IMAGE):$(TAG)

run-container:
docker run -d -p 8088:8088 \
--name superset_$(TAG) \
--env-file superset.env \
$(IMAGE):$(TAG)
@$(MAKE) get-container-logs

remove-container:
docker container rm -f superset_$(TAG)

get-container-logs:
docker logs -f superset_$(TAG)

execute-container:
docker container exec -it superset_$(TAG) bash
12 changes: 9 additions & 3 deletions reportingSystem/superset/assets/superset_config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
SECRET_KEY = # secret key add
import os

PREVIOUS_SECRET_KEY = # add details
# secret key add
SECRET_KEY = os.getenv('SUPERSET_SECRET_KEY')

CONTENT_SECURITY_POLICY_WARNING = False

Expand All @@ -12,7 +13,12 @@
"ALLOW_FULL_CSV_EXPORT": True
}

SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://<user>:<password>@<url>:5432/supersetdb'
DB_USER = os.getenv('SUPERSET_DB_USER')
DB_PASSWORD = os.getenv('SUPERSET_DB_PASSWORD')
DB_URL = os.getenv('SUPERSET_DB_URL')
DB_PORT = os.getenv('SUPERSET_DB_PORT')

SQLALCHEMY_DATABASE_URI = "postgresql+psycopg2://"+DB_USER+":"+DB_PASSWORD+"@"+DB_URL+":"+DB_PORT+"/supersetdb"

APP_ICON = "/static/assets/images/avni.png"

Expand Down

0 comments on commit 64e2a46

Please sign in to comment.