Multiple bitnami pgpool-II container - bitnami

Need clarification if this is doable. I have successfully ran Postgres with 2 containers namely master and slave. I would like to know if I can run more than one pgpool container ? If yes, is there any specific environment variables i need to set ?
Can I just take the below command and run in another pgpool VM ? My intention is to have a load balancer round robin between the 2 pgpool that connects to the backend of master (rw) and slave (ro).
docker run --detach --rm --name pgpool \
--network my-network \
--env PGPOOL_BACKEND_NODES=0:pg-0:5432,1:pg-1:5432 \
--env PGPOOL_SR_CHECK_USER=customuser \
--env PGPOOL_SR_CHECK_PASSWORD=custompassword \
--env PGPOOL_ENABLE_LDAP=no \
--env PGPOOL_POSTGRES_USERNAME=postgres \
--env PGPOOL_POSTGRES_PASSWORD=adminpassword \
--env PGPOOL_ADMIN_USERNAME=admin \
--env PGPOOL_ADMIN_PASSWORD=adminpassword \
bitnami/pgpool:latest

Related

How to put the moodle in the docker of aws

I am currently using ubuntu for EC2 and I have tested by docker in my laptop, it works perfectly, but when it is in EC2 with my putty that is using docker as the container, it cannot connect the server, it is rds in aws as well.
$ docker run -d --name moodle \
-p 8080:8080 -p 8443:8443 \
--env MOODLE_USERNAME=admin \
--env MOODLE_PASSWORD=password \
--env MOODLE_EMAIL=dreamorehk#gmail.com \
--env MOODLE_SITE_NAME=DreaMore \
--env MOODLE_DATABASE_TYPE=mysqli \
--env MOODLE_DATABASE_HOST=moodle-database.ccfdhd03ropx.ap-east-1.rds.amazonaws.com \
--env MOODLE_DATABASE_PORT_NUMBER=3306 \
--env MOODLE_DATABASE_NAME=moodle \
--env MOODLE_DATABASE_USER=moodleuser \
--env MOODLE_DATABASE_PASSWORD=moodle \
--volume moodle_data:/bitnami/moodle \
bitnami/moodle:latest

psql:/home/git/gitlab/db/structure.sql:9: ERROR: permission denied to create extension "btree_gist"

I installed docker-gitlab from here
Step 1. Launch a postgresql container
docker run --name gitlab-postgresql -d \
--env 'DB_NAME=gitlabhq_production' \
--env 'DB_USER=gitlab' --env 'DB_PASS=password' \
--env 'DB_EXTENSION=pg_trgm' \
--volume /srv/docker/gitlab/postgresql:/var/lib/postgresql \
sameersbn/postgresql:12-20200524
Step 2. Launch a redis container
docker run --name gitlab-redis -d \
--volume /srv/docker/gitlab/redis:/data \
redis:6.2
Step 3. Launch the gitlab container
docker run --name gitlab -d \
--link gitlab-postgresql:postgresql --link gitlab-redis:redisio \
--publish 10022:22 --publish 10080:80 \
--env 'GITLAB_PORT=10080' --env 'GITLAB_SSH_PORT=10022' \
--env 'GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string' \
--env 'GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alpha-numeric-string' \
--env 'GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alpha-numeric-string' \
--volume /srv/docker/gitlab/gitlab:/home/git/data \
sameersbn/gitlab:14.8.0
But i got these errors from gitlab container:
database 'gitlabhq_production' already exists
2022-02-28T17:02:02.425099812Z psql:/home/git/gitlab/db/structure.sql:9: ERROR: permission denied to create extension "btree_gist"
2022-02-28T17:02:02.425125024Z HINT: Must be superuser to create this extension.
2022-02-28T17:02:02.426554719Z rake aborted!
2022-02-28T17:02:02.426575880Z failed to execute:
2022-02-28T17:02:02.426586706Z psql --set ON_ERROR_STOP=1 --quiet --no-psqlrc --file /home/git/gitlab/db/structure.sql --single-transaction gitlabhq_production
2022-02-28T17:02:02.426598928Z
2022-02-28T17:02:02.426609892Z Please check the output above for any errors and make sure that `psql` is installed in your PATH and has proper permissions.

Run Jenkins on different port on a docker container

I'm trying to run Jenkins on docker by using a different port. By default Jenkins is running on port 8080, but this port is used by different service in my machine. I would like to run Jenkins on a different port.
I have used the following command without any success:
docker run \
-u root \
--rm \
-d \
--name jenkins \
-p 8081:8081 \
-p 50000:50000 \
--env JAVA_OPTS="--httpPort=8081" \
-v jenkins-data:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
jenkinsci/blueocean
Any ideas?
--env JAVA_OPTS="--httpPort=8081" \
not JAVA_OPTS, change it like this:
-e JENKINS_OPTS="--httpPort=8081"
Use this:
docker run \
-u root \
--rm \
-d \
--name jenkins \
-p 8081:8080 \
-p 50000:50000 \
-v jenkins-data:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
jenkinsci/blueocean

