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

Postgres error when running as root #3

Closed
groundswel opened this issue May 7, 2020 · 7 comments
Closed

Postgres error when running as root #3

groundswel opened this issue May 7, 2020 · 7 comments
Labels
fix coming A fix for this issue is being tested, and will be available in the next release.

Comments

@groundswel
Copy link

groundswel commented May 7, 2020

I am getting the following error. Running on macOS .

Can you please prescribe the java / python version needed to run this?

bash-3.2# anvil-app-server --app MyTodoList
Found Anvil App Server JAR in package directory
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.bouncycastle.jcajce.provider.drbg.DRBG (file:/usr/local/lib/python2.7/site-packages/anvil_app_server/anvil-app-server.20200506-125042.jar) to constructor sun.security.provider.Sun()
WARNING: Please consider reporting this to the maintainers of org.bouncycastle.jcajce.provider.drbg.DRBG
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
ERROR - #error {
 :cause Process [.anvil-data/db-bin/PG-2c0c4f55a015ab253337e3d05ca5fd21/bin/initdb, -A, trust, -U, postgres, -D, .anvil-data/db, -E, UTF-8] failed
 :via
 [{:type java.lang.IllegalStateException
   :message Process [.anvil-data/db-bin/PG-2c0c4f55a015ab253337e3d05ca5fd21/bin/initdb, -A, trust, -U, postgres, -D, .anvil-data/db, -E, UTF-8] failed
   :at [io.zonky.test.db.postgres.embedded.EmbeddedPostgres system EmbeddedPostgres.java 631]}]
 :trace
 [[io.zonky.test.db.postgres.embedded.EmbeddedPostgres system EmbeddedPostgres.java 631]
  [io.zonky.test.db.postgres.embedded.EmbeddedPostgres initdb EmbeddedPostgres.java 249]
  [io.zonky.test.db.postgres.embedded.EmbeddedPostgres <init> EmbeddedPostgres.java 156]
  [io.zonky.test.db.postgres.embedded.EmbeddedPostgres$Builder start EmbeddedPostgres.java 584]
  [anvil.app_server.postgres$launch_bundled_db_BANG_ invokeStatic postgres.clj 70]
  [anvil.app_server.postgres$launch_bundled_db_BANG_ invoke postgres.clj 20]
  [anvil.app_server.run$_main$fn__1692 invoke run.clj 373]
  [clojure.lang.AFn applyToHelper AFn.java 154]
  [clojure.lang.AFn applyTo AFn.java 144]
  [clojure.core$apply invokeStatic core.clj 659]
  [clojure.core$update_in$up__6562 invoke core.clj 6105]
  [clojure.core$update_in invokeStatic core.clj 6106]
  [clojure.core$update_in doInvoke core.clj 6092]
  [clojure.lang.RestFn invoke RestFn.java 445]
  [anvil.app_server.run$_main invokeStatic run.clj 373]
  [anvil.app_server.run$_main doInvoke run.clj 220]
  [clojure.lang.RestFn applyTo RestFn.java 137]
  [anvil.app_server.run main nil -1]]}

bash-3.2# java -version
java version "14.0.1" 2020-04-14
Java(TM) SE Runtime Environment (build 14.0.1+7)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)
@daviesian
Copy link
Contributor

It looks like there are a couple of things going on there. Firstly, you should be fine with that version of Java, but we have tested most heavily with Java 8, so you might like to try that to get rid of the Illegal reflective access operation warnings.

The second problem seems to be with running the embedded PostgreSQL server. We include binaries for most common systems, but there are inevitably environments that we haven't come across before. Are you running this as root or a regular user?

@groundswel
Copy link
Author

Yes, I am running it as root.

@Stevenlimo
Copy link

I have similar error, no idea how to solve it:

(venv2) root@mysite:~/venv2# anvil-app-server --app MyApp

Found Anvil App Server JAR in package directory
ERROR - #error {
:cause Process [.anvil-data/db-bin/PG-a8263178df5b3591feca6b619939c2bb/bin/initdb, -A, trust, -U, postgres, -D, .anvil-data/db, -E, UTF-8] failed
:via
[{:type java.lang.IllegalStateException
:message Process [.anvil-data/db-bin/PG-a8263178df5b3591feca6b619939c2bb/bin/initdb, -A, trust, -U, postgres, -D, .anvil-data/db, -E, UTF-8] failed
:at [io.zonky.test.db.postgres.embedded.EmbeddedPostgres system EmbeddedPostgres.java 631]}]
:trace
[[io.zonky.test.db.postgres.embedded.EmbeddedPostgres system EmbeddedPostgres.java 631]
[io.zonky.test.db.postgres.embedded.EmbeddedPostgres initdb EmbeddedPostgres.java 249]
[io.zonky.test.db.postgres.embedded.EmbeddedPostgres EmbeddedPostgres.java 156]
[io.zonky.test.db.postgres.embedded.EmbeddedPostgres$Builder start EmbeddedPostgres.java 584]
[anvil.app_server.postgres$launch_bundled_db_BANG_ invokeStatic postgres.clj 70]
[anvil.app_server.postgres$launch_bundled_db_BANG_ invoke postgres.clj 20]
[anvil.app_server.run$_main$fn__1692 invoke run.clj 373]
[clojure.lang.AFn applyToHelper AFn.java 154]
[clojure.lang.AFn applyTo AFn.java 144]
[clojure.core$apply invokeStatic core.clj 659]
[clojure.core$update_in$up__6562 invoke core.clj 6105]
[clojure.core$update_in invokeStatic core.clj 6106]
[clojure.core$update_in doInvoke core.clj 6092]
[clojure.lang.RestFn invoke RestFn.java 445]
[anvil.app_server.run$_main invokeStatic run.clj 373]
[anvil.app_server.run$_main doInvoke run.clj 220]
[clojure.lang.RestFn applyTo RestFn.java 137]
[anvil.app_server.run main nil -1]]}

(venv2) root@mysite:~/venv2# java -version
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-2ubuntu218.04)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-2ubuntu218.04, mixed mode, sharing)

@meredydd
Copy link
Collaborator

meredydd commented May 7, 2020

The answer is: Don't run the App Server as root! The Postgres database will refuse to run as root, so you'll need to create a user account, su to it, and run it there.

Thanks for the reports -- the next release of the App Server will have a more helpful error message to tell you this :)

@meredydd meredydd added the fix coming A fix for this issue is being tested, and will be available in the next release. label May 7, 2020
@groundswel
Copy link
Author

Thank you! that worked ... However I noticed another error that also that will probably require root permissions:

[ERROR anvil.app-server.run] Failed to start mail server on port 25 - this application will not be able to receive email: java.net.BindException: Permission denied (Bind failed)

@Stevenlimo
Copy link

Thank you Meredydd, it works nicely.

@meredydd
Copy link
Collaborator

meredydd commented May 7, 2020 via email

@meredydd meredydd changed the title Getting strange error Postgres error when running as root May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix coming A fix for this issue is being tested, and will be available in the next release.
Projects
None yet
Development

No branches or pull requests

4 participants