Comments (2)
Well, I can't really give an affirmative or negative opinion because it's not clear enough to me what option is being considered or what the pain-point is for "pre-creat[ing] a services.xml."
It seems that there are a few things floating around here:
- The configuration-management techniques of using
amp config:set
vs editingservices.yml
directly vs manipulating env-vars vs runtime CLI args. - The workflow of creating MySQL users+databases on-demand (
CREATE DATABASE... CREATE USER...
) -- versus the workflow of externally pre-creating MySQL users+databases. (mysql_dsn
vsmysql_precreated
) - The formula for naming MySQL users+databases. (For
mysql_dsn
, that's a fixed formula per https://github.com/amp-cli/amp/blob/master/src/Amp/Database/MySQL.php#L55. But formysql_precreated
, one is required to set their own formula viaPRECREATED_DSN_PATTERN
.) - The development strategy of making a configurable
amp
driver (egamp-cli/amp
) vs bespokeamp
drivers (e.g. a dumb bash-script that just outputs constants).
It sounds to me like you're mostly concerned with the formula (3) for new DBs - circa Amp/Database/MySQL.php
@55
. Agree that could be improved. The question is -- what is the new formula?. Here are a few different ways to make the formula work:
- a. Make a setting out of it. (Ex:
mysql_db_template={{DIR}}_{{NAME}}_{{RAND}}
). Include variables for things like: the base-directory of the build (dmaster
vswpmaster
), the logical subparts (cms
vscivi
vstest
), and random nonces. Maybe also passthru env-vars.- If your use-cases are agreeable, then you can use a prettier formula like
mysql_db_template={{DIR}}_{{NAME}}
. - If you want to control the names precisely and have the fortitude to consistently set the env-vars then configure
mysql_dsn_template=$MY_DB
and run withenv MY_DB=foo amp create
.
- If your use-cases are agreeable, then you can use a prettier formula like
- b. Make some kind of callback/callout.
- c. Use an incrementing suffix instead of random code. This requires probing to see if the DB already exists (s.t. new builds don't conflict with old builds), but it also requires some stability (s.t. re-builds have stable/consistent names). I think I wanted that way-way-back (before anything was ever released) but got lazy about how to verify that it'd work in those edge-cases. However, MySQLPrecreated now has a probe - maybe
MySQL.php
could borrow the probing bits fromMySQLPrecreated.php
?
The main thing is to keep an eye on the overall usage/workflow when juggling builds, e.g. consider operations:
- Add new project A
- Add new project B
- Rebuild project A
- Drop project A
- And new project C
- Rebuild project B
(Where projects A, B, C may be similar to each other - or different from each other.) At steps 1+2+5, it should pick new names. At steps 3+6, it should retain names. At step 4
from amp.
@totten right so what I'm finding is that the services.yml can wind up being deleted or being inconsistent/ hard to maintain across environments (CI vs docker vs vagrant) but I want to have a consistent db name that we pre-determine
Note that we are still looking to create the db when we first run civibuild create wmff - it's just that we want to specify the db name it uses in the command. This makes it easier to grant our dbuser (which has the same name) access to other databases and means that we can set up mysql connections in phpstorm (for example) and know that the db name is not going to change.
so looking for something like
civibuild create wmff --admin_pass=admin --db_name=my_db_name
where db_name is an optional param that would override any potentially generated one (& be the default for db_user as is currently the case)
I think the parameter could be ignored / error out if the yml already exists and has a different name
I guess passing in env params is slightly-uglier but equivalent - ie
env mysql_DB_Name=my_db_name && civibuild create wmff --admin_pass=admin
from amp.
Related Issues (20)
- amp config - Better advice on httpd
- Connection must originate on localhost HOT 3
- Nginx support HOT 3
- Check for Apache mod_rewrite HOT 5
- NginX: Restrict access to sensitive directories
- Is app/defaults/services.yml distributed? HOT 1
- Warning: file_get_contents(http://localhost:7979/index.php): failed to open stream: Connection refused HOT 5
- nginx vhost view doesn't detect whether php is running on a port or a socket. HOT 3
- No random characters at the end of database name HOT 9
- amp config fails for invalid mysql config HOT 10
- amp config failed to read :7979 HOT 6
- Update README.md
- permissions: worldWritable not working for unprivileged users HOT 4
- Detect if we're running with encrypted home directories and suggest using AMPHOME instead HOT 3
- Allow longer database names HOT 5
- Make apache vhost config 12 factor friendly HOT 2
- Apache access denied without +x for user home directory
- Explicitly identify common stacks/environments
- Clarity / documentation
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 amp.