Skip to content

Commit

Permalink
Merge pull request #130 from intelowlproject/develop
Browse files Browse the repository at this point in the history
* adjusted dependabot config

* Bump library/nginx from 1.21.1-alpine to 1.23.4-alpine in /docker (#118)

Bumps library/nginx from 1.21.1-alpine to 1.23.4-alpine.

---
updated-dependencies:
- dependency-name: library/nginx
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update drf-spectacular requirement in /requirements (#119)

Updates the requirements on [drf-spectacular](https://github.com/tfranzel/drf-spectacular) to permit the latest version.
- [Release notes](https://github.com/tfranzel/drf-spectacular/releases)
- [Changelog](https://github.com/tfranzel/drf-spectacular/blob/master/CHANGELOG.rst)
- [Commits](tfranzel/drf-spectacular@0.22.0...0.26.1)

---
updated-dependencies:
- dependency-name: drf-spectacular
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* added twitter publish

* Update certego-saas requirement from ~=0.2.0 to ~=0.5.0 in /requirements (#124)

Updates the requirements on [certego-saas](https://github.com/certego/certego-saas) to permit the latest version.
- [Release notes](https://github.com/certego/certego-saas/releases)
- [Commits](certego/certego-saas@0.2.0...0.5.0)

---
updated-dependencies:
- dependency-name: certego-saas
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump myst-parser from 0.17.0 to 1.0.0 in /requirements (#120)

Bumps [myst-parser](https://github.com/executablebooks/MyST-Parser) from 0.17.0 to 1.0.0.
- [Release notes](https://github.com/executablebooks/MyST-Parser/releases)
- [Changelog](https://github.com/executablebooks/MyST-Parser/blob/master/CHANGELOG.md)
- [Commits](executablebooks/MyST-Parser@v0.17.0...v1.0.0)

---
updated-dependencies:
- dependency-name: myst-parser
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* added healthchecks

* fixed nginx location

* added back uwsgi and uwsgitop

* added stag override

* uwsgi adjustments

* adjusted uwsgi path and removed healthcheck for celery

* fixed uwsgi installation in alpine

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
mlodic and dependabot[bot] authored Apr 7, 2023
2 parents 1e8e33e + bb550d0 commit 962e4dd
Show file tree
Hide file tree
Showing 17 changed files with 79 additions and 33 deletions.
3 changes: 3 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Changelog
## [v1.1.1](https://github.com/honeynet/GreedyBear/releases/tag/v1.1.1)
Various fixes to the previous release

## [v1.1.0](https://github.com/honeynet/GreedyBear/releases/tag/v1.1.0)
**New features**
* Added a new "Feeds" section in the GUI where it is possible to browse available feeds
Expand Down
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ updates:
day: "tuesday"
target-branch: "develop"
reviewers:
- mlodi
- mlodic

- package-ecosystem: "npm"
directory: "/frontend"
Expand All @@ -27,7 +27,7 @@ updates:
day: "tuesday"
target-branch: "develop"
reviewers:
- mlodi
- mlodic


- package-ecosystem: "github-actions"
Expand All @@ -37,4 +37,4 @@ updates:
day: "tuesday"
target-branch: "develop"
reviewers:
- mlodi
- mlodic
17 changes: 17 additions & 0 deletions .github/workflows/twitter_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
permissions: read-all
name: publish-to-twitter
on:
release:
types: [released]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: infraway/[email protected]
with:
status: "published #IntelOwl ${{github.ref_name}}! https://github.com/intelowlproject/GreedyBear/releases/tag/${{github.ref_name}} #ThreatIntelligence #CyberSecurity #OpenSource #osint #honeypot #tpot"
api_key: ${{ secrets.TWITTER_API_KEY }}
api_key_secret: ${{ secrets.TWITTER_API_KEY_SECRET }}
access_token: ${{ secrets.TWITTER_ACCESS_TOKEN }}
access_token_secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
7 changes: 2 additions & 5 deletions configuration/nginx/django_server.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ server {
server_tokens off;
charset utf-8;

location /favicon.ico {
alias /var/www/static/favicon.ico;
access_log off;
log_not_found off;
}
# Locations
include locations.conf;

location /static/ {
alias /var/www/static/;
Expand Down
7 changes: 2 additions & 5 deletions configuration/nginx/http.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ server {

server_tokens off;

location /favicon.ico {
alias /var/www/static/favicon.ico;
access_log off;
log_not_found off;
}
# Locations
include locations.conf;

location /static/ {
alias /var/www/static/;
Expand Down
7 changes: 2 additions & 5 deletions configuration/nginx/https.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ server {

server_tokens off;

location /favicon.ico {
alias /var/www/static/favicon.ico;
access_log off;
log_not_found off;
}
# Locations
include locations.conf;

location /static/ {
alias /var/www/static/;
Expand Down
8 changes: 8 additions & 0 deletions configuration/nginx/locations.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
location /hc {
return 200;
}

location = /favicon.ico {
access_log off;
log_not_found off;
}
2 changes: 0 additions & 2 deletions configuration/uwsgi/greedybear.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,3 @@ reload-on-rss = 2048
worker-reload-mercy = 3600

buffer-size = 32768

need-app = true
2 changes: 1 addition & 1 deletion docker/.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
REACT_APP_GREEDYBEAR_VERSION="v1.1.0"
REACT_APP_GREEDYBEAR_VERSION="v1.1.1"
10 changes: 6 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ RUN PUBLIC_URL=/static/reactapp/ npm run build
# Stage 2: Backend
FROM python:3.9.16-alpine3.17

COPY --from=frontend-build /build /var/www/reactapp

ENV PYTHONUNBUFFERED 1
ENV DJANGO_SETTINGS_MODULE greedybear.settings
ENV PYTHONPATH /opt/deploy/greedybear
Expand All @@ -28,11 +26,12 @@ RUN mkdir -p ${LOG_PATH} \
${LOG_PATH}/django \
${LOG_PATH}/uwsgi \
# py3-psycopg2 is required to use PostgresSQL with Django
&& apk --no-cache -U add bash uwsgi py3-psycopg2 \
&& apk --no-cache -U add bash py3-psycopg2 gcc python3-dev alpine-sdk linux-headers \
&& pip3 install --upgrade pip

WORKDIR $PYTHONPATH
COPY . $PYTHONPATH
COPY --from=frontend-build /build /var/www/reactapp

# separation is required to avoid to re-execute os installation in case of change of python requirements
RUN pip3 install --no-cache-dir --compile -r $PYTHONPATH/requirements/project-requirements.txt \
Expand All @@ -43,5 +42,8 @@ RUN pip3 install --no-cache-dir --compile -r $PYTHONPATH/requirements/project-re
&& adduser -S -H -u 2000 -D -g www-data www-data \
&& chown -R www-data:www-data ${LOG_PATH} /opt/deploy/ \
&& rm -rf docs/ frontend/ tests/ .github/ \
&& /bin/bash ./docker/watchman_install.sh
&& /bin/bash ./docker/watchman_install.sh \
&& apk del gcc python3-dev alpine-sdk linux-headers

HEALTHCHECK --interval=10s --timeout=2s --start-period=20s --retries=5 CMD nc -z localhost 8001 || exit 1

6 changes: 4 additions & 2 deletions docker/Dockerfile_nginx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
FROM library/nginx:1.21.1-alpine
FROM library/nginx:1.23.4-alpine
RUN mkdir -p /var/cache/nginx /var/cache/nginx/feeds
RUN apk update && apk upgrade && apk add bash
ENV NGINX_LOG_DIR /var/log/nginx
# this is to avoid having these logs redirected to stdout/stderr
RUN rm $NGINX_LOG_DIR/access.log $NGINX_LOG_DIR/error.log
RUN touch $NGINX_LOG_DIR/access.log $NGINX_LOG_DIR/error.log
RUN chown 33:33 $NGINX_LOG_DIR/access.log $NGINX_LOG_DIR/error.log
VOLUME $NGINX_LOG_DIR
VOLUME $NGINX_LOG_DIR

HEALTHCHECK --interval=3s --start-period=2s --timeout=2s --retries=5 CMD curl --fail http://localhost/hc || exit 1
10 changes: 9 additions & 1 deletion docker/default.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
version: '3.8'

x-no-healthcheck: &no-healthcheck
healthcheck:
disable: true

services:
postgres:
image: library/postgres:13-alpine
Expand All @@ -13,13 +17,14 @@ services:
image: intelowlproject/greedybear:prod
container_name: greedybear_uwsgi
volumes:
- ../configuration/uwsgi/greedybear.ini:/etc/uwsgi/uwsgi.ini
- ../configuration/uwsgi/greedybear.ini:/etc/uwsgi/sites/greedybear.ini
- generic_logs:/var/log/greedybear
- static_content:/opt/deploy/greedybear/static
entrypoint:
- ./docker/entrypoint_uwsgi.sh
expose:
- "8001"
- "1717"
env_file:
- env_file
depends_on:
Expand All @@ -32,6 +37,7 @@ services:
volumes:
- ../configuration/nginx/http.conf:/etc/nginx/conf.d/default.conf
- ../configuration/nginx/errors.conf:/etc/nginx/errors.conf
- ../configuration/nginx/locations.conf:/etc/nginx/locations.conf
- nginx_logs:/var/log/nginx
- static_content:/var/www/static
ports:
Expand Down Expand Up @@ -60,6 +66,7 @@ services:
- rabbitmq
- postgres
- uwsgi
<<: *no-healthcheck

celery_worker_default:
image: intelowlproject/greedybear:prod
Expand All @@ -75,6 +82,7 @@ services:
- rabbitmq
- postgres
- uwsgi
<<: *no-healthcheck


volumes:
Expand Down
3 changes: 2 additions & 1 deletion docker/entrypoint_uwsgi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ done

# Apply database migrations
echo "Waiting for db to be ready..."
python manage.py makemigrations durin
python manage.py migrate

# Collect static files
Expand All @@ -26,5 +27,5 @@ if [[ $DEBUG == "True" ]] && [[ $DJANGO_TEST_SERVER == "True" ]];
then
python manage.py runserver 0.0.0.0:8001
else
/usr/local/bin/uwsgi --ini /etc/uwsgi/uwsgi.ini
/usr/local/bin/uwsgi --ini /etc/uwsgi/sites/greedybear.ini --stats 127.0.0.1:1717 --stats-http
fi
14 changes: 14 additions & 0 deletions docker/stag.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.8'

services:
uwsgi:
image: intelowlproject/greedybear:stag

nginx:
image: intelowlproject/greedybear_nginx:stag

celery_beat:
image: intelowlproject/greedybear:stag

celery_worker_default:
image: intelowlproject/greedybear:stag
2 changes: 1 addition & 1 deletion docs/source/schema.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: 3.0.3
info:
title: GreedyBear API specification
version: 1.1.0
version: 1.1.1
paths:
/api/apiaccess:
get:
Expand Down
2 changes: 1 addition & 1 deletion requirements/docs-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ sphinxcontrib-openapi==0.7.0
sphinxcontrib-redoc==1.6.0
# this is to fix this bug https://github.com/Tribler/tribler/issues/6624
mistune==0.8.4
myst-parser==0.17.0
myst-parser==1.0.0
6 changes: 4 additions & 2 deletions requirements/project-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ Django~=3.2.18
psycopg2-binary~=2.9.2
slack-sdk~=3.12.0
djangorestframework~=3.13.1
drf-spectacular~=0.22.0
certego-saas~=0.2.0
drf-spectacular~=0.26.1
certego-saas~=0.5.0
uwsgitop==0.11
uwsgi==2.0.21

0 comments on commit 962e4dd

Please sign in to comment.