-
Notifications
You must be signed in to change notification settings - Fork 154
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
How to use image for CI? #73
Comments
Do you mean configuration of the database, ie, setting up buckets, configuring memory limits, etc? |
Hi @ceejatec I'm talking about a simple way to start the server without any manual intervention. I want to run tests with the couchnode driver on travis or any other ci environment. |
I could find a sample travis script but I don't know if its work. Is it the right way? https://github.com/evantahler/couchbase-structures/blob/master/.travis.yml |
I know nothing about Travis, but from that file it appears that it's installing Couchbase from a package. Since you posted this question on the couchbase/docker repository, I assumed you were trying to do some automation involving the Couchbase Docker image - is that not correct? |
No no when it's possible with docker it would be great. I'm looking for a solution to cover this with docker. |
There's an official Docker image for Couchbase Server; "docker run couchbase". More information about that can be found on Docker Hub: https://hub.docker.com/_/couchbase/ That should eliminate the need to install Couchbase Server. That takes me back to my initial question, though: are you looking to automate the configuration of the Server? (If you just run the "couchbase" image, you'll get a default server instance, and if you hit the web interface you'll be presented with the Setup Wizard.) |
Yes, I'm looking for a way to automate the configuration of the Server. On a CI platform there is no UI. |
Well, I won't claim it's necessarily the best way, but take a look at https://github.com/couchbaselabs/analytics-docker/blob/master/scripts/configure-node.sh . If you create a custom Docker image with a Dockerfile something like FROM couchbase Then it'll run the commands in that script after Couchbase initially comes up. That's good enough for configuring things like memory limits, which services are enabled, etc. (It might be easier to do the configuration with couchbase-cli rather than direct REST calls.) Note: the block at the bottom of that script that starts "if [ "$TYPE" = "WORKER" ]" doesn't actually work. It's intended for use when running the image in multiple containers to allow them to automatically join together into a cluster. It would probably work except that the runit process manager in the container strips out environment variables from "docker run -e". I haven't gotten around to fixing that yet. |
What do you mean with
what's the alternative to setup couchbase in headless mode? |
so there is no official examples or documentation about how to setup couchbase with docker or on localhost without to through the setup? How do you implement automated tests? |
Our testing (to the best of my knowledge - I'm not in QA) treats Docker testing the same as normal platform testing, and does cluster configuration from outside the cluster itself using couchbase-cli in the way we expect customer deployments work. Our documentation certainly covers this use case, eg. https://developer.couchbase.com/documentation/server/4.6/cli/cli-intro.html . My suggestion was for a way to get the Docker image itself to configure the node from inside, so it's self-contained. That may or may not meet your needs. |
Thanks for the insides. Is it possible to skip the |
Yes; a node configured using the script I showed will no longer show the Setup Wizard when you visit the web interface. I'm not positive which step sets the node into the "configured" state such that the Wizard is no longer necessary, but I believe it's either the "Configure Services" or "Set up credentials" step (or possibly both together) which do so. |
All right and thanks. I will try it. |
Hi @ceejatec how can I access the
error
|
/opt/couchbase/bin/couchbase-cli in the container is the correct path. /opt/couchbase/bin is also on the PATH, so you can just use "couchbase-cli". You have some problems with your compose file, though:
If you want to configure the database, you need to first start the database by running a plain Couchbase container with no command, wait for the server to start up, and then run the couchbase-cli commands or make REST calls to configure that server. That's what the script I mentioned earlier does, from within the container itself. That does mean that you have to build your own Docker image, and that the image will only configure itself one way. You could make the shell script read a configuration file or similar that you mount in from outside, or even mount the shell script itself in from outside, depending on the environment you're trying to run in. |
Thank you for the precise answer. Could you provide a simple example (init cluster, create bucket) where the wizard is gone? That would awesome. |
I don't think it can be done strictly from a docker-compose file. You need to either have a custom image with some configuration logic baked in, or else you need to be able to mount a script from outside the container. Neither is especially challenging; which is best just depends on your working method. For instance, if you're firing this off in Travis and Travis doesn't allow bind-mounting of files into containers, then you'd need to go with the custom-image route. (Note: as I said I've never used Travis, so I don't know if Travis has that limitation or not; it was just an example of how the environment matters.) Which most closely matches your scenario? |
(As a note, having had this discussion with you, I can see how it might be cool or handy to enhance the container so that you COULD configure a database, or even a cluster, entirely from a docker-compose file. That would be an interesting challenge.) |
After the server is started you can run couchbase cli commands with docker exec. Create bucket, etc I usually create a bash script to do the whole job. |
Sounds like a request for the pull request #66 - is this what you are looking for, @StarpTech ? Docker Couchbase is not really cloud native at the moment [1]. |
@cha87de yes, that would match with my requirements. Today, this is standard. |
@StarpTech you can build your own couchbase docker image like we are doing it here https://github.com/vice-registry/vice-registry. Have a look at the |
Update @StarpTech: I quickly moved all the stuff to a separate github repo [1] and linked it to a docker hub repo [2] with automated builds enabled. Feel free to use my docker image instead ;-) [1] https://github.com/cha87de/couchbase-docker-cloudnative |
Hi, @cha87de awesome I will try it and give you feedback. |
@cha87de : Your suggested approach works for me! As I needed some further configuration, like creating indexes and views, I added another parameter to trigger further configuration on script level, so in
In |
@StarpTech I can recommend using RethinkDB, ArrangoDB or the like for automated cloud staging and deployments. I'm not sure how they behave under heavy load, but at least their deployments are without clicking through a web dashboard ;-) |
@cha87de thanks for your feedback. I also a little bit lost why they don't provide a cloud-native approach. Couchbase has great capabilities but it's not easy in operational aspects and especially the documentation is heavy and not clear for a start from zero. I will come back someday in the future. |
Hi, I'm planning to use couchbase but I couldn't find a solution to automate the installation of the database. I want to run it on travis or appveyor. What's the way to go here?
The text was updated successfully, but these errors were encountered: