Skip to content

Commit

Permalink
Merge pull request #630 from Ilhasoft/hotfix/change_proto_repository
Browse files Browse the repository at this point in the history
Hotfix/change proto repository
  • Loading branch information
helllllllder committed Aug 31, 2021
2 parents f5f5d37 + cf8f995 commit 6e7d768
Show file tree
Hide file tree
Showing 18 changed files with 22 additions and 227 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ staticfiles/
.idea/

# gRPC Protobuff
bothub/protos/*.py
bothub/protos/

#ASDF
.tool-versions
Expand Down
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ before_script:
- psql -U postgres -c "CREATE USER bothub WITH PASSWORD 'bothub';"
- psql -U postgres -c "ALTER ROLE bothub WITH SUPERUSER;"
- psql -U bothub postgres -c "CREATE DATABASE bothub;"
- python -m grpc_tools.protoc --experimental_allow_proto3_optional --proto_path=./ --python_out=./ --grpc_python_out=./ ./bothub/protos/authentication.proto
- python -m grpc_tools.protoc --experimental_allow_proto3_optional --proto_path=./ --python_out=./ --grpc_python_out=./ ./bothub/protos/organization.proto
- python -m grpc_tools.protoc --experimental_allow_proto3_optional --proto_path=./ --python_out=./ --grpc_python_out=./ ./bothub/protos/repository.proto
- python -m grpc_tools.protoc --experimental_allow_proto3_optional --proto_path=./ --python_out=./ --grpc_python_out=./ ./bothub/protos/project.proto

install:
- pip install pipenv
Expand All @@ -61,6 +57,7 @@ env:
- ELASTICSEARCH_NUMBER_OF_SHARDS=1
- ELASTICSEARCH_NUMBER_OF_REPLICAS=1
script:
- make createproto
- python manage.py migrate
- python manage.py search_index --rebuild -f
- python manage.py collectstatic
Expand Down
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ RUN apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y gcc bzip2 git curl nginx libpq-dev gettext \
libgdal-dev python3-cffi python3-gdal vim

RUN apt-get install make

RUN pip install -U pip==21.2.2 setuptools==57.4.0
RUN pip install pipenv==2021.5.29
RUN pip install gunicorn==19.9.0
Expand All @@ -23,10 +25,7 @@ RUN pipenv install --system

COPY . .

RUN python -m grpc_tools.protoc --experimental_allow_proto3_optional --proto_path=./ --python_out=./ --grpc_python_out=./ ./bothub/protos/authentication.proto
RUN python -m grpc_tools.protoc --experimental_allow_proto3_optional --proto_path=./ --python_out=./ --grpc_python_out=./ ./bothub/protos/organization.proto
RUN python -m grpc_tools.protoc --experimental_allow_proto3_optional --proto_path=./ --python_out=./ --grpc_python_out=./ ./bothub/protos/repository.proto
RUN python -m grpc_tools.protoc --experimental_allow_proto3_optional --proto_path=./ --python_out=./ --grpc_python_out=./ ./bothub/protos/project.proto
RUN make createproto

RUN chmod +x ./entrypoint.sh
ENTRYPOINT [ "./entrypoint.sh" ]
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ search_index:
else pipenv run python manage.py search_index --rebuild -f; fi

createproto:
@rm -rf ./bothub/protos/*.py
@python -m grpc_tools.protoc --experimental_allow_proto3_optional --proto_path=./ --python_out=./ --grpc_python_out=./ ./bothub/protos/authentication.proto
@python -m grpc_tools.protoc --experimental_allow_proto3_optional --proto_path=./ --python_out=./ --grpc_python_out=./ ./bothub/protos/organization.proto
@python -m grpc_tools.protoc --experimental_allow_proto3_optional --proto_path=./ --python_out=./ --grpc_python_out=./ ./bothub/protos/repository.proto
@python -m grpc_tools.protoc --experimental_allow_proto3_optional --proto_path=./ --python_out=./ --grpc_python_out=./ ./bothub/protos/project.proto

@rm -rf ./bothub/protos/
@git clone --depth 1 --branch main https://github.com/Ilhasoft/weni-protobuffers ./bothub/protos/
@python -m grpc_tools.protoc --experimental_allow_proto3_optional --proto_path=./ --python_out=./ --grpc_python_out=./ ./bothub/protos/inteligence/authentication.proto
@python -m grpc_tools.protoc --experimental_allow_proto3_optional --proto_path=./ --python_out=./ --grpc_python_out=./ ./bothub/protos/inteligence/organization.proto
@python -m grpc_tools.protoc --experimental_allow_proto3_optional --proto_path=./ --python_out=./ --grpc_python_out=./ ./bothub/protos/inteligence/repository.proto
@python -m grpc_tools.protoc --experimental_allow_proto3_optional --proto_path=./ --python_out=./ --grpc_python_out=./ ./bothub/protos/connect/project.proto


# Utils
Expand Down
2 changes: 1 addition & 1 deletion bothub/api/grpc/connect_grpc_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import grpc
from django.conf import settings

from bothub.protos import project_pb2_grpc, project_pb2
from bothub.protos.inteligence import project_pb2_grpc, project_pb2


class ConnectGRPCClient:
Expand Down
2 changes: 1 addition & 1 deletion bothub/api/grpc/organization/handlers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from bothub.api.grpc.organization.services import OrgService
from bothub.protos import organization_pb2_grpc
from bothub.protos.inteligence import organization_pb2_grpc


def grpc_handlers(server):
Expand Down
2 changes: 1 addition & 1 deletion bothub/api/grpc/organization/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from bothub.authentication.models import User
from bothub.common.models import Organization, OrganizationAuthorization
from bothub.protos import organization_pb2
from bothub.protos.inteligence import organization_pb2


class OrgProtoSerializer(proto_serializers.ModelProtoSerializer):
Expand Down
2 changes: 1 addition & 1 deletion bothub/api/grpc/organization/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
RepositoryAuthorization,
Repository,
)
from bothub.protos.organization_pb2 import OrgStatistic
from bothub.protos.inteligence.organization_pb2 import OrgStatistic


class OrgService(
Expand Down
2 changes: 1 addition & 1 deletion bothub/api/grpc/repository/handlers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .services import RepositoryService
from bothub.protos import repository_pb2_grpc
from bothub.protos.inteligence import repository_pb2_grpc


def grpc_handlers(server):
Expand Down
2 changes: 1 addition & 1 deletion bothub/api/grpc/repository/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from bothub.api.v2.repository.serializers import RepositoryCategorySerializer
from bothub.common.models import Repository
from bothub.protos import repository_pb2
from bothub.protos.inteligence import repository_pb2


class RepositoryProtoSerializer(proto_serializers.ModelProtoSerializer):
Expand Down
2 changes: 1 addition & 1 deletion bothub/api/grpc/repository/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
OrganizationAuthorization,
RepositoryAuthorization,
)
from bothub.protos import repository_pb2_grpc, repository_pb2
from bothub.protos.inteligence import repository_pb2_grpc, repository_pb2


class RepositoryServiceTestCase(RPCTransactionTestCase):
Expand Down
2 changes: 1 addition & 1 deletion bothub/api/grpc/user/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
UserService,
UserLanguageService,
)
from bothub.protos import authentication_pb2_grpc
from bothub.protos.inteligence import authentication_pb2_grpc


def grpc_handlers(server):
Expand Down
2 changes: 1 addition & 1 deletion bothub/api/grpc/user/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from rest_framework import serializers

from bothub.authentication.models import User
from bothub.protos import authentication_pb2
from bothub.protos.inteligence import authentication_pb2


class UserProtoSerializer(proto_serializers.ModelProtoSerializer):
Expand Down
2 changes: 1 addition & 1 deletion bothub/api/grpc/user/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from bothub.api.v2.tests.utils import create_user_and_token
from bothub.authentication.models import User
from bothub.common.models import Organization, OrganizationAuthorization
from bothub.protos import authentication_pb2_grpc, authentication_pb2
from bothub.protos.inteligence import authentication_pb2_grpc, authentication_pb2


class UserServiceTest(RPCTransactionTestCase):
Expand Down
60 changes: 0 additions & 60 deletions bothub/protos/authentication.proto

This file was deleted.

53 changes: 0 additions & 53 deletions bothub/protos/organization.proto

This file was deleted.

40 changes: 0 additions & 40 deletions bothub/protos/project.proto

This file was deleted.

50 changes: 0 additions & 50 deletions bothub/protos/repository.proto

This file was deleted.

0 comments on commit 6e7d768

Please sign in to comment.