Skip to content

Instantly share code, notes, and snippets.

@rajagp
Last active October 25, 2022 09:47
Show Gist options
  • Select an option

  • Save rajagp/8d05314d85fcbf169ee39a671077a566 to your computer and use it in GitHub Desktop.

Select an option

Save rajagp/8d05314d85fcbf169ee39a671077a566 to your computer and use it in GitHub Desktop.

Revisions

  1. rajagp revised this gist Apr 3, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion custom_couchbase_dev_image.md
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,7 @@ This approach inspired by the [tutorial](https://blog.couchbase.com/deploying-co
    # Setup RBAC user using CLI
    couchbase-cli user-manage -c 127.0.0.1:8091 --username $COUCHBASE_ADMINISTRATOR_USERNAME --password $COUCHBASE_ADMINISTRATOR_PASSWORD \
    --set --rbac-username $COUCHBASE_RBAC_USERNAME --rbac-password $COUCHBASE_RBAC_PASSWORD --rbac-name $COUCHBASE_RBAC_NAME \
    --roles bucket_full_access[*] --auth-domain local
    --roles bucket_full_access[*],bucket_admin[*] --auth-domain local


    fg 1
  2. rajagp revised this gist Apr 3, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions custom_couchbase_dev_image.md
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,7 @@ This approach inspired by the [tutorial](https://blog.couchbase.com/deploying-co
    # Setup RBAC user using CLI
    couchbase-cli user-manage -c 127.0.0.1:8091 --username $COUCHBASE_ADMINISTRATOR_USERNAME --password $COUCHBASE_ADMINISTRATOR_PASSWORD \
    --set --rbac-username $COUCHBASE_RBAC_USERNAME --rbac-password $COUCHBASE_RBAC_PASSWORD --rbac-name $COUCHBASE_RBAC_NAME \
    --roles bucket_admin[*] --auth-domain local
    --roles bucket_full_access[*] --auth-domain local


    fg 1
    @@ -57,7 +57,7 @@ This approach inspired by the [tutorial](https://blog.couchbase.com/deploying-co

    - Once you have succesfully built the custom image, you can run it by providing the appropriate configuration options. Note that we have provided appropriate values for the parameters defined in the `configure-server.sh` file.
    ```bash
    $ docker run -d --name cb-server -p 8091-8094:8091-8094 -p 11210:11210 -e COUCHBASE_ADMINISTRATOR_USERNAME=Administrator -e COUCHBASE_ADMINISTRATOR_PASSWORD=password -e COUCHBASE_BUCKET=demobucket -e COUCHBASE_RBAC_USERNAME=admin -e COUCHBASE_RBAC_PASSWORD=password -e COUCHBASE_RBAC_NAME="admin-user" -e CLUSTER_NAME=demo-cluster couchbase-dev
    $ docker run -d --name cb-server -p 8091-8094:8091-8094 -p 11210:11210 -e COUCHBASE_ADMINISTRATOR_USERNAME=Administrator -e COUCHBASE_ADMINISTRATOR_PASSWORD=password -e COUCHBASE_BUCKET=demobucket -e COUCHBASE_RBAC_USERNAME=admin -e COUCHBASE_RBAC_PASSWORD=password -e COUCHBASE_RBAC_NAME="admin" -e CLUSTER_NAME=demo-cluster couchbase-dev
    ```

    - You can view the logs at any time by running the following command
  3. rajagp revised this gist Apr 3, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions custom_couchbase_dev_image.md
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,7 @@ This approach inspired by the [tutorial](https://blog.couchbase.com/deploying-co
    # Setup RBAC user using CLI
    couchbase-cli user-manage -c 127.0.0.1:8091 --username $COUCHBASE_ADMINISTRATOR_USERNAME --password $COUCHBASE_ADMINISTRATOR_PASSWORD \
    --set --rbac-username $COUCHBASE_RBAC_USERNAME --rbac-password $COUCHBASE_RBAC_PASSWORD --rbac-name $COUCHBASE_RBAC_NAME \
    --roles application_access[*] --auth-domain local
    --roles bucket_admin[*] --auth-domain local


    fg 1
    @@ -66,7 +66,7 @@ This approach inspired by the [tutorial](https://blog.couchbase.com/deploying-co
    ```

    ### Sample
    You can get a sample docker image of Couchbase Server 5.0.1 generated from the above script
    You can get a latest docker image of Couchbase Server generated from the above script
    ```bash
    docker pull priyacouch/couchbase-dev
    ```
  4. rajagp revised this gist Apr 3, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion custom_couchbase_dev_image.md
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,7 @@ This approach inspired by the [tutorial](https://blog.couchbase.com/deploying-co
    # Setup RBAC user using CLI
    couchbase-cli user-manage -c 127.0.0.1:8091 --username $COUCHBASE_ADMINISTRATOR_USERNAME --password $COUCHBASE_ADMINISTRATOR_PASSWORD \
    --set --rbac-username $COUCHBASE_RBAC_USERNAME --rbac-password $COUCHBASE_RBAC_PASSWORD --rbac-name $COUCHBASE_RBAC_NAME \
    --roles bucket_admin[*] --auth-domain local
    --roles application_access[*] --auth-domain local


    fg 1
  5. rajagp revised this gist Jan 17, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion custom_couchbase_dev_image.md
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,8 @@ This approach inspired by the [tutorial](https://blog.couchbase.com/deploying-co
    CMD ["/opt/couchbase/configure-server.sh"]
    ```
    - Create a new file named `configure-server.sh` an open it using an editor of your choice
    - Now add the following lines to the `configure-server.sh`. We are using the CLI and REST commands to configure the cluster, the Administrator user, the bucket and the RBAC user. You will update this script according to your configuration needs.
    - Now add the following lines to the `configure-server.sh`. We are using the CLI and REST commands to configure the cluster, the Administrator user, the bucket and the RBAC user.
    *You can update this script according to your configuration needs.*
    ```bash
    set -m

  6. rajagp revised this gist Jan 17, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion custom_couchbase_dev_image.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    ### Purpose
    Follow the steps below if you are interested in creating your own custom configurable Couchbase docker image. You will start off with the official Couchbase Enterprise docker image that is available on [Docker Hub](https://hub.docker.com) and leverage the [Couchbase CLI](https://developer.couchbase.com/documentation/server/5.0/cli/cbcli-intro.html) and [REST interface](https://developer.couchbase.com/documentation/server/5.0/rest-api/rest-intro.html) to create the custom image.
    Follow the steps below if you are interested in creating your own custom configurable Couchbase docker image. You will start off with the official Couchbase Enterprise docker image that is available on [Docker Hub](https://hub.docker.com/_/couchbase/) and use the [Couchbase CLI](https://developer.couchbase.com/documentation/server/5.0/cli/cbcli-intro.html) and [REST interface](https://developer.couchbase.com/documentation/server/5.0/rest-api/rest-intro.html) to create a custom configurable image.

    ### Credits
    This approach inspired by the [tutorial](https://blog.couchbase.com/deploying-containerized-couchbase-nosql-database-cluster-docker-video-tutorial/). We essentially built a custom docker image from the base Coucbase server image that is configured for our development needs!
  7. rajagp revised this gist Jan 17, 2018. 1 changed file with 16 additions and 3 deletions.
    19 changes: 16 additions & 3 deletions custom_couchbase_dev_image.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,10 @@
    ### Purpose
    Follow the steps below if you are interested in creating your own custom configurable Couchbase docker image. You will start off with the official Couchbase Enterprise docker image that is available on [Docker Hub](https://hub.docker.com) and leverage the [Couchbase CLI](https://developer.couchbase.com/documentation/server/5.0/cli/cbcli-intro.html) and [REST interface](https://developer.couchbase.com/documentation/server/5.0/rest-api/rest-intro.html) to create the custom image.

    ### Credits
    This approach inspired by the [tutorial](https://blog.couchbase.com/deploying-containerized-couchbase-nosql-database-cluster-docker-video-tutorial/). We essentially built a custom docker image from the base Coucbase server image that is configured for our development needs!

    ### Steps
    - Create a new file named `DockerFile` and open it using an editor of your choice
    - Now add the following lines to the `DockerFile`.
    ```bash
    @@ -6,7 +13,7 @@
    CMD ["/opt/couchbase/configure-server.sh"]
    ```
    - Create a new file named `configure-server.sh` an open it using an editor of your choice
    - Now add the following lines to the `configure-server.sh`. We are using the CLI and REST commands to configure the cluster, the Administrator user, the bucket and the RBAC user
    - Now add the following lines to the `configure-server.sh`. We are using the CLI and REST commands to configure the cluster, the Administrator user, the bucket and the RBAC user. You will update this script according to your configuration needs.
    ```bash
    set -m

    @@ -47,12 +54,18 @@
    docker build -t couchbase-dev .
    ```

    - Once you have succesfully built the custom image, you can launch it. Open a terminal window and type the following command. Note that we have provided appropriate values for the parameters defined in the `configure-server.sh` file.
    - Once you have succesfully built the custom image, you can run it by providing the appropriate configuration options. Note that we have provided appropriate values for the parameters defined in the `configure-server.sh` file.
    ```bash
    $ docker run -d --name cb-server --network cbnetwork -p 8091-8094:8091-8094 -p 11210:11210 -e COUCHBASE_ADMINISTRATOR_USERNAME=Administrator -e COUCHBASE_ADMINISTRATOR_PASSWORD=password -e COUCHBASE_BUCKET=demobucket -e COUCHBASE_RBAC_USERNAME=admin -e COUCHBASE_RBAC_PASSWORD=password -e COUCHBASE_RBAC_NAME="admin-user" -e CLUSTER_NAME=demo-cluster couchbase-dev
    $ docker run -d --name cb-server -p 8091-8094:8091-8094 -p 11210:11210 -e COUCHBASE_ADMINISTRATOR_USERNAME=Administrator -e COUCHBASE_ADMINISTRATOR_PASSWORD=password -e COUCHBASE_BUCKET=demobucket -e COUCHBASE_RBAC_USERNAME=admin -e COUCHBASE_RBAC_PASSWORD=password -e COUCHBASE_RBAC_NAME="admin-user" -e CLUSTER_NAME=demo-cluster couchbase-dev
    ```

    - You can view the logs at any time by running the following command
    ```bash
    docker logs -f cb-server
    ```

    ### Sample
    You can get a sample docker image of Couchbase Server 5.0.1 generated from the above script
    ```bash
    docker pull priyacouch/couchbase-dev
    ```
  8. rajagp created this gist Jan 17, 2018.
    58 changes: 58 additions & 0 deletions custom_couchbase_dev_image.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,58 @@
    - Create a new file named `DockerFile` and open it using an editor of your choice
    - Now add the following lines to the `DockerFile`.
    ```bash
    FROM couchbase
    COPY configure-server.sh /opt/couchbase
    CMD ["/opt/couchbase/configure-server.sh"]
    ```
    - Create a new file named `configure-server.sh` an open it using an editor of your choice
    - Now add the following lines to the `configure-server.sh`. We are using the CLI and REST commands to configure the cluster, the Administrator user, the bucket and the RBAC user
    ```bash
    set -m

    /entrypoint.sh couchbase-server &

    sleep 15

    # Setup initial cluster/ Initialize Node
    couchbase-cli cluster-init -c 127.0.0.1 --cluster-name $CLUSTER_NAME --cluster-username $COUCHBASE_ADMINISTRATOR_USERNAME \
    --cluster-password $COUCHBASE_ADMINISTRATOR_PASSWORD --services data,index,query,fts --cluster-ramsize 256 --cluster-index-ramsize 256 \
    --cluster-fts-ramsize 256 --index-storage-setting default \

    # Setup Administrator username and password
    curl -v http://127.0.0.1:8091/settings/web -d port=8091 -d username=$COUCHBASE_ADMINISTRATOR_USERNAME -d password=$COUCHBASE_ADMINISTRATOR_PASSWORD


    sleep 15

    # Setup Bucket
    couchbase-cli bucket-create -c 127.0.0.1:8091 --username $COUCHBASE_ADMINISTRATOR_USERNAME \
    --password $COUCHBASE_ADMINISTRATOR_PASSWORD --bucket $COUCHBASE_BUCKET --bucket-type couchbase \
    --bucket-ramsize 256

    sleep 15

    # Setup RBAC user using CLI
    couchbase-cli user-manage -c 127.0.0.1:8091 --username $COUCHBASE_ADMINISTRATOR_USERNAME --password $COUCHBASE_ADMINISTRATOR_PASSWORD \
    --set --rbac-username $COUCHBASE_RBAC_USERNAME --rbac-password $COUCHBASE_RBAC_PASSWORD --rbac-name $COUCHBASE_RBAC_NAME \
    --roles bucket_admin[*] --auth-domain local


    fg 1

    ```

    - Build the custom Docker Image using the `DockerFile`. The name of the image is `couchbase-dev`
    ```bash
    docker build -t couchbase-dev .
    ```

    - Once you have succesfully built the custom image, you can launch it. Open a terminal window and type the following command. Note that we have provided appropriate values for the parameters defined in the `configure-server.sh` file.
    ```bash
    $ docker run -d --name cb-server --network cbnetwork -p 8091-8094:8091-8094 -p 11210:11210 -e COUCHBASE_ADMINISTRATOR_USERNAME=Administrator -e COUCHBASE_ADMINISTRATOR_PASSWORD=password -e COUCHBASE_BUCKET=demobucket -e COUCHBASE_RBAC_USERNAME=admin -e COUCHBASE_RBAC_PASSWORD=password -e COUCHBASE_RBAC_NAME="admin-user" -e CLUSTER_NAME=demo-cluster couchbase-dev
    ```

    - You can view the logs at any time by running the following command
    ```bash
    docker logs -f cb-server
    ```