Cannot assign requested address with YugabyteDB and Docker Volume - database

Problem when using yugabyte with persistence volume in docker.
On first run everything work fine, but when re-create container with existing volume, it fail to start:
master.err :
./../src/yb/master/master_main.cc:131] Network error (yb/util/net/socket.cc:325): Error binding socket to 172.28.0.3:7100: Cannot assign requested address (system error 99)
# 0x2938618 google::LogMessage::SendToLog()
# 0x29394d3 google::LogMessage::Flush()
# 0x29399cf google::LogMessageFatal::~LogMessageFatal()
# 0x2677cde main
# 0x7fb112f46825 __libc_start_main
# 0x260802e _start (edited)
There is a yugabyted.conf in yb-data/conf with the ip is written there
When we re-create container the container will get new ip but the ip in yugabyted.conf is old ip address of container
...
"advertise_address": "172.28.0.3",
...

When starting with yugabyted, the directory set by --base_dir holds the configuration in conf/yugabyted.conf, and the data directory in data which is set by --fs_data_dirs when starting yb-master and yb-tserver.
If you want the data directory in the volume but not the configuration, you can set it with:
--tserver_flags=fs_data_dirs=/ybdata --master_flags=fs_data_dirs=/ybdata
and leave --base_dir within the container
Another possibility if you want the configuration in the external volume is to use a configuration that is not dependent on container addresses, like with:
--advertise_address=0.0.0.0
which will listen on all interfaces

Related

Setup Xdebug for Shopware docker failed

I try to setup Xdebug for shopware-docker without success.
VHOST_[FOLDER_NAME_UPPER_CASE]_IMAGE=ghcr.io/shyim/shopware-docker/6/nginx:php74-xdebug
After replacing your Folder Name and running swdc up Xdebug should be activated.
Which folder name should I place?
Using myname, the same name as in /var/www/html/myname, return error on swdc up myname:
swdc up myname
[+] Running 2/0
⠿ Network shopware-docker_default Created 0.0s
⠿ Container shopware-docker-mysql-1 Created 0.0s
[+] Running 1/1
⠿ Container shopware-docker-mysql-1 Started 0.3s
.database ready!
[+] Running 0/1
⠿ app_myname Error 1.7s
Error response from daemon: manifest unknown
EDIT #1
With this setup VHOST_MYNAME_IMAGE=ghcr.io/shyim/shopware-docker/6/nginx:php81-xdebug (versioned Xdebug) the app started:
// $HOME/.config/swdc/env
...
VHOST_MYNAME_IMAGE=ghcr.io/shyim/shopware-docker/6/nginx:php81-xdebug
But set a debug breakpoint (e.g. in index.php), nothing happens
EDIT #2
As #Alex recommend, i place xdebug_break() inside my code and it works.
Stopping on the breakpoint the debugger log aswers with hints/warnings like described in the manual:
...
Cannot find a local copy of the file on server /var/www/html/%my_path%
Local path is //var/www/html/%my_path%
...
click on Click to set up path mapping to open the modal
click inside modal select input Use path mapping (...)
input field File path in project response with undefined
But i have already set up the mapping like described in the manual, go to File | Settings | PHP | Servers:
Why does not work my mapping? Where failed my set up?
The path mapping needs to be between your local project path on your workstation and the path inside the docker containers. Without xDebug has a hard time mapping the breakpoints from PHPStorm to the actual code inside the container.
If mapping the path correctly does not work and if its a possibility for you, i can highly recommend switching to http://devenv.sh for your development enviroment. Shopware itself promotes this new enviroment in their documentation: https://developer.shopware.com/docs/guides/installation/devenv and provides an example on how to enable xdebug:
# devenv.local.nix File
{ pkgs, config, lib, ... }:
{
languages.php.package = pkgs.php.buildEnv {
extensions = { all, enabled }: with all; enabled ++ [ amqp redis blackfire grpc xdebug ];
extraConfig = ''
# Copy the config from devenv.nix and append the XDebug config
# [...]
xdebug.mode=debug
xdebug.discover_client_host=1
xdebug.client_host=127.0.0.1
'';
};
}
A correct path mapping should not be needed here, as your local file location is the same for XDebug and your PHPStorm.

Using a different doctrine.yaml file in dev and prod with Symfony4

In a symfony4 project, I want to use a sqlite database in local development and a mariadb instance or production. In the structure, I see there is the main doctrine.yaml in config/packages.
Since sqlite file location congifured with path: and mariadb/mysql finds the connection string via url:, can I move the doctrine.yaml file to /dev/ and add the dbal: to /prod/doctrine.yaml?
Yes, because of these lines in your src/Kernel.php, Symfony will load first your global packages, and next your per-environment packages
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
{
$confDir = $this->getProjectDir().'/config';
$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
}

Using JanusGraph with Solr

