From 20b6f589bfcc2ec4eb7e825c390172b094159700 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Thu, 6 Jul 2017 18:32:21 +0200 Subject: [PATCH] Add bin as submodule, prepare lib as global lib directory --- .gitignore | 1 + .gitmodules | 13 ++++- Dockerfile | 16 ++++-- app/requirements.txt | 7 +++ app/routers.py | 56 ------------------- bin | 1 + docker-compose.yml | 24 ++------ env/dev.yml | 20 ------- env/lib.yml | 25 --------- requirements-python.txt | 13 ----- requirements-debian.txt => requirements.txt | 2 +- {bin => tmp/bin}/build_doc.sh | 0 {bin => tmp/bin}/build_front.sh | 0 {bin => tmp/bin}/build_graph.sh | 0 {bin => tmp/bin}/build_messages.sh | 0 {bin => tmp/bin}/build_readme.sh | 0 {bin => tmp/bin}/collectstatic.sh | 0 {bin => tmp/bin}/db/backup.sh | 0 {bin => tmp/bin}/db/backup_db_eve.sh | 0 {bin => tmp/bin}/db/backup_db_mysql.sh | 0 {bin => tmp/bin}/db/restore.sh | 0 {bin => tmp/bin}/db/restore_db_eve.sh | 0 {bin => tmp/bin}/db/restore_db_mysql.sh | 0 {bin => tmp/bin}/docker-build.sh | 0 {bin => tmp/bin}/install.py | 0 {bin => tmp/bin}/makemigrations.sh | 0 {bin => tmp/bin}/migrate.sh | 0 {bin => tmp/bin}/pf_osx.sh | 0 {bin => tmp/bin}/poll_twitter.sh | 0 {bin => tmp/bin}/pull.sh | 0 {bin => tmp/bin}/push.sh | 0 {bin => tmp/bin}/tmp/fs_migrate.sh | 0 {bin => tmp/bin}/update_translation_fields.sh | 0 {bin => tmp/bin}/upgrade.sh | 0 34 files changed, 36 insertions(+), 142 deletions(-) create mode 100644 app/requirements.txt delete mode 100644 app/routers.py create mode 160000 bin delete mode 100644 env/lib.yml delete mode 100644 requirements-python.txt rename requirements-debian.txt => requirements.txt (100%) rename {bin => tmp/bin}/build_doc.sh (100%) rename {bin => tmp/bin}/build_front.sh (100%) rename {bin => tmp/bin}/build_graph.sh (100%) rename {bin => tmp/bin}/build_messages.sh (100%) rename {bin => tmp/bin}/build_readme.sh (100%) rename {bin => tmp/bin}/collectstatic.sh (100%) rename {bin => tmp/bin}/db/backup.sh (100%) rename {bin => tmp/bin}/db/backup_db_eve.sh (100%) rename {bin => tmp/bin}/db/backup_db_mysql.sh (100%) rename {bin => tmp/bin}/db/restore.sh (100%) rename {bin => tmp/bin}/db/restore_db_eve.sh (100%) rename {bin => tmp/bin}/db/restore_db_mysql.sh (100%) rename {bin => tmp/bin}/docker-build.sh (100%) rename {bin => tmp/bin}/install.py (100%) rename {bin => tmp/bin}/makemigrations.sh (100%) rename {bin => tmp/bin}/migrate.sh (100%) rename {bin => tmp/bin}/pf_osx.sh (100%) rename {bin => tmp/bin}/poll_twitter.sh (100%) rename {bin => tmp/bin}/pull.sh (100%) rename {bin => tmp/bin}/push.sh (100%) rename {bin => tmp/bin}/tmp/fs_migrate.sh (100%) rename {bin => tmp/bin}/update_translation_fields.sh (100%) rename {bin => tmp/bin}/upgrade.sh (100%) diff --git a/.gitignore b/.gitignore index 3f3530c6..c10e0be3 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ develop-eggs data postgres mysql +tmp # Installer logs pip-log.txt diff --git a/.gitmodules b/.gitmodules index 3866dac3..ad5be2c1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +1,19 @@ -[submodule "lib/mezzanine-agenda"] - path = lib/mezzanine-agenda - url = https://github.com/yomguy/mezzanine-agenda.git [submodule "lib/mezzanine"] path = lib/mezzanine url = https://github.com/yomguy/mezzanine.git + branch = jquery +[submodule "lib/mezzanine-agenda"] + path = lib/mezzanine-agenda + url = https://github.com/yomguy/mezzanine-agenda.git + branch = master [submodule "lib/mezzanine-organization"] path = lib/mezzanine-organization url = https://github.com/Ircam-Web/mezzanine-organization.git + branch = split [submodule "lib/mezzanine-organization-themes"] path = lib/mezzanine-organization-themes url = https://github.com/Ircam-Web/mezzanine-organization-themes.git + branch = master +[submodule "bin"] + path = bin + url = https://github.com/Ircam-Web/mezzo-bin.git diff --git a/Dockerfile b/Dockerfile index 6533730d..e232b319 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,9 +8,9 @@ WORKDIR /srv RUN apt-get update && apt-get install -y apt-transport-https COPY etc/apt/sources.list /etc/apt/ -COPY requirements-debian.txt /srv +COPY requirements.txt /srv RUN apt-get update && \ - DEBIAN_PACKAGES=$(egrep -v "^\s*(#|$)" /srv/requirements-debian.txt) && \ + DEBIAN_PACKAGES=$(egrep -v "^\s*(#|$)" /srv/requirements.txt) && \ apt-get install -y --force-yes $DEBIAN_PACKAGES && \ echo fr_FR.UTF-8 UTF-8 >> /etc/locale.gen && \ locale-gen && \ @@ -20,16 +20,20 @@ ENV LANG fr_FR.UTF-8 ENV LANGUAGE fr_FR:fr ENV LC_ALL fr_FR.UTF-8 -COPY package.json /srv +COPY lib/mezzanine-organization-themes/package.json /srv RUN npm install RUN npm install -g gulp RUN npm install -g bower -COPY Gemfile /srv +COPY lib/mezzanine-organization-themes/Gemfile /srv RUN gem install bundler RUN bundle install -COPY requirements-python.txt /srv -RUN pip install -r requirements-python.txt --src /srv/lib +COPY app/requirements.txt /srv/app +RUN pip install -r app/requirements.txt + +COPY lib /srv +COPY bin/setup_lib.sh /srv +RUN setup_lib.sh WORKDIR /srv/app diff --git a/app/requirements.txt b/app/requirements.txt new file mode 100644 index 00000000..7efbc04b --- /dev/null +++ b/app/requirements.txt @@ -0,0 +1,7 @@ +setuptools +uwsgi +mysqlclient +psycopg2 + +-e git+https://github.com/yomguy/grappelli-safe.git@dynamic_stacked#egg=grappelli-safe-0.4.2 +-e git+https://github.com/yomguy/cartridge.git#egg=cartridge-0.12-dev diff --git a/app/routers.py b/app/routers.py deleted file mode 100644 index cef15f85..00000000 --- a/app/routers.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. - -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - - - -class Router(object): - """ - A router to control all database operations between the 2 apps - """ - def db_for_read(self, model, **hints): - if model._meta.app_label == 'eve': - return 'eve' - if model._meta.app_label == 'presta': - return 'presta' - return None - - def db_for_write(self, model, **hints): - if model._meta.app_label == 'eve': - return 'eve' - if model._meta.app_label == 'presta': - return 'presta' - return None - - def allow_relation(self, obj1, obj2, **hints): - if obj1._meta.app_label == 'eve' or \ - obj2._meta.app_label == 'eve': - return True - if obj1._meta.app_label == 'presta' or \ - obj2._meta.app_label == 'presta': - return True - return None - - def allow_migrate(self, db, app_label, model=None, **hints): - if app_label == 'eve': - return db == 'eve' - if app_label == 'presta': - return db == 'presta' - return None diff --git a/bin b/bin new file mode 160000 index 00000000..1e524ee4 --- /dev/null +++ b/bin @@ -0,0 +1 @@ +Subproject commit 1e524ee43dba281f6f04304f435df6c61e0e4d1b diff --git a/docker-compose.yml b/docker-compose.yml index 36a2ccdc..4646b16c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,30 +43,18 @@ db: app: build: . - command: /bin/bash bin/app.sh + command: /bin/sh bin/app.sh --runserver volumes: - ./app:/srv/app - - ./lib/mezzanine/:/srv/lib/mezzanine - - ./lib/mezzanine-agenda:/srv/lib/mezzanine-agenda - - ./lib/mezzanine-organization:/srv/lib/mezzanine-organization - - ./lib/mezzanine-organization-themes:/srv/lib/mezzanine-organization-themes + - ./lib/:/srv/lib/ + volumes_from: - var expose: - "8000" + ports: + - "9022:8000" links: - db environment: - - DEBUG=False - -nginx: - image: nginx - ports: - - "8022:80" - volumes: - - ./etc/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf - - ./etc/nginx/htpasswd:/etc/nginx/htpasswd - volumes_from: - - var - links: - - app + - DEBUG=True diff --git a/env/dev.yml b/env/dev.yml index 01ec3572..58658d2e 100644 --- a/env/dev.yml +++ b/env/dev.yml @@ -1,23 +1,3 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2015 Guillaume Pellerin - -# Manifeste is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. - -# Manifeste is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with Manifeste. If not, see . - -# Authors: -# Guillaume Pellerin - app: command: /bin/sh bin/app.sh --runserver diff --git a/env/lib.yml b/env/lib.yml deleted file mode 100644 index 839cb249..00000000 --- a/env/lib.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2015 Guillaume Pellerin - -# Manifeste is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. - -# Manifeste is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with Manifeste. If not, see . - -# Authors: -# Guillaume Pellerin - - -app: - volumes: - - ./app/:/srv/app - - ./lib/mezzanine-agenda/:/srv/lib/mezzanine-agenda diff --git a/requirements-python.txt b/requirements-python.txt deleted file mode 100644 index 1143dacd..00000000 --- a/requirements-python.txt +++ /dev/null @@ -1,13 +0,0 @@ -setuptools -uwsgi -watchdog -mysqlclient -psycopg2 -django==1.9.11 - --e git+https://github.com/yomguy/mezzanine.git@jquery#egg=mezzanine-4.2-dev --e git+https://github.com/yomguy/grappelli-safe.git@dynamic_stacked#egg=grappelli-safe-0.4.2 --e git+https://github.com/yomguy/cartridge.git#egg=cartridge-0.12-dev --e git+https://github.com/yomguy/mezzanine-agenda.git#egg=mezzanine-agenda-0.2.2 --e git+https://github.com/Ircam-Web/mezzanine-organization.git@split#egg=mezzanine-organization-1.0 --e git+https://github.com/Ircam-Web/mezzanine-organization-themes.git#egg=mezzanine-organization-themes-1.0 diff --git a/requirements-debian.txt b/requirements.txt similarity index 100% rename from requirements-debian.txt rename to requirements.txt index 621b42c6..3e1e8735 100644 --- a/requirements-debian.txt +++ b/requirements.txt @@ -7,7 +7,7 @@ nodejs locales pandoc vim -python-sphinx ruby ruby-dev gettext +python-sphinx diff --git a/bin/build_doc.sh b/tmp/bin/build_doc.sh similarity index 100% rename from bin/build_doc.sh rename to tmp/bin/build_doc.sh diff --git a/bin/build_front.sh b/tmp/bin/build_front.sh similarity index 100% rename from bin/build_front.sh rename to tmp/bin/build_front.sh diff --git a/bin/build_graph.sh b/tmp/bin/build_graph.sh similarity index 100% rename from bin/build_graph.sh rename to tmp/bin/build_graph.sh diff --git a/bin/build_messages.sh b/tmp/bin/build_messages.sh similarity index 100% rename from bin/build_messages.sh rename to tmp/bin/build_messages.sh diff --git a/bin/build_readme.sh b/tmp/bin/build_readme.sh similarity index 100% rename from bin/build_readme.sh rename to tmp/bin/build_readme.sh diff --git a/bin/collectstatic.sh b/tmp/bin/collectstatic.sh similarity index 100% rename from bin/collectstatic.sh rename to tmp/bin/collectstatic.sh diff --git a/bin/db/backup.sh b/tmp/bin/db/backup.sh similarity index 100% rename from bin/db/backup.sh rename to tmp/bin/db/backup.sh diff --git a/bin/db/backup_db_eve.sh b/tmp/bin/db/backup_db_eve.sh similarity index 100% rename from bin/db/backup_db_eve.sh rename to tmp/bin/db/backup_db_eve.sh diff --git a/bin/db/backup_db_mysql.sh b/tmp/bin/db/backup_db_mysql.sh similarity index 100% rename from bin/db/backup_db_mysql.sh rename to tmp/bin/db/backup_db_mysql.sh diff --git a/bin/db/restore.sh b/tmp/bin/db/restore.sh similarity index 100% rename from bin/db/restore.sh rename to tmp/bin/db/restore.sh diff --git a/bin/db/restore_db_eve.sh b/tmp/bin/db/restore_db_eve.sh similarity index 100% rename from bin/db/restore_db_eve.sh rename to tmp/bin/db/restore_db_eve.sh diff --git a/bin/db/restore_db_mysql.sh b/tmp/bin/db/restore_db_mysql.sh similarity index 100% rename from bin/db/restore_db_mysql.sh rename to tmp/bin/db/restore_db_mysql.sh diff --git a/bin/docker-build.sh b/tmp/bin/docker-build.sh similarity index 100% rename from bin/docker-build.sh rename to tmp/bin/docker-build.sh diff --git a/bin/install.py b/tmp/bin/install.py similarity index 100% rename from bin/install.py rename to tmp/bin/install.py diff --git a/bin/makemigrations.sh b/tmp/bin/makemigrations.sh similarity index 100% rename from bin/makemigrations.sh rename to tmp/bin/makemigrations.sh diff --git a/bin/migrate.sh b/tmp/bin/migrate.sh similarity index 100% rename from bin/migrate.sh rename to tmp/bin/migrate.sh diff --git a/bin/pf_osx.sh b/tmp/bin/pf_osx.sh similarity index 100% rename from bin/pf_osx.sh rename to tmp/bin/pf_osx.sh diff --git a/bin/poll_twitter.sh b/tmp/bin/poll_twitter.sh similarity index 100% rename from bin/poll_twitter.sh rename to tmp/bin/poll_twitter.sh diff --git a/bin/pull.sh b/tmp/bin/pull.sh similarity index 100% rename from bin/pull.sh rename to tmp/bin/pull.sh diff --git a/bin/push.sh b/tmp/bin/push.sh similarity index 100% rename from bin/push.sh rename to tmp/bin/push.sh diff --git a/bin/tmp/fs_migrate.sh b/tmp/bin/tmp/fs_migrate.sh similarity index 100% rename from bin/tmp/fs_migrate.sh rename to tmp/bin/tmp/fs_migrate.sh diff --git a/bin/update_translation_fields.sh b/tmp/bin/update_translation_fields.sh similarity index 100% rename from bin/update_translation_fields.sh rename to tmp/bin/update_translation_fields.sh diff --git a/bin/upgrade.sh b/tmp/bin/upgrade.sh similarity index 100% rename from bin/upgrade.sh rename to tmp/bin/upgrade.sh -- 2.39.5