How can I map a hostname (subdomain) to Docker Container with Traefik?

I have multiple Docker containers running nginx that serves up a web application. These containers are running on a virtual machine abc.com. They all require https.
If I have just one container running, I can access the container running at abc.com:443 no problem. I can also run multiple containers using docker run and port mapping where I can map a port to 433 like this:
VersionA 0.0.0.0:5000->443 can hit on abc.com:5000
VersionB 0.0.0.0:5001->443 can hit on abc.com:5001
VersionC 0.0.0.0:5002->443 can hit on abc.com:5002
What I would like is:
vA.abc.com -> VersionAContainer:443
vB.abc.com -> VersionBContainer:443
vC.abc.com -> VersionCContainer:443
These containers will spin up and close regularly and need them to be picked up by Traefik. What is the proper build command for traefik and run command for the container using labels?
This is how I was running the Traefik container with no luck.
sudo docker container run -d --name traefik_proxy \
--network traefik_webgateway \
-p 80:80 \
-p 443:443 \
-p 8080:8080 \
--restart always \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume /dev/null:/traefik.toml \
traefik --docker --logLevel=INFO --api \
--entrypoints="Name:http Address::80 Redirect.EntryPoint:https" \
--entrypoints="Name:https Address::443 TLS" \
--defaultentrypoints="http,https"
And this is how I was running my container:
sudo docker run -d --name some-nginx \
--network traefik_webgateway \
--label traefik.docker.network=traefik_webgateway \
--label traefik.protocol=https \
--label traefik.frontend.entryPoints=http,https \
--label traefik.frontend.rule=Host:something.localhost \ # unsure if this is correct to use local host or abc.com
--label traefik.port=443 \
--label traefik.frontend.auth.forward.tls.insecureSkipVerify=true \
container:latest

Issue in connecting ksql with kafka of confluent version 3.3.0 in docker

I am setting up ksql-cli with confluent version 3.3.0 in following way
#zookeper
docker run -d -it \
--net=host \
--name=zookeeper \
-e ZOOKEEPER_CLIENT_PORT=32181 \
confluentinc/cp-zookeeper:3.3.0
#kafka
docker run -d \
--net=host \
--name=kafka \
-e KAFKA_ZOOKEEPER_CONNECT=localhost:32181 \
-e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://localhost:29092 \
-e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 \
confluentinc/cp-kafka:3.3.0
#schema-registry
docker run -d \
--net=host \
--name=schema-registry \
-e SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL=localhost:32181 \
-e SCHEMA_REGISTRY_HOST_NAME=localhost \
-e SCHEMA_REGISTRY_LISTENERS=http://localhost:8081 \
confluentinc/cp-schema-registry:3.3.0
i am running ksql-cli docker image in following manner
docker run -it \
--net=host \
--name=ksql-cli \
-e KSQL_CONFIG_DIR="/etc/ksql" \
-e KSQL_LOG4J_OPTS="-Dlog4j.configuration=file:/etc/ksql/log4j-rolling.properties" \
-e STREAMS_BOOTSTRAP_SERVERS=localhost:29092 \
-e STREAMS_SCHEMA_REGISTRY_HOST=localhost \
-e STREAMS_SCHEMA_REGISTRY_PORT=8081 \
confluentinc/ksql-cli:0.5
when i am running ksql-cli by going in bash of container in folowing way
docker exec -it ksql-cli bash
and running ksql-cli in following way:
./usr/bin/ksql-cli local
It is giving me following error:
Initializing KSQL...
Could not fetch broker information. KSQL cannot initialize AdminCLient.
By default, the ksql-cli attempts to connect to the Kafka brokers on localhost:9092. It looks like your setup is using a different port, so you'll need to provide this on the command line, e.g.
./usr/bin/ksql-cli local --bootstrap-server localhost:32181
You'll probably also need to specify the schema registry port, so you may want to use a properties file, e.g. :
./usr/bin/ksql-cli local --properties-file ./ksql.properties
Where ksql.properties has:
bootstrap.servers=localhost:29092
schema.registry.url=localhost:8081
Or provide both on the command line:
./usr/bin/ksql-cli local \
--bootstrap-server localhost:29092 \
--schema.registry.url http://localhost:8081
Note, from KSQL version 4.1 onwards the commands and properties change name. ksql-cli becomes just ksql. The local mode disappears - you'll need to run a ksql-server node or two explicitly. --property-file becomes --config-file and schema.registry.url becomes ksql.schema.registry.url.

Resources