Setting up JanusGraph i noticed the following in the console:
09:04:12,175 INFO ReflectiveConfigOptionLoader:173 - Loaded and initialized config classes: 10 OK out of 12 attempts in PT0.023S
09:04:12,230 INFO Reflections:224 - Reflections took 28 ms to scan 1 urls, producing 2 keys and 2 values
09:04:12,291 WARN GraphDatabaseConfiguration:1445 - Local setting index.search.index-name=entity (Type: GLOBAL_OFFLINE) is overridden by globally managed value (janusgraph). Use the ManagementSystem interface instead of the local configuration to control this setting.
09:04:12,294 WARN GraphDatabaseConfiguration:1445 - Local setting index.search.backend=solr (Type: GLOBAL_OFFLINE) is overridden by globally managed value (elasticsearch). Use the ManagementSystem interface instead of the local configuration to control this setting.
09:04:12,300 INFO CassandraThriftStoreManager:628 - Closed Thrift connection pooler.
and then i see the following:
Exception in thread "main" java.lang.IllegalArgumentException: Could not instantiate implementation: org.janusgraph.diskstorage.es.ElasticSearchIndex
How do i stop using elasticsearch and switch to Solr?
My properties file is as follows:
index.search.backend=solr
index.search.directory=/path/to/directory/for/solr/index/something
index.search.index-name=something
index.search.solr.mode=http
index.search.solr.http-urls=http://127.0.0.1:8983/solr
storage.backend=cassandrathrift
storage.hostname=127.0.0.1
cache.db-cache = true
cache.db-cache-clean-wait = 20
cache.db-cache-time = 180000
cache.db-cache-size = 0.25
The answer to this basically the same as this one for Titan. JanusGraph was forked from Titan.
You are probably trying to connect to an existing graph that was previously configured to use Elasticsearch. By default, the keyspace is named janusgraph.
1) You could connect to a different keyspace by updating conf/janusgraph-cassandra.properties
gremlin.graph=org.janusgraph.core.JanusGraphFactory
storage.backend=cassandrathrift
storage.hostname=127.0.0.1
storage.cassandra.keyspace=mygraph
2) You could drop the existing keyspace. If you used bin/janusgraph.sh start from the quick start directions (which starts a single node Cassandra and a single node Elasticsearch),
bin/janusgraph.sh clean
Or if you have a standalone Cassandra installation:
$CASSANDRA_HOME/bin/cqlsh -e 'drop keyspace if exists janusgraph'
Then you would be able to connect with the default conf/janusgraph-cassandra.properties.

Symfony Sonata SortableBehaviorBundle other DB connection

I have successfully installed the SortableBehaviorBundle in the Sonata-Admin. Now i'm not using only the default DB-connection, but some different for different bundles.
in config.yml
doctrine:
dbal:
default_connection: mysql
connections:
mysql:
driver: "%mysql_database_driver%"
...
geobundle:
driver: "%geo_database_driver%"
...
in vendor/pixassociates/sortable-behavior-bundle/Pix/SortableBehaviorBundle/Resources/config/services.yml
there ist the definition of
...
arguments:
- "#doctrine.orm.entity_manager"
if I change this to
- "#doctrine.orm.geobundle_entity_manager"
I get the sorted data from my geobundle-DB. If I try to override the setting by my own app/config/services.yml, I get a:
Attempted to call an undefined method named "get" of class
"Macrocom\GeoAdminBundle\Entity\AppAccessServiceprovider". Did you
mean to call e.g. "getAppAccess", "getConfig", "getCreatedAt",
"getId", "getIsActive", "getPosition", "getServiceprovider" or
"getUpdatedAt"?
but when I leave this on original setting I get
An exception has been thrown during the rendering of a template ("The
class 'ACME\GeoAdminBundle\Entity\AppAccessServiceprovider' was
not found in the chain configured namespaces
ACME\ApiBundle\Entity, ACME\CrmSyncBundle\Entity").
witch seems to try to access the mysql-DB and namespace.
As I dont wat to change the SortableBehaviorBundle everytime I deploy or update teh project to the server, is there a way to override the default-DB for this bundle only.
Best regards
RJ

Get public Ip Address of Google App engine Project

I hosted my project at www.example.appspot.com and I want to register for a service that required my public Ip address. How do i get the IP address of my app engine project. Thanks.
You can use any DNS lookup tool to get the address of the host.
For example on linux you'd get something along these lines:
$ nslookup www.example.appspot.com
...
Non-authoritative answer:
www.example.appspot.com canonical name = appspot.l.google.com.
Name: appspot.l.google.com
Address: 216.58.219.241
$ host www.example.appspot.com
www.example.appspot.com is an alias for appspot.l.google.com.
appspot.l.google.com has address 216.58.219.241
appspot.l.google.com has IPv6 address 2607:f8b0:4006:80e::2011
appspot.l.google.com mail is handled by 10 alt1.gmr-smtp-in.l.google.com.
appspot.l.google.com mail is handled by 40 alt4.gmr-smtp-in.l.google.com.
appspot.l.google.com mail is handled by 5 gmr-smtp-in.l.google.com.
appspot.l.google.com mail is handled by 30 alt3.gmr-smtp-in.l.google.com.
appspot.l.google.com mail is handled by 20 alt2.gmr-smtp-in.l.google.com.
Google AppEngine doesn't have a single IP. It runs on Google's network on very large number of machines over different regions and therefore it has many IP addresses (or ranges).
Here is how you can find these ranges:
Run dig -t txt _cloud-netblocks.googleusercontent.com
Partial list of CIDR blocks is:
8.34.208.0/20
8.35.192.0/21
8.35.200.0/23
23.236.48.0/20
23.251.128.0/19
107.167.160.0/19
107.178.192.0/18
108.170.192.0/20
108.170.208.0/21
108.170.216.0/22
108.170.220.0/23
108.170.222.0/24
108.59.80.0/20
130.211.4.0/22
146.148.16.0/20
146.148.2.0/23
146.148.32.0/19
146.148.4.0/22
146.148.64.0/18
146.148.8.0/21
162.216.148.0/22
162.222.176.0/21
173.255.112.0/20
192.158.28.0/22
199.192.112.0/22
199.223.232.0/22
199.223.236.0/23
A more updated (April 2018) answer based on what I went through today to launch pixler.io is as follows:
In Google Cloud Platform go to your App Engine and click on "settings", from there you will have to go to "Custom Domains" and add your domain.
You will be asked to verify your domain by adding a TEXT record. After you do that, you will see the IP addresses populated in the "Data" column, you can copy that into your A record

Resources