switch from gcloud datastore emulator to firestore emulator

...since the datastore emulator evidently doesn't support != query filters: https://github.com/googleapis/python-ndb/issues/962
pull/965/head
Ryan Barrett 2024-04-17 11:36:28 -07:00
rodzic 393605bde9
commit f02ba80304
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
5 zmienionych plików z 34 dodań i 30 usunięć

Wyświetl plik

@ -22,7 +22,7 @@ jobs:
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates gnupg google-cloud-sdk google-cloud-sdk-datastore-emulator default-jre sudo apt-get install -y apt-transport-https ca-certificates gnupg google-cloud-sdk google-cloud-cli-firestore-emulator default-jre
- run: - run:
name: Python dependencies name: Python dependencies
@ -40,7 +40,7 @@ jobs:
- run: - run:
name: Build and test name: Build and test
command: | command: |
CLOUDSDK_CORE_PROJECT=bridgy-federated gcloud beta emulators datastore start --no-store-on-disk --use-firestore-in-datastore-mode --host-port=localhost:8089 < /dev/null >& /dev/null & CLOUDSDK_CORE_PROJECT=brid-gy gcloud emulators firestore start --host-port=:8089 --database-mode=datastore-mode < /dev/null >& /tmp/firestore-emulator.log &
sleep 5s sleep 5s
python -m coverage run --source=. --omit=appengine_config.py,logs.py,tests/\* -m unittest discover -v python -m coverage run --source=. --omit=appengine_config.py,logs.py,tests/\* -m unittest discover -v
python -m coverage html -d /tmp/coverage_html python -m coverage html -d /tmp/coverage_html

Wyświetl plik

