Skip to content

Commit 43b5f9d

Browse files
committed
Updated env, added sleep in travis
1 parent 5b0ef40 commit 43b5f9d

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

.env.enc

144 Bytes
Binary file not shown.

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ jobs:
4343
- docker pull docker.pkg.github.com/seluj78/pymatcha/pymatcha-api:latest
4444
# run docker on port 80
4545
# do not forget to add env-file an environment file in Settings/CI CD/Variables
46-
- docker run -d -p 5000:5000 --restart always docker.pkg.github.com/seluj78/pymatcha/pymatcha-api:latest
46+
- docker run -d -p 5000:5000 --restart always --env-file .env docker.pkg.github.com/seluj78/pymatcha/pymatcha-api:latest
47+
# Wait for docker to be up
48+
- sleep 10
4749
# run newman tests
4850
- newman run --color on 'PyMatcha.postman_collection.json'
4951
after_script:

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ RUN export $(cat .env | xargs)
66
RUN pip install -r requirements.txt
77
ADD backend .
88
ENV PYTHONDONTWRITEBYTECODE 1
9-
ENV IS_DOCKER_COMPOSE true
109
EXPOSE 5000
11-
CMD gunicorn --chdir /www app:application -w 2 --threads 2 -b 0.0.0.0:5000
10+
CMD exec gunicorn --chdir /www --bind :5000 --workers 1 --threads 1 PyMatcha:application

backend/PyMatcha/__init__.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
application.config["JWT_SECRET_KEY"] = os.environ.get("FLASK_SECRET_KEY")
7171

7272
logging.debug("Configuring Celery Redis URLs")
73-
CELERY_BROKER_URL = "redis://localhost:6379/0" if not os.getenv("IS_DOCKER_COMPOSE") else "redis://redis:6379/0"
74-
CELERY_RESULT_BACKEND = "redis://localhost:6379/0" if not os.getenv("IS_DOCKER_COMPOSE") else "redis://redis:6379/0"
73+
CELERY_BROKER_URL = os.getenv("CELERY_BROKER_URL", "redis://localhost:6379/0")
74+
CELERY_RESULT_BACKEND = os.getenv("CELERY_RESULT_BACKEND", "redis://localhost:6379/0")
7575
# Celery configuration
7676
application.config["CELERY_BROKER_URL"] = CELERY_BROKER_URL
7777
application.config["CELERY_RESULT_BACKEND"] = CELERY_RESULT_BACKEND
@@ -150,10 +150,7 @@ def expired_token_callback(expired_token):
150150
mail = Mail(application)
151151

152152
redis = StrictRedis(
153-
host=os.getenv("REDIS_HOST") if not os.getenv("IS_DOCKER_COMPOSE") else "redis",
154-
port=os.getenv("REDIS_PORT", 6379),
155-
decode_responses=True,
156-
db=2,
153+
host=os.getenv("REDIS_HOST", "localhost"), port=os.getenv("REDIS_PORT", 6379), decode_responses=True, db=2
157154
)
158155

159156
redis.flushdb()

0 commit comments

Comments
 (0)