Skip to content
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

Provide an official Docker image #849

Closed
JDiPierro opened this issue Jul 24, 2018 · 40 comments
Closed

Provide an official Docker image #849

JDiPierro opened this issue Jul 24, 2018 · 40 comments

Comments

@JDiPierro
Copy link
Contributor

It'd be great if Locust provided an official Docker image on Dockerhub. Right now the most used image is hakobera/locust but it hasn't been updated in 3 years.

@aldenpeterson-wf
Copy link
Contributor

What would the image contain?

I don't know that this image would be very complicated at all.

@JDiPierro
Copy link
Contributor Author

The image would only need to contain locust and pyzmq. I agree it's a simple image and the hakobera/locust Dockerfile is pretty good, it just needs to be rebuilt with a newer version of Locust; right now it's missing a bunch of features. It is set up as an automatic build so any github repo activity would trigger a new build but that's tied to the hakobera/docker-locust repo so it's only triggered when the docker setup gets changed and like you said: it's a simple image, the config doesn't need to be updated often. And the dev (ping, @hakobera) seems to be gone from Github, no activity in over a year.

@cgoldberg
Copy link
Member

We really need someone to volunteer to do this. A Pull Request with an updated dockerfile and some documentation would be a great start :) (hint) We would also want to update the travis config so we can build/test it regularly.

@colutti
Copy link

colutti commented Jul 25, 2018

I just created one with the latest version of locust as well as python 3.7.

https://store.docker.com/community/images/colutti/locust

I will work on the its documentation

@cgoldberg
Copy link
Member

@colutti see #850

@spayeur207
Copy link

@cgoldberg I think this can now be closed

@sekka1
Copy link

sekka1 commented Sep 30, 2018

Can we get an official image up to Docker hub or another repository that this project maintains? I have this PR for a Helm Chart to use Locust in Kubernetes but I am pointing it to an image in my Docker Hub repo. I would rather point it to an "official image".

https://github.com/helm/charts/pull/7970/files#diff-c9789cc33518b31f9230b6284b2b6116R4

@sekka1
Copy link

sekka1 commented Nov 1, 2018

ping ping

I can help but not sure what would need to be done in order to get a Locust image into Docker Hub.

@colutti

@raiyankamal
Copy link
Contributor

@sekka1 As far as I know, there is no official docker hub account for locustio. Creating an official account seems to be the obvious first step. Next, the maintainer of that account should upload the docker image. Ideally, a new docker image should be uploaded for each release of Locust.

In future, several images may be uploaded for each version e.g. based on different versions of ubuntu and alpine linux.

@sekka1
Copy link

sekka1 commented Jan 4, 2019

@raiyankamal I am happy to help here but not sure how. If you point me in the right direction i can take something on to help make this happen.

@raiyankamal
Copy link
Contributor

@sekka1 I would suggest approaching the locust.io members first of all to get their consent for creating the official locustio docker account. Once you have that you can work on your own or ask for help to build the images etc. I may be help on that as well. But without the official account on dockerhub, we'll not have any official image.

@swarupdonepudi
Copy link

I would like to help to get this image on dockerhub. @cgoldberg can you please outline the next steps. There is more than one open issue that can be closed if we knock this one off.

@SBSolera
Copy link

It would be great if an official docker image could be posted to docker hub.

@cgoldberg
Copy link
Member

As far as I know, there is no official docker hub account for locustio.

Yes, but both "locust" and "locust.io" id's are already in use. I don't know what the official namespace should be.

can you please outline the next steps.

setup an automated build for the repository.

@sekka1
Copy link

sekka1 commented May 22, 2019

How about locustio or locust-io?

@SBSolera
Copy link

+1 for locustio. That was what I initially looked for.

@raiyankamal
Copy link
Contributor

setup an automated build for the repository.

@cgoldberg I assume you're talking about doing the build via travis and deploy to dockerhub?

@cgoldberg
Copy link
Member

correct

@cgoldberg
Copy link
Member

locustio is taken

@JDiPierro
Copy link
Contributor Author

@raiyankamal @cgoldberg You could use DockerHub's Automated Builds instead of manually pushing during a Travis build. You point DockerHub at the repository and tell it what branches to build then it creates a new build on every push. Images built that way will be marked in DockerHub as an automated build, which gives end users a bit more confidence in the image. If you just docker push to DockerHub as part of CI it's still considered a manually built image.

@raiyankamal
Copy link
Contributor

raiyankamal commented May 23, 2019

Thanks for the advice @JDiPierro, I was not aware of this feature. It took me less than 5 minutes to setup the automated build in my personal dockerhub account.

I created an org named pythonlocust in dockerhub. Not the most imaginative name, but this is the best I could think of besides locust and locustio. Let's see how the community members feel about this name. @cgoldberg if you are OK with this name, I'll be happy to add you to the org and also move forward with the next steps.

@raiyankamal
Copy link
Contributor

I made my locust repository on dockerhub public for anyone interested in obtaining the latest build of locust: https://hub.docker.com/r/raiyankamal/locust

I'm yet to implement tagging of builds by version. I'll be grateful if some community members can test the build (tagged latest) seen here. Also, let me know what else would you like to see in an official docker repo of locust. I'll try to implement those features in this repository. With the hope of being able to replicate all of that to the pythonlocust org (in dockerhub) once I get approval from locust maintainers.

@max-rocket-internet
Copy link
Contributor

Any update @cgoldberg ? Can you takeover the org from @raiyankamal ?

@max-rocket-internet
Copy link
Contributor

