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

Database does not bind to pgServerPort on Windows #11

Open
Tibor17 opened this issue Feb 28, 2018 · 3 comments
Open

Database does not bind to pgServerPort on Windows #11

Tibor17 opened this issue Feb 28, 2018 · 3 comments

Comments

@Tibor17
Copy link

Tibor17 commented Feb 28, 2018

We started the plugin, see POM, via mvn verify.
We also added a proxy to settings.xml.
We are not able to connect to the port 5432 via telnet localhost 5432 on Windows.
On Linux Ubuntu 16 we are able to connect via telnet and PgAdmin too.
We think that the command line is not constructed so well on Windows.

After we found the ZIP in user home, we extracted and started the database on command line with our commands, the database was bound to the port 5432 and telnet connected to it on Windows.
We used these native commands:

set PGDATA=e:\tmp\zmaz\xx\x\target\data\
pg_ctl initdb
pg_ctl start -D e:\tmp\zmaz\xx\x\target\data\ -l logfile

now telnet:
telnet localhost 5432

Stop the database after successful connection
pg_ctl stop -D e:\tmp\zmaz\xx\x\target\data\ -l logfile

Here is our POM:

<plugin>
	<groupId>com.github.slavaz</groupId>
	<artifactId>embedded-postgresql-maven-plugin</artifactId>
	<version>1.2.2</version>
	<configuration>
		<pgServerVersion>9.6</pgServerVersion>
		<dbName>audit</dbName>
	</configuration>
	<executions>
		<execution>
			<id>start-pgsql</id>
			<phase>pre-integration-test</phase>
			<goals>
				<goal>start</goal>
			</goals>
		</execution>
		<execution>
			<id>stop-pgsql</id>
			<phase>post-integration-test</phase>
			<goals>
				<goal>stop</goal>
			</goals>
		</execution>
	</executions>
</plugin>

Here are Maven Debug logs of plugin configuration:

[DEBUG] Goal:          com.github.slavaz:embedded-postgresql-maven-plugin:1.1.0:start (start-pgsql)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <dbName>audit</dbName>
  <password default-value="postgres"/>
  <pgCharset>${pgCharset}</pgCharset>
  <pgDatabaseDir>${pgDatabasedir}</pgDatabaseDir>
  <pgLocale>${pgLocale}</pgLocale>
  <pgServerPort default-value="5432">${pgPort}</pgServerPort>
  <pgServerVersion default-value="latest">9.6</pgServerVersion>
  <pluginDependencies default-value="${plugin.artifacts}"/>
  <projectBuildDir default-value="${project.build.directory}"/>
  <settings default-value="${settings}"/>
  <skipGoal default-value="false"/>
  <userName default-value="postgres">${username}</userName>
</configuration>
@slavaz
Copy link
Owner

slavaz commented Feb 28, 2018

Did you read 'know issues' sections?
https://github.com/yandex-qatools/postgresql-embedded#known-issues
Is it your case?

@Tibor17
Copy link
Author

Tibor17 commented Feb 28, 2018

Thx @slavaz , I think it is my case. I tried to change the owner on Windows folder but no luck.
I did this in plugin config: <pgDatabaseDir>${project.build.directory}/data</pgDatabaseDir>
I launched this command to change owner to postgres:
icacls data /grant:rw postgres:F /T
and then I run the build with mvn verify
Would this make sense and should this solve the issue?

@slavaz
Copy link
Owner

slavaz commented Mar 1, 2018

You need to create new Windows user without admin privileges and try to run 'mvn verify' under the unprivileged user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants