diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..bce2fb4a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +FROM python:3.9 + +RUN mkdir -p /usr/src/robosats + +WORKDIR /usr/src/robosats # specifying the working dir inside the container + +COPY requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt + +# copy current dir's content to container's WORKDIR root i.e. all the contents of the robosats app +COPY . . + +# fit lnd grpc services +RUN pip install grpcio grpcio-tools googleapis-common-protos +RUN cd api/lightning && git clone https://github.com/googleapis/googleapis.git +RUN cd api/lightning && curl -o lightning.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/lightning.proto +RUN cd api/lightning && python3 -m grpc_tools.protoc --proto_path=googleapis:. --python_out=. --grpc_python_out=. lightning.proto +RUN cd api/lightning && curl -o invoices.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/invoicesrpc/invoices.proto +RUN cd api/lightning && python3 -m grpc_tools.protoc --proto_path=googleapis:. --python_out=. --grpc_python_out=. invoices.proto +RUN cd api/lightning && curl -o router.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/routerrpc/router.proto +RUN cd api/lightning && python3 -m grpc_tools.protoc --proto_path=googleapis:. --python_out=. --grpc_python_out=. router.proto + +# patch generated files relative imports +RUN sed -i 's/^import .*_pb2 as/from . \0/' api/lightning/router_pb2.py +RUN sed -i 's/^import .*_pb2 as/from . \0/' api/lightning/invoices_pb2.py +RUN sed -i 's/^import .*_pb2 as/from . \0/' api/lightning/router_pb2_grpc.py +RUN sed -i 's/^import .*_pb2 as/from . \0/' api/lightning/lightning_pb2_grpc.py +RUN sed -i 's/^import .*_pb2 as/from . \0/' api/lightning/invoices_pb2_grpc.py + +EXPOSE 8000 + +CMD ["gunicorn", "--bind", ":8000", "robosats.wsgi:application"] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index dbb03b5b..eef380a0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,41 +1,4 @@ -aioredis==1.3.1 -aiorpcX==0.18.7 -amqp==5.0.9 -apturl==0.5.2 -asgiref==3.4.1 -async-timeout==4.0.2 -attrs==21.4.0 -autobahn==21.11.1 -Automat==20.2.0 -backports.zoneinfo==0.2.1 -bcrypt==3.1.7 -billiard==3.6.4.0 -blinker==1.4 -Brlapi==0.7.0 -celery==5.2.3 -certifi==2019.11.28 -cffi==1.15.0 -channels==3.0.4 -channels-redis==3.3.1 -chardet==3.0.4 -charge-lnd==0.2.4 -click==8.0.3 -click-didyoumean==0.3.0 -click-plugins==1.1.1 -click-repl==0.2.0 -colorama==0.4.4 -command-not-found==0.3 -constantly==15.1.0 -cryptography==36.0.1 -cupshelpers==1.0 -daphne==3.0.2 -dbus-python==1.2.16 -defer==1.0.6 -Deprecated==1.2.13 -distlib==0.3.4 -distro==1.4.0 -distro-info===0.23ubuntu1 -Django==3.2.11 +django==3.2.11 django-admin-relation-links==0.2.5 django-celery-beat==2.2.1 django-celery-results==2.2.0 @@ -44,97 +7,17 @@ django-private-chat2==1.0.2 django-redis==5.2.0 django-timezone-field==4.2.3 djangorestframework==3.13.1 -duplicity==0.8.12.0 -entrypoints==0.3 -fasteners==0.14.1 -filelock==3.4.2 -future==0.18.2 +channels==3.0.4 +channels-redis==3.3.1 +celery==5.2.3 googleapis-common-protos==1.53.0 -grpcio==1.39.0 +grpcio==1.43.0 grpcio-tools==1.43.0 -hiredis==2.0.0 -httplib2==0.14.0 -hyperlink==21.0.0 -idna==2.8 -incremental==21.3.0 -keyring==18.0.1 -kombu==5.2.3 -language-selector==0.1 -launchpadlib==1.10.13 -lazr.restfulclient==0.14.2 -lazr.uri==1.0.3 -lockfile==0.12.2 -louis==3.12.0 -macaroonbakery==1.3.1 -Mako==1.1.0 -MarkupSafe==1.1.0 -monotonic==1.5 -msgpack==1.0.3 -natsort==8.0.2 -netifaces==0.10.4 numpy==1.22.0 -oauthlib==3.1.0 -olefile==0.46 -packaging==21.3 -paramiko==2.6.0 -pbr==5.8.0 -pexpect==4.6.0 Pillow==7.0.0 -platformdirs==2.4.1 -prompt-toolkit==3.0.24 -protobuf==3.17.3 -pyasn1==0.4.8 -pyasn1-modules==0.2.8 -pycairo==1.16.2 -pycparser==2.21 -pycups==1.9.73 -PyGObject==3.36.0 -PyJWT==1.7.1 -pymacaroons==0.13.0 -PyNaCl==1.3.0 -pyOpenSSL==21.0.0 -pyparsing==3.0.6 -pyRFC3339==1.1 -PySocks==1.7.1 -python-apt==2.0.0+ubuntu0.20.4.5 -python-crontab==2.6.0 -python-dateutil==2.7.3 -python-debian===0.1.36ubuntu1 python-decouple==3.5 -pytz==2021.3 -pyxdg==0.26 -PyYAML==5.3.1 -redis==4.1.0 -reportlab==3.5.34 requests==2.22.0 -requests-unixsocket==0.2.0 ring==0.9.1 robohash==1.1 scipy==1.7.3 -SecretStorage==2.3.1 -service-identity==21.1.0 -simplejson==3.16.0 -six==1.16.0 -sqlparse==0.4.2 -stevedore==3.5.0 -systemd-python==234 -termcolor==1.1.0 -Twisted==21.7.0 -txaio==21.2.1 -typing-extensions==4.0.1 -ubuntu-advantage-tools==27.2 -ubuntu-drivers-common==0.0.0 -ufw==0.36 -unattended-upgrades==0.1 -urllib3==1.25.8 -usb-creator==0.3.7 -vine==5.0.0 -virtualenv==20.12.1 -virtualenv-clone==0.5.7 -virtualenvwrapper==4.8.4 -wadllib==1.3.3 -wcwidth==0.2.5 -wirerope==0.4.5 -wrapt==1.13.3 -xkit==0.0.0 -zope.interface==5.4.0 +gunicorn==20.1.0 diff --git a/setup.md b/setup.md index e3fa3d7a..16935a38 100644 --- a/setup.md +++ b/setup.md @@ -99,7 +99,16 @@ to `from . import lightning_pb2 as lightning__pb2` -Same for every other file +Same for every other file. + +Generated files can be automatically patched like this: +``` +sed -i 's/^import .*_pb2 as/from . \0/' api/lightning/router_pb2.py +sed -i 's/^import .*_pb2 as/from . \0/' api/lightning/invoices_pb2.py +sed -i 's/^import .*_pb2 as/from . \0/' api/lightning/router_pb2_grpc.py +sed -i 's/^import .*_pb2 as/from . \0/' api/lightning/lightning_pb2_grpc.py +sed -i 's/^import .*_pb2 as/from . \0/' api/lightning/invoices_pb2_grpc.py +``` ## React development environment ### Install npm