-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
76 changed files
with
9,304 additions
and
6,806 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
source ~/.venvs/z_env/bin/activate | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
#!/bin/sh | ||
|
||
DIR="$(cd "$(dirname "$0")" && pwd)" | ||
|
||
echo $DIR | ||
for rule_name in $DIR/rules; do | ||
$DIR/rules/routes_should_not_end_in_slash | ||
cd "$DIR/rules" | ||
./routes_should_not_end_in_slash | ||
done |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Publish Docker Image | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
push_to_registry: | ||
name: Push Docker image to Docker Hub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: zeeguu/api | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Render ARchitectural Diff with ArchLens | ||
|
||
jobs: | ||
render-diff-and-upload-comment: | ||
permissions: write-all | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- id: run_archlens | ||
uses: archlens/render-diff-on-pr@main | ||
with: | ||
config-path: "archlens.json" | ||
render-diff: "true" | ||
BRANCH_NAME: "_archlens_diff" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
name: Python package | ||
name: Unit Testing | ||
|
||
on: [push] | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
push: | ||
|
||
jobs: | ||
build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ instance | |
dev_data_folder* | ||
.idea/ | ||
.cache/ | ||
data/ | ||
|
||
*.pyc | ||
*.egg-info | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
FROM python:3.12.3 | ||
|
||
RUN apt-get clean all | ||
RUN apt-get update | ||
RUN apt-get upgrade -y | ||
RUN apt-get dist-upgrade -y | ||
|
||
# Git | ||
# --- | ||
# required by github dependencies in requirements.txt | ||
RUN apt-get -y install git | ||
|
||
|
||
# mysql CL client | ||
# ------------------------- | ||
# - good for debugging sometimes | ||
RUN apt-get install -y mysql\* | ||
|
||
|
||
# libmysqlclient | ||
# -------------- | ||
# - required to be able to install mysqlclient with pip | ||
# 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 | ||
# ------------------------- | ||
# - good for debugging sometimes | ||
RUN apt-get install -y mysql\* | ||
|
||
|
||
# libmysqlclient | ||
# -------------- | ||
# - required to be able to install mysqlclient with pip | ||
# https://stackoverflow.com/questions/5178292/pip-install-mysql-python-fails-with-environmenterror-mysql-config-not-found | ||
RUN apt-get install -y default-libmysqlclient-dev | ||
|
||
|
||
# Apache | ||
# ------ | ||
RUN apt-get install -y \ | ||
apache2 \ | ||
apache2-dev \ | ||
vim | ||
|
||
|
||
# mod_wsgi | ||
# -------- | ||
RUN pip install mod_wsgi | ||
|
||
RUN /bin/bash -c 'mod_wsgi-express install-module | tee /etc/apache2/mods-available/wsgi.{load,conf}' | ||
RUN a2enmod wsgi | ||
RUN a2enmod headers | ||
|
||
# ML: maybe better to map this file from outside? | ||
RUN echo '\n\ | ||
<VirtualHost *:8080>\n\ | ||
WSGIDaemonProcess zeeguu_api home=/zeeguu-data/ python-path=/Zeeguu-API/\n\ | ||
WSGIScriptAlias / /Zeeguu-API/zeeguu_api.wsgi\n\ | ||
<Location />\n\ | ||
WSGIProcessGroup zeeguu_api\n\ | ||
WSGIApplicationGroup %{GLOBAL}\n\ | ||
</Location>\n\ | ||
<Directory "/Zeeguu-API">\n\ | ||
<Files "zeeguu_api.wsgi">\n\ | ||
Require all granted\n\ | ||
</Files>\n\ | ||
</Directory>\n\ | ||
ErrorLog ${APACHE_LOG_DIR}/error.log\n\ | ||
LogLevel info\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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/env python | ||
#!python3 | ||
import logging | ||
|
||
# this is needed since when run as wsgi this script | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,10 @@ | ||
from zeeguu.core.model import User | ||
from zeeguu.core.user_statistics.activity import exercises_duration_by_day | ||
from zeeguu.core.content_retriever.parse_with_readability_server import download_and_parse | ||
|
||
from zeeguu.api.app import create_app | ||
|
||
app = create_app() | ||
app.app_context().push() | ||
|
||
print("before the for") | ||
for id in User.all_recent_user_ids(150): | ||
u = User.find_by_id(id) | ||
print(u.name) | ||
duration_old = exercises_duration_by_day(u, True) | ||
duration_new = exercises_duration_by_day(u) | ||
if duration_new != duration_old: | ||
print("old way") | ||
print(duration_old) | ||
print("new way") | ||
print(duration_new) | ||
na = download_and_parse( | ||
"https://www.dr.dk/stories/1288510966/allerede-inden-oscar-showets-start-lurer-en-ny-skandale-i-kulissen") | ||
print(na) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.