Starting Liquibase at 02:45:32 (version 4.3.5 #62 built at 2021-04-29 18:31+0000)
BEST PRACTICE: The changelog generated by diffChangeLog/generateChangeLog should be inspected for correctness and completeness before being deployed.
Liquibase command ‘generateChangeLog’ was executed successfully.
I haven’t tried this but may be you could give this a try and check if this helps.
Try using options: --includeSchema=true and --schemas=your_schema_name
in your generateChangelog command. These options works in PostgreSQL DB for me.
the container exits immediately , hence i don’t know where to check the changelog file contents
Any suggestions?
docker run --rm -v /root/liquibase/changelog:/liquibase/changelog liquibase:4.3.5 --url=“jdbc:mysql://10.x.x.x:3306/dbname” --driver=“com.mysql.cj.jdbc.Driver” --username=“username” --password=‘password’ --defaultSchemaName=performance_schema --changeLogFile=test.xml --logLevel INFO --includeSchema=true --schemas=dbname generateChangeLog
####################################################
Starting Liquibase at 06:31:12 (version 4.3.5 #62 built at 2021-04-29 18:31+0000)
BEST PRACTICE: The changelog generated by diffChangeLog/generateChangeLog should be inspected for correctness and completeness before being deployed.
[2021-06-03 06:31:14] INFO [liquibase.diff] changeSets count: 3
[2021-06-03 06:31:14] INFO [liquibase.diff] test.xml does not exist, creating and adding 3 changesets.
Liquibase command ‘generateChangeLog’ was executed successfully.
{coode}
$ ls -lah
total 984K
drwxr-xr-x. 2 root root 94 Jun 3 06:20 .
drwxr-xr-x. 1 liquibase root 40 Jun 3 06:45 …
-rwxrwxrwx. 1 root root 0 Jun 1 04:22 changelog.sql
-rwxrwxrwx. 1 root root 0 Jun 3 04:58 cl.sql
-rwxrwxrwx. 1 root root 0 Jun 1 04:28 cl.xml
-rwxr-xr-x. 1 root root 984K Nov 20 2019 mysql-connector-java-5.1.48.jar
{code}
so now i tried
docker run --rm -v /root/liquibase/changelog:/liquibase/changelog liquibase:4.3.5 --url=“jdbc:mysql://10.x.x.x:3306/dbname” --driver=“com.mysql.cj.jdbc.Driver” --username=“username” --password=‘password’ --defaultSchemaName=performance_schema --changeLogFile=/liquibase/changelog/test.xml --logLevel INFO --includeSchema=true --schemas=dbname generateChangeLog
Starting Liquibase at 06:52:47 (version 4.3.5 #62 built at 2021-04-29 18:31+0000)
BEST PRACTICE: The changelog generated by diffChangeLog/generateChangeLog should be inspected for correctness and completeness before being deployed.
[2021-06-03 06:52:48] INFO [liquibase.diff] changeSets count: 0
[2021-06-03 06:52:48] INFO [liquibase.diff] No changesets to add.
Unexpected error running Liquibase: java.io.FileNotFoundException: /liquibase/changelog/test.xml (Permission denied)
For more information, please use the --logLevel flag
[2021-06-03 06:52:48] SEVERE [liquibase.integration] Unexpected error running Liquibase: java.io.FileNotFoundException: /liquibase/changelog/test.xml (Permission denied)
liquibase.exception.LiquibaseException: liquibase.command.CommandExecutionException: java.io.FileNotFoundException: /liquibase/changelog/test.xml (Permission denied)
at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog(CommandLineUtils.java:251)
at liquibase.integration.commandline.Main.doMigration(Main.java:1542)
at liquibase.integration.commandline.Main$1.lambda$run$0(Main.java:367)
at liquibase.Scope.lambda$child$0(Scope.java:160)
at liquibase.Scope.child(Scope.java:169)
at liquibase.Scope.child(Scope.java:159)
at liquibase.Scope.child(Scope.java:138)
at liquibase.integration.commandline.Main$1.run(Main.java:366)
at liquibase.integration.commandline.Main$1.run(Main.java:196)
at liquibase.Scope.child(Scope.java:169)
at liquibase.Scope.child(Scope.java:145)
at liquibase.integration.commandline.Main.run(Main.java:196)
at liquibase.integration.commandline.Main.main(Main.java:158)
Caused by: liquibase.command.CommandExecutionException: java.io.FileNotFoundException: /liquibase/changelog/test.xml (Permission denied)
at liquibase.command.AbstractCommand.execute(AbstractCommand.java:24)
at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog(CommandLineUtils.java:249)
… 12 more
Caused by: java.io.FileNotFoundException: /liquibase/changelog/test.xml (Permission denied)
at java.base/java.io.FileOutputStream.open0(Native Method)
at java.base/java.io.FileOutputStream.open(Unknown Source)
at java.base/java.io.FileOutputStream.(Unknown Source)
at java.base/java.io.FileOutputStream.(Unknown Source)
at liquibase.diff.output.changelog.DiffToChangeLog.printNew(DiffToChangeLog.java:235)
at liquibase.diff.output.changelog.DiffToChangeLog$1.run(DiffToChangeLog.java:133)
at liquibase.Scope.lambda$child$0(Scope.java:160)
at liquibase.Scope.child(Scope.java:169)
at liquibase.Scope.child(Scope.java:159)
at liquibase.Scope.child(Scope.java:138)
at liquibase.diff.output.changelog.DiffToChangeLog.print(DiffToChangeLog.java:127)
at liquibase.diff.output.changelog.DiffToChangeLog.print(DiffToChangeLog.java:85)
at liquibase.command.core.GenerateChangeLogCommand.run(GenerateChangeLogCommand.java:74)
at liquibase.command.AbstractCommand.execute(AbstractCommand.java:19)
… 13 more
docker run --rm -v /root/liquibase/changelog:/liquibase/changelog liquibase:4.3.5 --url=“jdbc:mysql://10.x.x.x:3306/dbname” --driver=“com.mysql.cj.jdbc.Driver” --username=“username” --password=‘password’ --defaultSchemaName=performance_schema --changeLogFile=test.xml --logLevel INFO --includeSchema=true --schemas=dbname generateChangeLog
[2021-06-03 06:31:14] INFO [liquibase.diff] changeSets count: 3
[2021-06-03 06:31:14] INFO [liquibase.diff] test.xml does not exist, creating and adding 3 changesets.
docker run --rm -v /root/liquibase/changelog:/liquibase/changelog liquibase:4.3.5 --url=“jdbc:mysql://10.x.x.x:3306/dbname” --driver=“com.mysql.cj.jdbc.Driver” --username=“username” --password=‘password’ --defaultSchemaName=performance_schema --changeLogFile=/liquibase/changelog/test.xml --logLevel INFO --includeSchema=true --schemas=dbname generateChangeLog
[2021-06-03 06:52:48] INFO [liquibase.diff] changeSets count: 0
[2021-06-03 06:52:48] INFO [liquibase.diff] No changesets to add.
I’ll suggest to try out the local copy of file once as I mentioned in one of the replies earlier. Let’s check what exactly are the contents of file.
With your second trial it seems it’s not able to create test.xml because of permission issues. However as you have tried in the first trial, it was able to find atleast some contents to be populated inside resultant changelog file and was able to create a test.xml file when it didn’t exist.
when i tried to not use any path for changelogfile , its success but i cant find the file local nor in the container
eg:
docker run --rm -v /root/liquibase/changelog:/liquibase/changelog liquibase:4.3.5 --url=“jdbc:mysql://10.x.x.x:3306/dbname” --driver=“com.mysql.cj.jdbc.Driver” --username=“username” --password=‘password’ --defaultSchemaName=performance_schema --changeLogFile=.test.xml --logLevel INFO --includeSchema=true --schemas=dbname generateChangeLog
BEST PRACTICE: The changelog generated by diffChangeLog/generateChangeLog should be inspected for correctness and completeness before being deployed.
[2021-06-03 07:14:06] INFO [liquibase.diff] changeSets count: 3
[2021-06-03 07:14:06] INFO [liquibase.diff] .test.xml does not exist, creating and adding 3 changesets.
Liquibase command ‘generateChangeLog’ was executed successfully.
I am facing the same issue, getting “/liquibase/changelog/output.xml (Permission denied)” error, with docker run command.
This is command I am using:
docker run --rm --net=“host” -v /home/administrator/liquibase/changelog:/liquibase/changelog liquibase/liquibase --url=“jdbc:sqlserver://xx.x.x.164:1433;databaseName=liquibasedb;integratedSecurity=false;” --driver=“com.microsoft.sqlserver.jdbc.SQLServerDriver” --changeLogFile=/home/administrator/liquibase/HR/changelog/procedures/changelog.xml --username=“sa” --password=“BxxxxZ” generateChangeLog
Hi @cleanops .
When you use -v /home/administrator/liquibase/changelog:/liquibase/changelog you are mounting the filesystem /home… into /liquibase/changelog inside the container. So when liquibase goes to run, it executes inside the /liquibase folder inside the container.
This means for the changelog file in the container you would reference changelogFile in following way.
./changelog/<path_to_rest_of_directory_structure>
i.e. if I mount /home/administrator/liquibase/HR/changelog/ to /liquibase/changelog
you would find the file in ./changelog/procedures/changelog.xml
or
changeLogFile=./changelog/procedures/changelog.xml
I would also make sure that the user running the docker command has read/write permission to the /home/administrator/liquibase/HR/changelog directory structure.