Skip to content

Commit

Permalink
Let there be leak
Browse files Browse the repository at this point in the history
  • Loading branch information
rotemplay committed Jun 27, 2022
0 parents commit 09d914c
Show file tree
Hide file tree
Showing 121 changed files with 25,389 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DS_Store
.idea
.git
.dockerignore
README.md
129 changes: 129 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Default values are optimized for production to avoid having to configure
# much in production.
#
# However it should be easy to get going in development too. If you see an
# uncommented option that means it's either mandatory to set it or it's being
# overwritten in development to make your life easier.

# Rather than use the directory name, let's control the name of the project.
export COMPOSE_PROJECT_NAME=leaktopus

# In development avoid writing out bytecode to __pycache__ directories.
#PYTHONDONTWRITEBYTECODE=
export PYTHONDONTWRITEBYTECODE=true

# You should generate a random string of 99+ characters for this value in prod.
# You can generate secure secrets by running: ./run flask secrets
export SECRET_KEY=insecure_key_for_dev

# Which environment is running? These should be "development" or "production".
#export FLASK_ENV=production
export FLASK_ENV=development
#export NODE_ENV=production
export NODE_ENV=development

# In development with Docker Desktop / Linux the default value should work.
# If you have Docker running in a custom VM, put the VM's IP here instead.
#
# In production you'll want to set this to your domain name or whatever you
# plan to access in your browser, such as example.com.
#export SERVER_NAME=localhost:8000

# The bind port for gunicorn.
#
# Be warned that if you change this value you'll need to change 8000 in both
# your Dockerfile and in a few spots in docker-compose.yml due to the nature of
# how this value can be set (Docker Compose doesn't support nested ENV vars).
#export PORT=8000

# How many workers and threads should your app use? WEB_CONCURRENCY defaults
# to the server's CPU count * 2. That is a good starting point. In development
# it's a good idea to use 1 to avoid race conditions when debugging.
#export WEB_CONCURRENCY=
export WEB_CONCURRENCY=1
#export PYTHON_MAX_THREADS=1

# Do you want code reloading to work with the gunicorn app server?
#export WEB_RELOAD=false
export WEB_RELOAD=true

# Should the Webpack watcher use polling? Not all Docker hosts support inotify.
# If you find your assets aren't updating in development then set this to true.
#export WEBPACK_WATCHER_POLL=false

## What mail server should you connect to?
#export MAIL_SERVER=smtp.gmail.com
#export MAIL_PORT=587
#export MAIL_USE_TLS=true
#export MAIL_USE_SSL=false
export MAIL_USERNAME=
export MAIL_PASSWORD=
#export [email protected]

## Connection string to Redis. This will be used to connect directly to Redis
# and for Celery. You can always split your Redis servers up later if needed.
#export REDIS_URL=redis://redis:6379/0

# You can choose between DEBUG, INFO, WARNING, ERROR, CRITICAL or FATAL.
# DEBUG tends to get noisy but it could be useful for troubleshooting.
#export CELERY_LOG_LEVEL=info

# Should Docker restart your containers if they go down in unexpected ways?
#export DOCKER_RESTART_POLICY=unless-stopped
export DOCKER_RESTART_POLICY=no

# What healthcheck test command do you want to run? In development, having it
# curl your web server will result in a lot of log spam, so setting it to
# /bin/true is an easy way to make the healthcheck do basically nothing.
#export DOCKER_WEB_HEALTHCHECK_TEST=curl localhost:8000/up
export DOCKER_WEB_HEALTHCHECK_TEST=/bin/true

# What ip:port should be published back to the Docker host for the app server?
# If you're using Docker Toolbox or a custom VM you can't use 127.0.0.1. This
# is being overwritten in dev to be compatible with more dev environments.
#
# If you have a port conflict because something else is using 8000 then you
# can either stop that process or change this 8000 to be something else.
#
# Use the default in production to avoid having gunicorn directly accessible to
# the internet since it'll very likely be behind nginx or a load balancer.
#export DOCKER_WEB_PORT_FORWARD=127.0.0.1:8000
export DOCKER_WEB_PORT_FORWARD=8000

# What volume path should be used? In development we want to volume mount
# everything so we can develop our code without rebuilding our Docker images.
#export DOCKER_WEB_VOLUME=./public:/app/public
export DOCKER_WEB_VOLUME=.:/app

# What CPU and memory constraints will be added to your services? When left at
# 0, they will happily use as much as needed.
#export DOCKER_REDIS_CPUS=0
#export DOCKER_REDIS_MEMORY=0
#export DOCKER_WEB_CPUS=0
#export DOCKER_WEB_MEMORY=0
#export DOCKER_WORKER_CPUS=0
#export DOCKER_WORKER_MEMORY=0

# GitPython Variables
export GIT_PYTHON_REFRESH=quiet

export ELK_VERSION=7.17.4

export GITHUB_ACCESS_TOKEN=[GITHUB_ACCESS_TOKEN]
export ES_INDEXING_ENABLED=1
export ES_HOST=elasticsearch
export ES_PORT=9200
export ES_USER=elastic
export ES_PASS=changeme
export CLONES_DIR=/data/

# Cron Interval in seconds, default of 15 minutes.
export CRON_INTERVAL=900
# Teams webhook
#export TEAMS_WEBHOOK_URL=https://company-name.webhook.office.com/webhookb2/token

# HTTPS enabled flag
export HTTPS_ENABLED=0

# Frontend environment variables
export LEAKTOPUS_API_URL=http://localhost:8000/
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.idea
.DS_Store
.env
app/*.pem
docker-compose.override.yml
venv
*.sqlite
53 changes: 53 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Contribution guidelines

## Development Environment Setup
If you wish to contribute to Leaktopus or run it in development mode, please follow this section.

### Customized Docker compose for development
The dev version of docker-compose shares the volumes with the host machine for easy debugging and development.
```bash
docker-compose -f docker-compose.dev.yml -f docker-compose.override.yml up
```

### Without Docker (Manual)
#### Prerequisites
- Python > 3.7
- Pip
- Node > 17.x
#### Backend
```bash
cd leaktopus_backend

# Required for using our .env file.
pip install python-dotenv

# Install all the dependencies.
pip install -r requirements.txt

# Run the application locally.
FLASK_APP="`pwd`/leaktopus/app.py" FLASK_DEBUG=1 flask run -p 8000

# To debug celery worker add these lines to the setting.py file.
import dotenv
dotenv.load_dotenv('./.env')
```

#### Frontend
```bash
cd leaktopus_frontend

npm install
npm run serve
```
---

## Development/Monitoring Services
In addition to the services mentioned on the README.md file,
the following services can be used for development and advanced monitoring purposes:

| Service | Port | Documentation |
| ------------- | ------------- | ------------- |
| Flower | 5555 | https://flower.readthedocs.io/en/latest/ |
| Redis Commander | 8081 | https://github.com/joeferner/redis-commander |

_See docker-compose.override.example.yml for deployment examples._
Loading

0 comments on commit 09d914c

Please sign in to comment.