Rework ./launcher commands
CONTRIBUTING.md, launcher, bootstrap, and env
This commit is contained in:
48
.github/CONTRIBUTING.md
vendored
48
.github/CONTRIBUTING.md
vendored
@@ -6,6 +6,44 @@ Hey, thanks for your interest in contributing! We're always looking for more han
|
||||
|
||||
## Setting up the development environments
|
||||
|
||||
### Downloading Git and Docker Compose
|
||||
|
||||
Let's make sure your system is updated...
|
||||
|
||||
```bash
|
||||
sudo apt update && sudo apt upgrade
|
||||
sudo apt upgrade git
|
||||
```
|
||||
|
||||
Now it's time to setup docker/compose. Assuming you already have the `curl` command installed you can run the following:
|
||||
|
||||
```bash
|
||||
curl https://get.docker.com | bash
|
||||
sudo groupadd docker
|
||||
sudo usermod -aG docker $USER
|
||||
```
|
||||
|
||||
Log out and back in so that your group membership is re-evaluated or run `newgrp docker`.
|
||||
Now we're going to configure docker to start on boot.
|
||||
|
||||
```bash
|
||||
sudo systemctl enable docker.service
|
||||
sudo systemctl enable containerd.service
|
||||
```
|
||||
|
||||
|
||||
We recommend using vscode (or `vscodium`) for development and disabling automatic extension updates:
|
||||

