-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
307 changed files
with
23,031 additions
and
4,609 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
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ [email protected] | |
SUPERUSER_PASSWORD=admi345n@12343453 | ||
|
||
DOMAIN_NAME=localhost | ||
PORT=80 | ||
PORT=8000 | ||
CALLBACK_URL_FOR_GITHUB=http://127.0.0.1:8000/ | ||
CALLBACK_URL_FOR_GOOGLE=http://127.0.0.1:8000/ | ||
CALLBACK_URL_FOR_FACEBOOK=http://127.0.0.1:8000/ | ||
|
@@ -17,8 +17,23 @@ LANGCHAIN_TRACING_V2=true | |
LANGCHAIN_PROJECT=default | ||
LANGCHAIN_ENDPOINT="https://api.smith.langchain.com" | ||
|
||
#Database URL | ||
DATABASE_URL=postgres://user:password@localhost:5432/dbname | ||
#Database Credentials | ||
POSTGRES_PASSWORD=postgres | ||
POSTGRES_USER=postgres | ||
POSTGRES_DB=example_db | ||
POSTGRES_PORT=5432 #default is 5432, but sometimes it may be occupied by other services. So you can change it to any other port. | ||
DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:${POSTGRES_PORT}/${POSTGRES_DB} | ||
|
||
#Sentry DSN | ||
SENTRY_DSN=https://[email protected]/0 | ||
|
||
SLACK_CLIENT_ID= | ||
SLACK_CLIENT_SECRET= | ||
|
||
|
||
#BlueSky User Details | ||
BLUESKY_USERNAME=example.bsky.social | ||
BLUESKY_PASSWORD='example#123' | ||
|
||
GITHUB_ACCESS_TOKEN="abc123" | ||
|
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,89 @@ | ||
name: Validate PR Closing Issues | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- edited | ||
- reopened | ||
- synchronize | ||
|
||
permissions: | ||
pull-requests: read | ||
contents: read | ||
issues: read | ||
|
||
jobs: | ||
validate_pr_closing_issues: | ||
runs-on: ubuntu-latest | ||
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' && github.actor != 'dependabot' | ||
steps: | ||
- name: Validate PR closing issues with GraphQL | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
REPO_OWNER=${{ github.repository_owner }} | ||
REPO_NAME=${{ github.event.repository.name }} | ||
PR_NUMBER=${{ github.event.pull_request.number }} | ||
echo "Validating PR #${PR_NUMBER} in repository ${REPO_OWNER}/${REPO_NAME}" | ||
# Construct the GraphQL query | ||
QUERY=$(jq -n \ | ||
--arg repoOwner "$REPO_OWNER" \ | ||
--arg repoName "$REPO_NAME" \ | ||
--argjson prNumber "$PR_NUMBER" \ | ||
'{ | ||
query: "query($REPO_NAME: String!, $REPO_OWNER: String!, $PR_NUMBER: Int!) { | ||
repository(owner: $REPO_OWNER, name: $REPO_NAME) { | ||
pullRequest(number: $PR_NUMBER) { | ||
id | ||
closingIssuesReferences(first: 50) { | ||
edges { | ||
node { | ||
id | ||
body | ||
number | ||
title | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}", | ||
variables: { | ||
REPO_OWNER: $repoOwner, | ||
REPO_NAME: $repoName, | ||
PR_NUMBER: $prNumber | ||
} | ||
}') | ||
# echo "GraphQL Query: $QUERY" | ||
# Make the GraphQL API request | ||
RESPONSE=$(curl -s -X POST \ | ||
--location 'https://api.github.com/graphql' \ | ||
-H "Authorization: bearer $GITHUB_TOKEN" \ | ||
-H "Content-Type: application/json" \ | ||
--data "$QUERY") | ||
# echo "GraphQL Response:" | ||
# echo "$RESPONSE" | ||
# Check for errors in the response | ||
ERRORS=$(echo "$RESPONSE" | jq -r '.errors') | ||
if [[ "$ERRORS" != "null" ]]; then | ||
echo "GraphQL query failed with errors: $ERRORS" | ||
exit 1 | ||
fi | ||
# Extract closing issues | ||
CLOSING_ISSUES=$(echo "$RESPONSE" | jq -r '.data.repository.pullRequest.closingIssuesReferences.edges') | ||
if [[ "$CLOSING_ISSUES" == "[]" || -z "$CLOSING_ISSUES" ]]; then | ||
echo "Error: No closing issues are referenced in the PR description. Add it in the PR under: Successfully merging this pull request may close these issues." | ||
exit 1 | ||
fi | ||
echo "Closing issues found: $CLOSING_ISSUES" | ||
echo "PR description is valid with referenced closing issues." |
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 |
---|---|---|
|
@@ -17,4 +17,5 @@ chromedriver | |
requirements.txt | ||
*.code-workspace | ||
*.log | ||
*.exe | ||
*.exe | ||
.vs |
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 @@ | ||
git |
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 |
---|---|---|
@@ -1,30 +1,68 @@ | ||
FROM python:3.11.2 | ||
# Stage 1: Build stage | ||
FROM python:3.11.2 AS builder | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
RUN mkdir /blt | ||
WORKDIR /blt | ||
COPY . /blt | ||
|
||
|
||
# Install PostgreSQL dependencies | ||
# Install system dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y postgresql-client libpq-dev && \ | ||
apt-get install -y postgresql-client libpq-dev \ | ||
libmemcached11 libmemcachedutil2 libmemcached-dev libz-dev \ | ||
dos2unix && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install pylibmc dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
libmemcached11 \ | ||
libmemcachedutil2 \ | ||
libmemcached-dev \ | ||
libz-dev | ||
# # Install Chrome WebDriver | ||
# RUN CHROMEDRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` && \ | ||
# mkdir -p /opt/chromedriver-$CHROMEDRIVER_VERSION && \ | ||
# curl -sS -o /tmp/chromedriver_linux64.zip http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip && \ | ||
# unzip -qq /tmp/chromedriver_linux64.zip -d /opt/chromedriver-$CHROMEDRIVER_VERSION && \ | ||
# rm /tmp/chromedriver_linux64.zip && \ | ||
# chmod +x /opt/chromedriver-$CHROMEDRIVER_VERSION/chromedriver && \ | ||
# ln -fs /opt/chromedriver-$CHROMEDRIVER_VERSION/chromedriver /usr/local/bin/chromedriver | ||
|
||
# Install Google Chrome | ||
RUN curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \ | ||
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list && \ | ||
apt-get -yqq update && \ | ||
apt-get -yqq install google-chrome-stable && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN ln -s /usr/bin/google-chrome-stable /usr/local/bin/google-chrome | ||
|
||
RUN pip install poetry | ||
# Install Poetry and dependencies | ||
RUN pip install poetry | ||
RUN poetry config virtualenvs.create false | ||
COPY pyproject.toml poetry.lock* ./ | ||
RUN poetry lock --no-update | ||
RUN poetry install | ||
|
||
RUN python manage.py migrate | ||
RUN python manage.py loaddata website/fixtures/initial_data.json | ||
# RUN python manage.py collectstatic | ||
RUN python manage.py initsuperuser | ||
# Install additional Python packages | ||
RUN pip install opentelemetry-api opentelemetry-instrumentation | ||
|
||
# Stage 2: Runtime stage | ||
FROM python:3.11.2-slim | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
WORKDIR /blt | ||
|
||
# Copy only necessary files from builder stage | ||
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages | ||
COPY --from=builder /usr/local/bin /usr/local/bin | ||
|
||
# Install runtime system dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y postgresql-client libpq-dev \ | ||
libmemcached11 libmemcachedutil2 dos2unix && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy application code | ||
COPY . /blt | ||
|
||
# Convert line endings and set permissions | ||
RUN dos2unix Dockerfile docker-compose.yml entrypoint.sh ./blt/settings.py | ||
# Check if .env exists and run dos2unix on it, otherwise skip | ||
RUN if [ -f /blt/.env ]; then dos2unix /blt/.env; fi | ||
RUN chmod +x /blt/entrypoint.sh | ||
|
||
ENTRYPOINT ["/blt/entrypoint.sh"] | ||
CMD ["poetry", "run", "python", "manage.py", "runserver", "0.0.0.0:8000"] |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
release: python manage.py migrate --noinput | ||
web: gunicorn blt.wsgi --log-file - | ||
web: bin/start-pgbouncer uvicorn blt.asgi:application --host 0.0.0.0 --port ${PORT} |
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
Oops, something went wrong.