@ -12,7 +12,8 @@ Development
--- ---
Development reference docs are at [bridgy-fed.readthedocs.io](https://bridgy-fed.readthedocs.io/). Pull requests are welcome! Feel free to [ping me in #indieweb-dev](https://indieweb.org/discuss) with any questions. Development reference docs are at [bridgy-fed.readthedocs.io](https://bridgy-fed.readthedocs.io/). Pull requests are welcome! Feel free to [ping me in #indieweb-dev](https://indieweb.org/discuss) with any questions.
First, fork and clone this repo. Then, install the [Google Cloud SDK](https://cloud.google.com/sdk/) and run `gcloud components install beta cloud-datastore-emulator` to install the [datastore emulator](https://cloud.google.com/datastore/docs/tools/datastore-emulator). Once you have them, set up your environment by running these commands in the repo root directory: First, fork and clone this repo. Then, install the [Google Cloud SDK](https://cloud.google.com/sdk/) and run `gcloud components install cloud-firestore-emulator` to install the [Firestore emulator](https://cloud.google.com/firestore/docs/emulator). Once you have them, set up your environment by running these commands in the repo root directory:
```sh ```sh
gcloud config set project bridgy-federated gcloud config set project bridgy-federated
@ -24,7 +25,7 @@ pip install -r requirements.txt
Now, run the tests to check that everything is set up ok: Now, run the tests to check that everything is set up ok:
```shell ```shell
gcloud beta emulators datastore start --use-firestore-in-datastore-mode --no-store-on-disk --host-port=localhost:8089 --quiet < /dev/null >& /dev/null & gcloud emulators firestore start --host-port=:8089 --database-mode=datastore-mode < /dev/null >& /dev/null &
python3 -m unittest discover python3 -m unittest discover
``` ```

Wyświetl plik

@ -1,25 +1,27 @@
Bridgy Fed developer documentation Bridgy Fed developer documentation
---------------------------------- ----------------------------------
Bridgy Fed connects your web site to Bridgy Fed connects different decentralized social network protocols. It
`Mastodon <https://joinmastodon.org>`__ and the currently supports the
`fediverse <https://en.wikipedia.org/wiki/Fediverse>`__ via `fediverse <https://en.wikipedia.org/wiki/Fediverse>`__ (eg
`ActivityPub <https://activitypub.rocks/>`__, `Mastodon <https://joinmastodon.org>`__) via
`webmentions <https://webmention.net/>`__, and `ActivityPub <https://activitypub.rocks/>`__, and the
`microformats2 <https://microformats.org/wiki/microformats2>`__. Your `IndieWeb <https://indieweb.org/>`__ via
site gets its own fediverse profile, posts and avatar and header and `webmentions <https://webmention.net/>`__ and
all. Bridgy Fed translates likes, reposts, mentions, follows, and more `microformats2 <https://microformats.org/wiki/microformats2>`__.
back and forth. `See the user docs <https://fed.brid.gy/docs>`__ and `Bluesky/AT
`developer docs <https://bridgy-fed.readthedocs.io/>`__ for more Protocol <https://github.com/snarfed/bridgy-fed/issues/381>`__ and
details. `Nostr <https://github.com/snarfed/bridgy-fed/issues/446>`__ are planned
for 2024. Bridgy Fed translates profiles, likes, reposts, mentions,
follows, and more from any supported network to any other. `See the user
docs <https://fed.brid.gy/docs>`__ and `developer
docs <https://bridgy-fed.readthedocs.io/>`__ for more details.
https://fed.brid.gy/ https://fed.brid.gy/
Also see the License: This project is placed in the public domain. You may also use
`original <https://snarfed.org/indieweb-activitypub-bridge>`__ it under the `CC0
`design <https://snarfed.org/indieweb-ostatus-bridge>`__ blog posts. License <https://creativecommons.org/publicdomain/zero/1.0/>`__.
License: This project is placed in the public domain.
Development Development
----------- -----------
@ -31,11 +33,11 @@ requests are welcome! Feel free to `ping me in
First, fork and clone this repo. Then, install the `Google Cloud First, fork and clone this repo. Then, install the `Google Cloud
SDK <https://cloud.google.com/sdk/>`__ and run SDK <https://cloud.google.com/sdk/>`__ and run
``gcloud components install beta cloud-datastore-emulator`` to install ``gcloud components install cloud-firestore-emulator`` to install the
the `datastore `Firestore
emulator <https://cloud.google.com/datastore/docs/tools/datastore-emulator>`__. emulator <https://cloud.google.com/firestore/docs/emulator>`__. Once you
Once you have them, set up your environment by running these commands in have them, set up your environment by running these commands in the repo
the repo root directory: root directory:
.. code:: sh .. code:: sh
@ -48,7 +50,7 @@ Now, run the tests to check that everything is set up ok:
.. code:: shell .. code:: shell
gcloud beta emulators datastore start --use-firestore-in-datastore-mode --no-store-on-disk --host-port=localhost:8089 --quiet < /dev/null >& /dev/null & gcloud emulators firestore start --host-port=:8089 --database-mode=datastore-mode < /dev/null >& /dev/null &
python3 -m unittest discover python3 -m unittest discover
Finally, run this in the repo root directory to start the web app Finally, run this in the repo root directory to start the web app
@ -112,8 +114,9 @@ How to add a new protocol
5. TODO: add a new usage section to the docs for the new protocol. 5. TODO: add a new usage section to the docs for the new protocol.
6. TODO: does the new protocol need any new UI or signup functionality? 6. TODO: does the new protocol need any new UI or signup functionality?
Unusual, but not impossible. Add that if necessary. Unusual, but not impossible. Add that if necessary.
7. Add the new protocols logo to ``static/``, use it in 7. Protocol logos may be emoji or image files. If this one is a file,
`templates/user.html <https://github.com/snarfed/bridgy-fed/blob/main/templates/user.html>`__. add it ``static/``. Then add the emoji or file ``<img>`` tag in the
``Protocol`` subclasss ``LOGO_HTML`` constant.
Stats Stats
----- -----

Wyświetl plik

@ -1180,7 +1180,7 @@ class Follower(ndb.Model):
query = Follower.query( query = Follower.query(
Follower.status == 'active', Follower.status == 'active',
filter_prop == user.key, filter_prop == user.key,
).order(-Follower.updated) )
followers, before, after = fetch_page(query, Follower, by=Follower.updated) followers, before, after = fetch_page(query, Follower, by=Follower.updated)
users = ndb.get_multi(f.from_ if collection == 'followers' else f.to users = ndb.get_multi(f.from_ if collection == 'followers' else f.to

Wyświetl plik

@ -1649,7 +1649,7 @@ class ActivityPubTest(TestCase):
def test_following_collection_page(self, *_): def test_following_collection_page(self, *_):
self.store_following() self.store_following()
after = datetime(1900, 1, 1).isoformat() after = datetime(1900, 1, 1).isoformat()
prev = Follower.query(Follower.to == ActivityPub(id='http://baz').key, prev = Follower.query(Follower.to == ActivityPub(id='http://bar').key,
Follower.from_ == self.user.key, Follower.from_ == self.user.key,
).get().updated.isoformat() ).get().updated.isoformat()