|
||||
|
||||
Once automatic extension updates are disabled let's download and install a Python extension for an improved Python development experience. Here's some [context](https://github.com/VSCodium/vscodium/issues/1556) on why we're downloading this version. Download url: [marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-python/vsextensions/vscode-pylance/2023.6.40/vspackage](https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-python/vsextensions/vscode-pylance/2023.6.40/vspackage)
|
||||
|
||||
To install the extension manually press `CTRL+SHIFT+X` or click on the extensions tab to open the extensions sidebar then select the 3 dots at the top...
|
||||
|
||||

|
||||
|
||||
Select the previously downloaded Pylance `.vsix` file and proceed with the installation. We also recommend installing extensions for TypeScript/JavaScript alongside the prettier and eslint extensions. If you're using VSCodium, check out [their docs on how to use Microsoft's VS Code Marketplace](https://github.com/VSCodium/vscodium/blob/master/docs/index.md#How-to-use-a-different-extension-gallery)
|
||||
|
||||
|
||||
|
||||
### Setting up the frontend
|
||||
|
||||
@@ -24,16 +62,22 @@ nvm use 18
|
||||
|
||||
We're using **`Python` 3.11.4** on the backend. I use and recommend checking out the [pyenv](https://github.com/pyenv/pyenv) project for managing multiple Python installations. However, do note Pyenv does not officially support Windows and does not work in Windows outside the Windows Subsystem for Linux (which we **highly recommend** using, I don't have the time or energy to support Windows specific ['features'](https://www.gnu.org/proprietary/malware-microsoft.en.html))
|
||||
|
||||
Here are the basic installation instructions that install the Python build dependencies and pyenv. I recommend checking out their docs if you run into any issues installing Python 3.11.4.
|
||||
|
||||
```bash
|
||||
# install build deps
|
||||
sudo apt update; sudo apt install build-essential libssl-dev zlib1g-dev \
|
||||
libbz2-dev libreadline-dev libsqlite3-dev curl \
|
||||
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev python3.11-venv
|
||||
|
||||
# run the automatic installer
|
||||
curl https://pyenv.run | bash
|
||||
# optionally, compile a dynamic bash extension to speed up pyenv. if this fails pyenv still works normally
|
||||
cd ~/.pyenv && src/configure && make -C src
|
||||
|
||||
# setup your shell environment
|
||||
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
|
||||
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
|
||||
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
|
||||
source ~/.bashrc
|
||||
```
|
||||
|
||||
After setting up the above you should reboot/open a new terminal/source your new environment for these changes to take effect. Once you do that the `pyenv` command will be available.
|
||||
|
||||
21
launcher
21
launcher
@@ -1,20 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
export OB_DIR="$(pwd)/ob"
|
||||
if [ -f ./ob/cmd/env ]; then
|
||||
cd $OB_DIR
|
||||
. ./cmd/env
|
||||
else
|
||||
echo "Error! Please run the ./launcher from the root osintbuddy directory only."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export OB_CMD=$1;
|
||||
export OB_CMD_ARGS=$2;
|
||||
export OB_CMD_OPT1=${3:-""};
|
||||
export OB_CMD_OPT2=${4:-""};
|
||||
export OB_CMD_OPT3=${5:-""};
|
||||
|
||||
export OB_DIR="$(pwd)/ob"
|
||||
|
||||
if [ -f ./ob/cmd/env ]; then
|
||||
cd $OB_DIR
|
||||
. ./cmd/env;
|
||||
else
|
||||
echo "Error! Please run the ./launcher only from the root osintbuddy directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# localhost:45910/login/oauth/authorize?client_id=&response_type=&redirect_uri=&scope=read&state=
|
||||
usage_containers () {
|
||||
echo ""
|
||||
@@ -63,6 +63,7 @@ usage () {
|
||||
|
||||
if [ -z "$OB_CMD" -a "$OB_CMD" != "cleanup" ]; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case "$OB_CMD" in
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
. ./cmd/env
|
||||
|
||||
# From https://stackoverflow.com/a/44660519/702738
|
||||
@@ -85,7 +85,7 @@ check_prereqs() {
|
||||
docker_rec_version='24.0.7'
|
||||
|
||||
git_min_version='1.8.0'
|
||||
git_rec_version='2.42.0'
|
||||
git_rec_version='2.34.0'
|
||||
|
||||
python_min_version='3.11.0'
|
||||
python_rec_version='3.11.4'
|
||||
@@ -127,7 +127,7 @@ check_prereqs() {
|
||||
warning "Some ./launcher commands may not work without a node environment."
|
||||
heading "Attempting to continue without Node..."
|
||||
fi
|
||||
|
||||
|
||||
test=($($node --version))
|
||||
test=${test[0]//v/} # Get version alone and strip the prefixed v
|
||||
|
||||
@@ -203,9 +203,9 @@ setup_python_env() {
|
||||
cd ..
|
||||
$python3 -m venv venv && \
|
||||
. ./venv/bin/activate && \
|
||||
$python3 -m pip install --upgrade pip && \
|
||||
$python3 -m pip install -r backend/requirements.txt && \
|
||||
$python3 -m pip install backend/osintbuddy-plugins
|
||||
python3 -m pip install --upgrade pip && \
|
||||
python3 -m pip install -r backend/requirements.txt && \
|
||||
python3 -m pip install backend/osintbuddy-plugins
|
||||
fi
|
||||
info "Activate virtual environment: . ./venv/bin/activate"
|
||||
cd "$OB_DIR"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/bash
|
||||
# used in ./ob/cmd/* scripts ran by ./launcher
|
||||
# used by ./ob/cmd/* scripts ran by this ./launcher
|
||||
. ./cmd/_colors
|
||||
|
||||
export node=`which node`
|
||||
@@ -19,16 +19,14 @@ ob_compose() {
|
||||
$docker_path-compose -f $COMPOSE_FILE -f $OB_COMPOSE_OVERRIDE "$@"
|
||||
}
|
||||
|
||||
|
||||
# Colored logs...
|
||||
function heading() { printf "$(c B1)[OSINTBuddy: $OB_CMD] ${WHITE}${1}${reset}\n"; }
|
||||
function warning() { printf "${BLUE}[OSINTBuddy: $OB_CMD] ${magenta}${1}${reset}\n"; }
|
||||
function warning() { printf "${BLUE}[OSINTBuddy: $OB_CMD] ${YELLOW}${1}${reset}\n"; }
|
||||
function error() { printf "${BLUE}[OSINTBuddy: $OB_CMD] ${red}${1}${reset}\n"; }
|
||||
function success() { printf "${BLUE}[OSINTBuddy: $OB_CMD] ${green}${1:-Completed successfully!}${reset}\n"; }
|
||||
function info() { printf "${BLUE}[OSINTBuddy: $OB_CMD] ${CYAN}${1:-''}${reset}\n"; }
|
||||
function abort() { printf "${BLUE}[OSINTBuddy: $OB_CMD] ${RED}${1:-Aborting!}${reset}\n\n"; exit 1; }
|
||||
|
||||
|
||||
function print_access_urls() {
|
||||
info "Once ready you can access OSINTBuddy through the following URLs:"
|
||||
info " http://localhost:3000 - frontend"
|
||||
|
||||
Reference in New Issue
Block a user