Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set meUser to host user in v4 #177

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})

### Bug Fixes

* Fixed issue with importing databases to a service with the "default" `database` named database. [lando/mysql#53](https://github.com/lando/mysql/issues/53)

## v3.21.0 - [May 25, 2024](https://github.com/lando/core/releases/tag/v3.21.0)

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion builders/lando-v4.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ module.exports = {

// add some upstream stuff and legacy stuff
upstream.appMount = config['app-mount'].destination;
upstream.legacy = merge({}, {meUser: username}, upstream.legacy ?? {});
upstream.legacy = merge({}, upstream.legacy ?? {}, {meUser: username});
// this will change but for right now i just need the image stuff to passthrough
upstream.config = {image: config.image};

Expand Down
50 changes: 50 additions & 0 deletions examples/sql-helpers/.lando.sqlhelpers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ services:
MYSQL_DATABASE: lando_test
MARIADB_USER: test
MARIADB_PASSWORD: test
mariadb-default:
api: 3
type: lando
healthcheck: mysqladmin ping -h mariadb-default -u test -ptest
services:
image: bitnami/mariadb:10.4
command: /opt/bitnami/scripts/mariadb/entrypoint.sh /opt/bitnami/scripts/mariadb/run.sh
environment:
ALLOW_EMPTY_PASSWORD: yes
MARIADB_DATABASE: database
MYSQL_DATABASE: database
MARIADB_USER: test
MARIADB_PASSWORD: test

mysql57:
api: 3
Expand All @@ -27,6 +40,19 @@ services:
MYSQL_DATABASE: lando_test
MYSQL_PASSWORD: test
MYSQL_USER: test
mysql57-default:
api: 3
type: lando
healthcheck: mysqladmin ping -h mysql57-default -u test -ptest
services:
image: bitnami/mysql:5.7
command: /opt/bitnami/scripts/mysql/entrypoint.sh /opt/bitnami/scripts/mysql/run.sh
environment:
ALLOW_EMPTY_PASSWORD: yes
MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password
MYSQL_DATABASE: database
MYSQL_PASSWORD: test
MYSQL_USER: test

mysql80:
api: 3
Expand All @@ -41,6 +67,19 @@ services:
MYSQL_DATABASE: lando_test
MYSQL_PASSWORD: test
MYSQL_USER: test
mysql80-default:
api: 3
type: lando
healthcheck: mysqladmin ping -h mysql80-default -u test -ptest
services:
image: bitnami/mysql:8.0
command: /opt/bitnami/scripts/mysql/entrypoint.sh /opt/bitnami/scripts/mysql/run.sh
environment:
ALLOW_EMPTY_PASSWORD: yes
MYSQL_AUTHENTICATION_PLUGIN: caching_sha2_password
MYSQL_DATABASE: database
MYSQL_PASSWORD: test
MYSQL_USER: test

postgres16:
api: 3
Expand All @@ -53,6 +92,17 @@ services:
ALLOW_EMPTY_PASSWORD: yes
POSTGRESQL_DATABASE: lando_test
POSTGRES_DB: lando_test
postgres16-default:
api: 3
type: lando
healthcheck: pg_isready -h postgres16-default -U postgres
services:
image: bitnami/postgresql:16
command: /opt/bitnami/scripts/postgresql/entrypoint.sh /opt/bitnami/scripts/postgresql/run.sh
environment:
ALLOW_EMPTY_PASSWORD: yes
POSTGRESQL_DATABASE: database
POSTGRES_DB: database

plugins:
"@lando/core": "../../.."
20 changes: 20 additions & 0 deletions examples/sql-helpers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,41 @@ cd sqlhelpers
lando ssh -s mariadb -c "/helpers/sql-import.sh testdata1.sql"
lando ssh -s mariadb -c "mysql -utest -ptest lando_test -e 'select * from lando_test'" | grep "lando_original"

# Should import test data into mariadb-default
cd sqlhelpers
lando ssh -s mariadb-default -c "/helpers/sql-import.sh testdata1.sql"
lando ssh -s mariadb-default -c "mysql -utest -ptest database -e 'select * from lando_test'" | grep "lando_original"

# Should import test data into mysql57
cd sqlhelpers
lando ssh -s mysql57 -c "/helpers/sql-import.sh testdata1.sql"
lando ssh -s mysql57 -c "mysql -utest -ptest lando_test -e 'select * from lando_test'" | grep "lando_original"

# Should import test data into mysql57-default
cd sqlhelpers
lando ssh -s mysql57-default -c "/helpers/sql-import.sh testdata1.sql"
lando ssh -s mysql57-default -c "mysql -utest -ptest database -e 'select * from lando_test'" | grep "lando_original"

# Should import test data into mysql80
cd sqlhelpers
lando ssh -s mysql80 -c "/helpers/sql-import.sh testdata1.sql"
lando ssh -s mysql80 -c "mysql -utest -ptest lando_test -e 'select * from lando_test'" | grep "lando_original"

# Should import test data into mysql80-default
cd sqlhelpers
lando ssh -s mysql80-default -c "/helpers/sql-import.sh testdata1.sql"
lando ssh -s mysql80-default -c "mysql -utest -ptest database -e 'select * from lando_test'" | grep "lando_original"

# Should import test data into postgres16
cd sqlhelpers
lando ssh -s postgres16 -c "/helpers/sql-import.sh testdata1.sql"
lando ssh -s postgres16 -c "psql -U postgres -d lando_test -c 'select * from lando_test'" | grep "lando_original"

# Should import test data into postgres16-default
cd sqlhelpers
lando ssh -s postgres16-default -c "/helpers/sql-import.sh testdata1.sql"
lando ssh -s postgres16-default -c "psql -U postgres -d database -c 'select * from lando_test'" | grep "lando_original"

# Should export gzipped files from mariadb
cd sqlhelpers
lando ssh -s mariadb -c "/helpers/sql-export.sh mariadb_dump.sql" -u root
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions scripts/sql-import.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ if [ "$WIPE" == "true" ]; then
SQLSTART="mysql -h $HOST -P $PORT -u $USER ${LANDO_EXTRA_DB_IMPORT_ARGS}"

# Drop and recreate database
$SQLSTART -e "DROP DATABASE IF EXISTS ${DATABASE}"
$SQLSTART -e "CREATE DATABASE ${DATABASE}"
$SQLSTART -e "DROP DATABASE IF EXISTS \`${DATABASE}\`"
$SQLSTART -e "CREATE DATABASE \`${DATABASE}\`"
fi
fi

Expand Down