-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: run container script run through CLI args #6690
Conversation
Codecov Report
@@ Coverage Diff @@
## development #6690 +/- ##
===============================================
- Coverage 65.44% 65.43% -0.01%
===============================================
Files 300 300
Lines 15299 15299
===============================================
- Hits 10012 10011 -1
- Misses 5287 5288 +1
Continue to review full report at Codecov.
|
@iamareebjamal Please review. |
docker-compose.yml
Outdated
C_FORCE_ROOT: "true" | ||
command: run celery |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just use celery, instead of run celery
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And api should start when no argument is passed and also when api
argument is passed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok doing the change.
fa8abd4
to
5a0e2fa
Compare
@iamareebjamal Check now, done the changes! Also we have to pass this command in DockerFile while starting script, correct? |
5a0e2fa
to
d095df7
Compare
Dockerfile
Outdated
@@ -26,4 +26,4 @@ WORKDIR /data/app | |||
ADD . . | |||
|
|||
EXPOSE 8080 | |||
CMD ["sh", "scripts/container_start.sh"] | |||
CMD ["sh", "scripts/container_start.sh run "] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iamareebjamal How do we pass the command from celery container here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this to ENTRYPOINT
scripts/container_start.sh
Outdated
echo "[LOG] Using database: ${DATABASE_URL}" | ||
echo "[LOG] Using redis: ${REDIS_URL}" | ||
|
||
if [ "$2" = "" ] || [ "$2" = "api" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See how default parameters are handled above
scripts/container_start.sh
Outdated
|
||
if [ "$DEPLOYMENT" == "api" ] | ||
if | ||
[ "$1" = "run" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove as told. No need for run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
d095df7
to
b3e774a
Compare
scripts/container_start.sh
Outdated
@@ -1,12 +1,11 @@ | |||
#!/bin/sh | |||
export DEPLOYMENT=${DEPLOYMENT:-api} | |||
DEPLOYMENT=${1:-api} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why removed export?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why we want it to be global?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So that we can know inside the container which one it is
scripts/container_start.sh
Outdated
|
||
echo "[LOG] Deploying ${DEPLOYMENT}" | ||
echo "[LOG] Using database: ${DATABASE_URL}" | ||
echo "[LOG] Using redis: ${REDIS_URL}" | ||
|
||
if [ "$DEPLOYMENT" == "api" ] | ||
then | ||
if [ "$DEPLOYMENT" = "api" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert
scripts/container_start.sh
Outdated
if [ "$DEPLOYMENT" == "celery" ] | ||
then | ||
|
||
if [ "$DEPLOYMENT" = "celery" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert
Tested? |
ae17595
to
bbf3e93
Compare
Not working for celery while running |
@iamareebjamal the docker-compose is directly running celery instead of using it in entrypoint Log
|
@iamareebjamal Ref: https://stackoverflow.com/a/40843513/6026355 it says so, where I am wrong |
Are you building the image or just using the eventyay image |
I am not sure about this, how to know?. I only ran docker-compose up |
shit I was using the eventyay image |
Then you're not building the image, and obviously it won't work. Remove image: tag in docker compose file in default section and replace it with Locally, don't commit and push |
@iamareebjamal still getting errors
|
solution says to change the permission of bash file |
That's because you needlessly changed As I have said countless times now, copy it as is until you understand it. DO NOT change something if you are not 100% sure why you're doing it. No idea why you make such changes |
@iamareebjamal I am sorry but making mistakes are part of learning, as you said to change the So what should be ENTRYPOINT ["sh", "scripts/container_start.sh"] I am again sorry, but without the knowledge of docker. I would not have taken this task might be. |
Then it should have been just -CMD
+ENTRYPOINT |
do i need to remove the images or running |
I am using docker for the first time, please ignore my mistakes as a learner. I had a hard time to understood this but I will learn it by working more on it. @iamareebjamal Also, I am very excited by how the image process worked, it was amazing. Thanks a lot! Everything working fine. Tested |
bbf3e93
to
6c3e7a3
Compare
@iamareebjamal Review please. |
Fixes #6598
Short description of what this resolves:
Container script now can be run by CLI args instead of envt variables
Checklist
development
branch.