forked from forks/microblog.pub
Start to remove Celery code
This commit is contained in:
parent
d74660ab3d
commit
a85575b652
6 changed files with 16 additions and 108 deletions
12
.drone.yml
12
.drone.yml
|
@ -46,12 +46,13 @@ steps:
|
|||
environment:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
MICROBLOGPUB_DEBUG: 1
|
||||
MICROBLOGPUB_HOSTNAME: instance1_web
|
||||
MICROBLOGPUB_POUSSETACHES_HOST: http://poussetaches:7991
|
||||
MICROBLOGPUB_INTERNAL_HOST: http://instance1_web:5005
|
||||
MICROBLOGPUB_MONGODB_HOST: mongo:27017
|
||||
POUSSETACHES_AUTH_KEY: lol
|
||||
commands:
|
||||
- sleep 5
|
||||
- 'docker run -p 5006:5005 --net fede -v "`pwd`/tests/fixtures/instance1/config:/app/config" -e MICROBLOGPUB_DEBUG -e MICROBLOGPUB_HOSTNAME -e MICROBLOGPUB_MONGODB_HOST -e POUSSETACHES_AUTH_KEY --name instance1_web microblogpub'
|
||||
- 'docker run -p 5006:5005 --net fede -v "`pwd`/tests/fixtures/instance1/config:/app/config" -e MICROBLOGPUB_DEBUG -e MICROBLOGPUB_INTERNAL_HOST -e MICROBLOGPUB_MONGODB_HOST -e POUSSETACHES_AUTH_KEY --name instance1_web microblogpub'
|
||||
|
||||
- name: microblogpub_instance2
|
||||
image: docker:dind
|
||||
|
@ -59,11 +60,12 @@ steps:
|
|||
environment:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
MICROBLOGPUB_DEBUG: 1
|
||||
MICROBLOGPUB_HOSTNAME: instance2_web
|
||||
MICROBLOGPUB_POUSSETACHES_HOST: http://poussetaches:7991
|
||||
MICROBLOGPUB_INTERNAL_HOST: http://instance2_web:5005
|
||||
MICROBLOGPUB_MONGODB_HOST: mongo:27017
|
||||
POUSSETACHES_AUTH_KEY: lol
|
||||
commands:
|
||||
- 'docker run -p 5007:5005 --net fede -v "`pwd`/tests/fixtures/instance2/config:/app/config" -e MICROBLOGPUB_DEBUG -e MICROBLOGPUB_HOSTNAME -e MICROBLOGPUB_MONGODB_HOST -e POUSSETACHES_AUTH_KEY --name instance2_web microblogpub'
|
||||
- 'docker run -p 5007:5005 --net fede -v "`pwd`/tests/fixtures/instance2/config:/app/config" -e MICROBLOGPUB_DEBUG -e MICROBLOGPUB_INTERNAL_HOST -e MICROBLOGPUB_MONGODB_HOST -e POUSSETACHES_AUTH_KEY --name instance2_web microblogpub'
|
||||
|
||||
|
||||
- name: integration_test
|
||||
|
@ -80,6 +82,6 @@ services:
|
|||
privileged: true
|
||||
---
|
||||
kind: signature
|
||||
hmac: 0e02bf6fbcb514be8d3ee0f4a315c3f560f762ee474d27a009281b20cc8123ab
|
||||
hmac: e9e0af1e17c84ff087d83fbdd00ba132327cca9365b9805486d5a295443a5bd3
|
||||
|
||||
...
|
||||
|
|
35
.travis.yml
35
.travis.yml
|
@ -1,35 +0,0 @@
|
|||
language: python
|
||||
sudo: required
|
||||
python:
|
||||
- '3.7'
|
||||
matrix:
|
||||
include:
|
||||
- python: 3.7
|
||||
dist: xenial
|
||||
sudo: true
|
||||
services:
|
||||
- docker
|
||||
install:
|
||||
- sudo apt-get install -y curl python-tk
|
||||
- sudo pip install -U pip
|
||||
- sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
|
||||
- sudo chmod +x /usr/local/bin/docker-compose
|
||||
- docker-compose --version
|
||||
- pip install -r dev-requirements.txt
|
||||
- git clone https://github.com/tsileo/poussetaches.git && cd poussetaches && docker build . -t poussetaches:latest && cd -
|
||||
script:
|
||||
- mypy --ignore-missing-imports .
|
||||
- flake8 activitypub.py
|
||||
- cp -r tests/fixtures/me.yml config/me.yml
|
||||
- docker build . -t microblogpub:latest
|
||||
- docker-compose up -d
|
||||
- docker-compose ps
|
||||
- WEB_PORT=5006 COMPOSE_PROJECT_NAME=instance1 CONFIG_DIR=./tests/fixtures/instance1/config docker-compose -p instance1 -f docker-compose-tests.yml up -d
|
||||
- docker-compose -p instance1 -f docker-compose-tests.yml ps
|
||||
- WEB_PORT=5007 COMPOSE_PROJECT_NAME=instance2 CONFIG_DIR=./tests/fixtures/instance2/config docker-compose -p instance2 -f docker-compose-tests.yml up -d
|
||||
- docker-compose -p instance2 -f docker-compose-tests.yml ps
|
||||
- sleep 5
|
||||
# Integration tests first
|
||||
- python -m pytest -v --ignore data -k integration
|
||||
# Federation tests (with two local instances)
|
||||
- python -m pytest -v -s --ignore data -k federation
|
7
app.py
7
app.py
|
@ -90,8 +90,11 @@ from utils.media import Kind
|
|||
|
||||
from poussetaches import PousseTaches
|
||||
|
||||
phost = "http://" + os.getenv("COMPOSE_PROJECT_NAME", "")
|
||||
p = PousseTaches(f"{phost}_poussetaches_1:7991", f"{phost}_web_1:5005")
|
||||
p = PousseTaches(
|
||||
os.getenv("MICROBLOGPUB_POUSSETACHES_HOST", "http://localhost:7991"),
|
||||
os.getenv("MICROBLOGPUB_INTERNAL_HOST", "http://localhost:5000"),
|
||||
)
|
||||
|
||||
# p = PousseTaches("http://localhost:7991", "http://localhost:5000")
|
||||
|
||||
back = activitypub.MicroblogPubBackend()
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
version: '3.5'
|
||||
services:
|
||||
web:
|
||||
image: 'microblogpub:latest'
|
||||
ports:
|
||||
- "${WEB_PORT}:5005"
|
||||
volumes:
|
||||
- "${CONFIG_DIR}:/app/config"
|
||||
- "./static:/app/static"
|
||||
environment:
|
||||
- MICROBLOGPUB_AMQP_BROKER=pyamqp://guest@rmq//
|
||||
- MICROBLOGPUB_MONGODB_HOST=${COMPOSE_PROJECT_NAME}_mongo_1:27017
|
||||
- MICROBLOGPUB_DEBUG=1
|
||||
- COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME}
|
||||
- POUSSETACHES_AUTH_KEY=123
|
||||
celery:
|
||||
# image: "instance1_web"
|
||||
image: 'microblogpub:latest'
|
||||
command: 'celery worker -l info -A tasks'
|
||||
volumes:
|
||||
- "${CONFIG_DIR}:/app/config"
|
||||
environment:
|
||||
- MICROBLOGPUB_AMQP_BROKER=pyamqp://guest@rmq//
|
||||
- MICROBLOGPUB_MONGODB_HOST=mongo:27017
|
||||
- MICROBLOGPUB_DEBUG=1
|
||||
mongo:
|
||||
image: "mongo:latest"
|
||||
rmq:
|
||||
image: "rabbitmq:latest"
|
||||
hostname: "my-rabbit"
|
||||
environment:
|
||||
- RABBITMQ_ERLANG_COOKIE=secretrabbit
|
||||
- RABBITMQ_NODENAME=rabbit@my-rabbit
|
||||
poussetaches:
|
||||
image: "poussetaches:latest"
|
||||
environment:
|
||||
- POUSSETACHES_AUTH_KEY=123
|
||||
networks:
|
||||
default:
|
||||
name: microblogpubfede
|
|
@ -4,41 +4,19 @@ services:
|
|||
image: 'microblogpub:latest'
|
||||
ports:
|
||||
- "${WEB_PORT}:5005"
|
||||
links:
|
||||
- mongo
|
||||
- rmq
|
||||
- poussetaches
|
||||
volumes:
|
||||
- "${CONFIG_DIR}:/app/config"
|
||||
- "./static:/app/static"
|
||||
environment:
|
||||
- MICROBLOGPUB_AMQP_BROKER=pyamqp://guest@rmq//
|
||||
- MICROBLOGPUB_MONGODB_HOST=mongo:27017
|
||||
- MICROBLOGPUB_INTERNAL_HOST=http://${COMPOSE_PROJECT_NAME}_web_1:5005
|
||||
- MICROBLOGPUB_POUSSETACHES_HOST=http://${COMPOSE_PROJECT_NAME}_poussetaches_1:7991
|
||||
- POUSSETACHES_AUTH_KEY=${POUSSETACHES_AUTH_KEY}
|
||||
- COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME}
|
||||
celery:
|
||||
image: 'microblogpub:latest'
|
||||
links:
|
||||
- mongo
|
||||
- rmq
|
||||
command: 'celery worker -l info -A tasks'
|
||||
volumes:
|
||||
- "${CONFIG_DIR}:/app/config"
|
||||
environment:
|
||||
- MICROBLOGPUB_AMQP_BROKER=pyamqp://guest@rmq//
|
||||
- MICROBLOGPUB_MONGODB_HOST=mongo:27017
|
||||
mongo:
|
||||
image: "mongo:latest"
|
||||
volumes:
|
||||
- "${DATA_DIR}/mongodb:/data/db"
|
||||
rmq:
|
||||
image: "rabbitmq:latest"
|
||||
hostname: "my-rabbit"
|
||||
environment:
|
||||
- RABBITMQ_ERLANG_COOKIE=secretrabbit
|
||||
- RABBITMQ_NODENAME=rabbit@my-rabbit
|
||||
volumes:
|
||||
- "${DATA_DIR}/rabbitmq:/var/lib/rabbitmq"
|
||||
poussetaches:
|
||||
image: "poussetaches:latest"
|
||||
volumes:
|
||||
|
|
|
@ -208,12 +208,12 @@ class Instance(object):
|
|||
def _instances() -> Tuple[Instance, Instance]:
|
||||
"""Initializes the client for the two test instances."""
|
||||
instance1 = Instance(
|
||||
"instance1", "http://localhost:5006", "http://instance1_web_1:5005"
|
||||
"instance1", "http://docker:5006", "http://instance1_web:5005"
|
||||
)
|
||||
instance1.ping()
|
||||
|
||||
instance2 = Instance(
|
||||
"instance2", "http://localhost:5007", "http://instance2_web_1:5005"
|
||||
"instance2", "http://docker:5007", "http://instance2_web:5005"
|
||||
)
|
||||
instance2.ping()
|
||||
|
||||
|
|
Loading…
Reference in a new issue