Boavizta / boaviztapi

๐Ÿ›  Giving access to BOAVIZTA reference data and methodologies trough a RESTful API
GNU Affero General Public License v3.0
66 stars 23 forks source link

Document compilation or serverless deployment on MS WSL2 with Ubuntu 22.04 #119

Open demeringo opened 1 year ago

demeringo commented 1 year ago

Problem

I struggled a little to compile / deploy application using a Windows 10. I am using Ubuntu 22.04 instance on WSL2.

It seems to be working now, but I had to perform some undocumented steps.

Solution

Update documentation with specific steps I had to do to compile / deploy the API (i.e. push my notes to the doc)

Alternatives

Additional context or elements

da-ekchajzer commented 1 year ago

Did you use the docker image : https://github.com/Boavizta/boaviztapi/pkgs/container/boaviztapi ?

demeringo commented 1 year ago

No problem to run the docker image, it works flawlessly.

I had some issues when trying to build a local version without docker (so that I can later deploy with serverless).

This related to doing it in WSL (Ubuntu in windows).

Mostly due to non compatible python versions that comes with this Ubuntu image, and some issues with corporate Certificates Authorities....

Nothing hard to fix I suppose for a experienced phytonista ;-) ... but I struggled a bit because I was not that familiar with python tooling ๐Ÿ˜œ.

I have to organize this cleanly into the doc but for the record I leave my notes there:

Setting up Python / Pip (pyenv + pipenv) to supprt boavizta API and deploy on WSL2 (on Ubuntu 22.04)

# Follow up on installing inside WSL
# Remove defautl pip env (on Ubuntu 22.04)
sudo apt remove pipenv
# Install custom pipenv
# this fails (cert issue)
pip --cert <REDACTED> install pipenv
# ๐Ÿดโ€โ˜ ๏ธ WARING: it entirely skips ssl verification !!
pip --trusted-host pypi.org --trusted-host files.pythonhosted.org install pipenv

# Need python 3.6
# 1. install pyenv
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

# 2. Seems I need deps for building python
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python3-openssl

# 3. install python 3.6
# ๐Ÿดโ€โ˜ ๏ธ WARING: it entirely skips ssl verification !!
export PIP_TRUSTED_HOST=pypi.org  
export PIP_TRUSTED_HOST_FILE=files.pythonhosted.org
export REQUESTS_CA_BUNDLE=<REDACTED>
pipenv --python 3.6
demeringo commented 1 year ago

To be clear: the issue is fixed from my perspective. But I would like to contribute theses steps to the doc when time permit ;-)

da-ekchajzer commented 1 year ago

I understand ! I work on the documentation of the v0.2 here : https://github.com/Boavizta/boaviztapi/tree/documentation/v0.2/docs