Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into 275-add-a-way-to-…
Browse files Browse the repository at this point in the history
…run-semantic-search-on-text
  • Loading branch information
tfnribeiro committed Nov 22, 2024
2 parents 8a1c7fc + 01c505f commit 732ae8c
Show file tree
Hide file tree
Showing 77 changed files with 1,364 additions and 1,465 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements_v8.txt ]; then pip install --force-reinstall -r requirements_v8.txt; fi
pip install -r requirements.txt
python setup.py develop
- name: Test with pytest
run: |
Expand Down
67 changes: 36 additions & 31 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,6 @@ RUN apt-get install -y mysql\*
# https://stackoverflow.com/questions/5178292/pip-install-mysql-python-fails-with-environmenterror-mysql-config-not-found
RUN apt-get install -y default-libmysqlclient-dev

# Zeeguu-Api
# ----------

# Declare that this will be mounted from a volume
VOLUME /Zeeguu-API

# We need to copy the requirements file it in order to be able to install it
# However, we're not copying the whole folder, such that in case we make a change in the folder
# (e.g. to this build file) the whole cache is not invalidated and the build process does
# not have to start from scratch
RUN mkdir /Zeeguu-API
COPY ./requirements.txt /Zeeguu-API/requirements.txt
COPY ./setup.py /Zeeguu-API/setup.py

# Install requirements and setup
WORKDIR /Zeeguu-API

RUN python -m pip install -r requirements.txt
RUN python setup.py develop

# Copy the rest of the files
# (this is done after the requirements are installed, so that the cache is not invalidated)
WORKDIR /Zeeguu-API
COPY . /Zeeguu-API

ENV ZEEGUU_CONFIG=/Zeeguu-API/default_docker.cfg

VOLUME /zeeguu-data


# mysql CL client
# -------------------------
Expand Down Expand Up @@ -101,11 +72,45 @@ RUN echo '\n\
CustomLog ${APACHE_LOG_DIR}/access.log combined\n\
</VirtualHost>' > /etc/apache2/sites-available/zeeguu-api.conf

RUN a2dissite 000-default.conf
RUN a2ensite zeeguu-api

RUN chown -R www-data:www-data /var/www


# have apache listen on port 8080
RUN sed -i "s,Listen 80,Listen 8080,g" /etc/apache2/ports.conf


# Zeeguu-Api
# ----------

# Declare that this will be mounted from a volume
VOLUME /Zeeguu-API

# We need to copy the requirements file it in order to be able to install it
# However, we're not copying the whole folder, such that in case we make a change in the folder
# (e.g. to this build file) the whole cache is not invalidated and the build process does
# not have to start from scratch
RUN mkdir /Zeeguu-API
COPY ./requirements.txt /Zeeguu-API/requirements.txt
COPY ./setup.py /Zeeguu-API/setup.py

# Install requirements and setup
WORKDIR /Zeeguu-API

RUN python -m pip install -r requirements.txt
RUN python setup.py develop

# Copy the rest of the files
# (this is done after the requirements are installed, so that the cache is not invalidated)
WORKDIR /Zeeguu-API
COPY . /Zeeguu-API

ENV ZEEGUU_CONFIG=/Zeeguu-API/default_docker.cfg

VOLUME /zeeguu-data


RUN a2dissite 000-default.conf
RUN a2ensite zeeguu-api


13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,17 @@ So for running the development server this is ok, but for actual development, th
# From docker-compose on Mac OS

## Starting the API

- create a local folder where you want to store zeeguu data, e.g. `mkdir /Users/mircea/zeeguu-data`
- make sure that you have `envsubst` installed (i.e. `brew install gettext`)
- copy the content of `default_env` to a newly created `.env` file
- run `generate-configs.sh`; verify that `api.cfg` and `fmd.cfg` have meaningful values inside
- run `docker compose up`
- once everything is up, go to `localhost:8080/available_languages`: if you see an array like `["de", "es", "fr", "nl", "en"]` you have the API working.

## Developing
## Developing

Once you make changes to the code you have to restart the apache2ctl inside the container. To test this do the following:
Once you make changes to the code you have to restart the apache2ctl inside the container. To test this do the following:

- try to change the implementaiton of `available_languages` in `system_languages.py` and then
run `docker exec -it api-zapi-1 apache2ctl restart`
Expand All @@ -118,3 +119,11 @@ I define the following:
export MYSQLCLIENT_CFLAGS="-I/opt/homebrew/opt/mysql-client/include/mysql/"
export MYSQLCLIENT_LDFLAGS="-L/opt/homebrew/opt/mysql-client/lib -lmysqlclient"
```

## Connecting and loading a database in DBeaver

- expose port 3306 to connect to local db by adding `- ports:"3306-3306"` to your docker-compose file
- create a new database connection in DBeaver and use Server Host `localhost`and Port `3306`
- import data to your local db by adding a `backups` folder to zeeguu-data and adding volume `- ${ZEEGUU_DATA_FOLDER}/backups:/backups` to the docker-compose file
- run `docker exec -it <CONTAINER ID FOR DB> sh`
- run `mysql -uroot -p -h localhost zeeguutest < zeeguu_db_anon_2024-10-16.sql` and enter the root password
168 changes: 0 additions & 168 deletions docker-compose-v8.yml

This file was deleted.

Loading

0 comments on commit 732ae8c

Please sign in to comment.