Comments (9)
Here are some config infos: http://stackoverflow.com/a/22102219
from appside.
MySQL port is 3307
on the VIP
:
netstat -tulpen | grep haproxy
tcp 0 0 0.0.0.0:3307 0.0.0.0:* LISTEN 0 1628382 5113/haproxy
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 0 1628380 5113/haproxy
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 0 1628379 5113/haproxy
mysql --host=VIP --port=3307
from appside.
we need to override DB_HOST
(mysql.local
will point to VIP
in /etc/hosts
):
...
config_env: true
env_opt: |
DB_HOST=mysql.local:3307
CFG_URL_DEVELOPMENT='http://site.dev.foo.com'
...
so we basically override DB_HOST
in .env
:
...
DB_HOST=mysql.local
DB_HOST=mysql.local:3307
...
@ocean90 is it possible to print the actual MySQL connection info which WP is using?
from appside.
Something like mysqli_get_host_info()
?
$ wp shell
wp> mysqli_get_host_info( $GLOBALS['wpdb']->dbh );
=> string(22) "mysql.local via TCP/IP"
from appside.
works fine, thanks:
% wp shell
wp> mysqli_get_host_info( $GLOBALS['wpdb']->dbh );
=> string(22) "mysql.local via TCP/IP"
but I need to print the port also or better the whole DB_HOST
which contains the port also.
from appside.
To print the value of a constant you can use var_dump()
like so:
$ wp eval "var_dump( DB_HOST );"
string(11) "mysql.local"
from appside.
ok, this gives:
% wp eval "var_dump( DB_HOST );"
string(11) "mysql.local"
but we would like to have:
% wp eval "var_dump( DB_HOST );"
string(11) "mysql.local:3307"
this means that
...
DB_HOST=mysql.local
DB_HOST=mysql.local:3307
...
does not overwrite as expected, WP get's always the first entry. This means we need to edit https://github.com/ttssdev/appflow/blob/master/playbooks/roles/web/templates/wp_bedrock/env.j2#L8 but keeping in mind that this is only for e.g. staging and production, not dev for sure or situations where we only have one MySQL node.
we can also think to make DB_HOST
and DB_PORT
vars of a vhost
definition, like:
...
DB_NAME={{ item.value.db_name }}
DB_USER={{ item.value.db_user }}
DB_PASSWORD={{ item.value.db_password }}
DB_HOST={{ item.value.db_host }}
DB_PORT={{ item.value.db_port }}
DB_PREFIX={{ item.value.db_prefix }}
...
this means also setting a default value for DB_HOST
and DB_PORT
if not otherwise specified in the vhost
definition in order to not break existing configurations.
to make a sure test we need to take down MySQL on the node which currently has the VIP address.
from appside.
For default vars we should http://stackoverflow.com/a/42109037.
from appside.
with commit 8656fba we've introduced db_connection_host
var for vhost
definitions:
...
serveradmin: [email protected]
db_name: foo_wp
db_user: foo_wp
db_password: RANDOM
db_connection_host: mysql.local:3307 <- IF NOT GIVEN FALLBACK to mysql.local
db_host: '%'
db_prefix: foo_
glusterfs_uploads: foo
...
this means all vhost
definitions, where multiple nodes via PXC are involved, need to have this definition, this is not the case for hosts with a single MySQL instance like atlantis
but for correctness we should define db_connection_host: mysql.local
there.
from appside.
Related Issues (20)
- Support for MySQL flavours/versions HOT 1
- Support for PHP/HHVM flavours/versions HOT 1
- Support for nginx HOT 1
- Support for Varnish flavours/versions
- Migration to xenial as default for atlantis (appflow.py) HOT 1
- fstab
- add nodejs and npm support to jailkit HOT 1
- Don't blindly add bash autocompletion HOT 4
- Version HOT 2
- `appflow vhosts` adds too many newlines HOT 3
- Preventing encrypted data being overwritten by different user HOT 3
- Stats HOT 1
- appflow update & appflow checkin commands seem fragile HOT 1
- appflow - woodwing - add module contentstation HOT 4
- pip3 install appflow doesn't install required dependencies?
- woodwing: config.php / configserver.php removed at rollout HOT 3
- jailkit HOT 2
- WordPress Config: Use https by default and/or add setting for https HOT 9
- woodwing rsync command not working HOT 1
- Documentation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from appside.