Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update development mode scripts to containerize Poetry and other relevant dependencies #2144

Merged
merged 11 commits into from
Dec 4, 2024
Merged
31 changes: 26 additions & 5 deletions bin/install_poetry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ set -euo pipefail
export DEBIAN_FRONTEND=noninteractive

function install_apt_packages() {
if [[ "$OSTYPE" == 'darwin'* ]]; then
echo "Skipping installation of APT packages. Detected macOS."
return
fi

if [[ "$OSTYPE" == 'linux'* && ! -f /etc/debian_version ]]; then
echo "Skipping installation of APT packages. Detected non-Debian-based Linux distribution."
return
fi

sudo apt-get update -y && \
sudo apt-get install -y \
apt-utils \
curl \
Expand All @@ -14,10 +25,21 @@ function install_apt_packages() {
}

function install_python() {
sudo -E apt-get install -y \
python3 \
python3-pip \
python-is-python3
if [[ "$OSTYPE" == 'darwin'* ]]; then
# only install python3.11 on macOS if it's not already installed
if brew list | grep -q [email protected]; then
echo "Python 3.11 already installed. Skipping installation."
else
brew install [email protected]
fi
elif [[ "$OSTYPE" == 'linux'* && -f /etc/debian_version ]]; then
sudo -E apt-get install -y \
python3 \
python3-pip \
python-is-python3
else
echo "Skipping installation of Python. OS not supported."
fi
}

function install_pyenv {
Expand All @@ -40,7 +62,6 @@ function install_poetry() {
curl -sSL https://install.python-poetry.org | python3 -
}

sudo apt-get update -y
install_apt_packages
install_python
install_pyenv
Expand Down
13 changes: 13 additions & 0 deletions docs/developer-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ To simplify development of the server module of Anthias, we've created a Docker
> [!IMPORTANT]
> Anthias is using Docker's [buildx](https://docs.docker.com/engine/reference/commandline/buildx/) for the image builds. This is used both for cross compilation as well as for local caching. You might need to run `docker buildx create --use` first.

> [!IMPORTANT]
> If you're using a Mac, you might need to install the following dependencies:
> * [Docker Desktop](https://www.docker.com/products/docker-desktop)
nicomiguelino marked this conversation as resolved.
Show resolved Hide resolved
> * [Docker Compose](https://docs.docker.com/compose/install/)
> * [Brew](https://brew.sh/)

Assuming you're in the source code repository, simply run:

```bash
Expand All @@ -40,6 +46,13 @@ $ ./bin/start_development_server.sh
✔ Container anthias-anthias-nginx-1 Started 0.5s
```

> [!NOTE]
> Running the script will install Python 3.11, [pyenv](https://github.com/pyenv/pyenv),
> and [Poetry](https://python-poetry.org/) on your machine. This is to ensure that the
> development environment is consistent across different machines.
>
> The script currently supports Debian-based systems and macOS.

Running the command above will start the development server and you should be able to
access the web interface at `http://localhost:8000`.

Expand Down