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

Build issues on Linux #16

Closed
davidwatkins73 opened this issue Jun 18, 2020 · 8 comments
Closed

Build issues on Linux #16

davidwatkins73 opened this issue Jun 18, 2020 · 8 comments

Comments

@davidwatkins73
Copy link

I initially tried under Windows 10 but couldn't decide if errors where my fault or actual underlying issues. I''ve therefore switched to first trying the tutorial under Linux. However I cannot get the build to connect to the postgres instance.

I've installed postgres as per the instructions, and populated it using the LoadAll app in waltz-jobs. I can connect to this db on my dev machines Waltz instance (I remapped the port 5432 to 5632 via IntelliJ as the -p 5432:5432 param seemed to have not effect)

image

This works fine when running Waltz's Main and the Waltz's maven build with the appropriate settings, namely:

  <profile>
            <id>local-postgres</id>
            <activation><activeByDefault>false</activeByDefault></activation>
            <properties>
                <database.url>jdbc:postgresql://localhost:5632/waltz</database.url>
                <database.user>waltz</database.user>
                <database.password>waltz</database.password>
                <database.schema>public</database.schema>
                <database.catalog></database.catalog>
            </properties>

Docker

When running the command:

docker build --tag waltz-build:1.26a1 --build-arg maven_profiles=waltz-postgres,local-postgres -f build/build.Dockerfile .

it fails with:

[INFO] waltz .............................................. SUCCESS [ 13.869 s]
[INFO] waltz-common ....................................... SUCCESS [ 12.176 s]
[INFO] waltz-model ........................................ SUCCESS [  9.760 s]
[INFO] waltz-schema ....................................... FAILURE [  2.670 s]
[INFO] waltz-data ......................................... SKIPPED
[INFO] waltz-service ...................................... SKIPPED
[INFO] waltz-web .......................................... SKIPPED
[INFO] waltz-jobs ......................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  38.665 s
[INFO] Finished at: 2020-06-18T15:19:01Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.1:update (default) on project waltz-schema: Error setting up or running Liquibase: liquibase.exception.DatabaseException: org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.: Connection refused (Connection refused) -> [Help 1]

I've tried updating the settings xml with both ports (5432 & 5632) and they both give the same error.

Will continue trying things but thought I'd see if you could spot any obvious errors

@davidwatkins73
Copy link
Author

For the record:

  • Linux Mint 19
  • Docker 19.03.11

@rovats
Copy link
Owner

rovats commented Jun 18, 2020

Ah, localhost won't work from within the docker container.
You'll need to find the IP address of the Postgres container, and use that in the maven profile, like described here:

https://github.com/rovats/waltz-docker/blob/master/database/postgres/README.md#find-ip-address-of-the-postgres-server-to-use-in-maven-settingsxml

@rovats
Copy link
Owner

rovats commented Jun 18, 2020

@davidwatkins73 ^

@rovats
Copy link
Owner

rovats commented Jun 18, 2020

Also mentioned on the main README.md, but happy to update the docs if it isn’t clear:

https://github.com/rovats/waltz-docker#step-1-setup-maven-profiles

@davidwatkins73
Copy link
Author

Thanks @rovats, that seems to have fixed it. Yes, it was my inability to follow instructions.

I don't know much about docker but this seems very complicated. Is there anything we can do on the core Waltz side to simplify - or is this stuff fairly obvious once you understand Docker ?

@rovats
Copy link
Owner

rovats commented Jun 26, 2020

I think once you understand how Docker networking works, this shouldn't be too much of an issue.
https://docs.docker.com/engine/reference/run/#network-settings

There are various ways to access the host machine from a container: setting up your own network, assigning a static IP address to your host machine (in the custom network), or a static IP to your container in the custom network (this is useful since container IP addresses are dynamic - assigned in incremental order at container startup).

Also, there is a special dns name host.docker.internal that can be used to access the host (or 172.0.17.1 might also work):
https://docs.docker.com/docker-for-mac/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host

A few more options listed here:
https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach

Happy to include some more information in the docs to make this clear - Done, let me know if the docs can be improved further.

rovats added a commit that referenced this issue Jun 26, 2020
rovats added a commit that referenced this issue Jun 26, 2020
rovats added a commit that referenced this issue Jun 26, 2020
rovats added a commit that referenced this issue Jun 26, 2020
rovats added a commit that referenced this issue Jun 26, 2020
@rovats
Copy link
Owner

rovats commented Jul 8, 2020

@davidwatkins73 , I have improved the documentation as part of this issue. Are you happy for this to be closed?

@rovats rovats closed this as completed Jul 10, 2020
@davidwatkins73
Copy link
Author

Hi, yes, happy for this to be closed. Thanks!

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