@raiyankamal I don't think your dockerfile runs docker_start.sh, therefore it doesn't use the
documented environment variables

@raiyankamal
Copy link
Contributor

Hi @max-rocket-internet thanks for the feedback. I pushed some changes to correct this. Please test again with raiyankamal/locust:wip.
If this looks good I'll merge to my master and also send a PR to the main repo (this repo) for review.

@max-rocket-internet
Copy link
Contributor

@raiyankamal thanks for the quick fix! Looks good:

$ docker run -it -p 8089:8089 --volume $PWD/locustfiles/example:/mnt/locust -e LOCUSTFILE_PATH=/mnt/locust/main.py -e TARGET_URL=https://www.xxxx.com raiyankamal/locust:wip
Starting Locust...
$ locust -f /mnt/locust/main.py -H https://www.xxxx.com
[2019-08-30 08:50:27,810] e509e8afe70e/INFO/locust.main: Starting web monitor at *:8089
[2019-08-30 08:50:27,811] e509e8afe70e/INFO/locust.main: Starting Locust 0.11.0
$ curl -X POST 'http://localhost:8089/swarm' --data 'locust_count=1&hatch_rate=1'
{
  "message": "Swarming started",
  "success": true
}

$ curl 'http://localhost:8089/stop'
{
  "message": "Test stopped",
  "success": true
}

One thing that could be improved, but maybe not in this PR, is as far as I can see it's not possible to run standalone without web using this docker image. This is because it's not possible to pass --no-web --run-time=xxx to locust. I could make a PR? I see 2 possible options:

  1. Rename current var LOCUST_OPTS to _LOCUST_OPTS and allow the user to set LOCUST_OPTS and have this passed to locust like locust ${_LOCUST_OPTS} ${LOCUST_OPTS}
  2. If LOCUST_OPTS is set, just use it without checking LOCUST_MODE or using any logic. This assumes the user knows what they are doing.

@sarath-p
Copy link

thanks @raiyankamal! I tested running it in a kubernetes cluster and the slaves are not able to communicate with the master. I think it may be because of --master-port=${LOCUST_MASTER_PORT:-5557}, but I did not test by rebuilding the image.

@raiyankamal
Copy link
Contributor

Hi @sarath-p you'll have to rebuild the image since some changes were made to the Dockerfile. Please let me know if you have the same problem after rebuilding the image.

@raiyankamal
Copy link
Contributor

Hi @max-rocket-internet
Thanks for testing one more time. I pushed these changes to dockerhub and tagged it as latest. I also send a new PR to this repo.

Regarding the other problem you pointed out, let's make a new issue for that.

@cgoldberg, requesting your review on this PR: #1078.

@saurav955
Copy link

Really appreciate the efforts you guys are putting in.

@sarath-p
Copy link

sarath-p commented Sep 6, 2019

Hi @raiyankamal - I am having the same issue after rebuilding the image. Please note that I am running in a kubernetes cluster by configuring workers with a master deployment name. It works if I remove --master-port=${LOCUST_MASTER_PORT:-5557} in the Dockerfile. I would prefer using the official image running in the cluster without rebuilding it.

@max-rocket-internet
Copy link
Contributor

@sarath-p you should be able to solve this without changing the docker image just by setting the master service ports correctly. For example, here's my master service:

apiVersion: v1
kind: Service
metadata:
  labels:
    ...
  name: locust-master
  namespace: default
spec:
  clusterIP: 172.20.191.125
  ports:
  - name: master-p1
    port: 5557
    protocol: TCP
    targetPort: 5557
  - name: master-p2
    port: 5558
    protocol: TCP
    targetPort: 5558
  - name: master-p3
    port: 8089
    protocol: TCP
    targetPort: 8089
  selector:
    ...
  type: ClusterIP

targetPort = the port in the container, whatever it is, it doesn't matter
port = the port slaves use to connect to the master

@max-rocket-internet
Copy link
Contributor

locustio and locust are taken. Could we just use locustofficial or something to get this resolved?

@klreeher
Copy link

To clarify: the current stable Locust documentation references an official docker image.
From this thread, it sounds like there is not currently an official docker image on dockerhub, or anywhere else. Can someone confirm this?

@max-rocket-internet
Copy link
Contributor

the current stable Locust documentation references an official docker image.

Yes but no one here has control over this Org on Docker hub. That's the problem.

@mbeacom
Copy link
Member

mbeacom commented Oct 1, 2019

@max-rocket-internet I can access locustio.

I'll setup automated builds at some point this week and push out releases to date... Sadly, this won't resolve our tagging and release woes here on Github and PyPi.

@max-rocket-internet
Copy link
Contributor

@mbeacom awesome!

If you want me to make a PR to the travis config to push on tagged releases, let me know.

@klreeher
Copy link

klreeher commented Oct 1, 2019

@max-rocket-internet It sounds like access has been resolved, but the real issue I had was the documentation having the wrong information. I'd love to update that with a better summation of the current docker situation.

@sekka1
Copy link

sekka1 commented Oct 29, 2019

I am one of the maintainers of the Helm Stable chart (https://github.com/helm/charts/tree/master/stable/locust) and would like to update the chart to use the "official" image.

Let me know if and how I can help with this effort.

@heyman
Copy link
Member

heyman commented Oct 31, 2019

Automated builds are now set up for the official Docker repository: https://hub.docker.com/r/locustio/locust

The "latest" docker tag points to the latest stable release, while the "master" docker tag builds the master branch.

@heyman heyman closed this as completed Oct 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests