emcniece / DockerYourXyzzy

Dockerized Cards Against Humanity clone - https://github.com/ajanata/PretendYoureXyzzy
71 stars 38 forks source link

Not clear how to add card databases to docker image #7

Open nhendin opened 4 years ago

nhendin commented 4 years ago

I've got the docker image running locally on my server, and when I try to create a game, there are no card sets loaded. How do I set that up? Is there a separate database instance required?

Here is what I see when selecting "Create Game" Notice the card sets are blank.

image

emcniece commented 4 years ago

Not sure unfortunately, but a quick search turns up https://github.com/ajanata/PretendYoureXyzzy/issues/192. Can you add packs at /cardsets.jsp?

nhendin commented 4 years ago

Hmm. I get a access restricted to known hosts error from Apache / Tomcat. Not sure if I have to add my user as an admin, but that may be related to this.

I did check the container logs and found [SQLITE_ERROR] SQL error or missing database (no such table: card_set)

Here is the full log:

neil@zen:/opt/docker$ docker logs 49a56aaadcfb log4j:WARN No appenders could be found for logger (net.socialgamer.cah.StartupUtils). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. 2020-04-12 20:48:16,918 [localhost-startStop-1] INFO net.socialgamer.cah.StartupUtils - Reloading log4j.properties 2020-04-12 20:48:16,919 [localhost-startStop-1] INFO net.socialgamer.cah.StartupUtils - Reloading pyx.properties 2020-04-12 21:00:04,753 [http-bio-8080-exec-6] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.2.0.Final 2020-04-12 21:00:04,759 [http-bio-8080-exec-6] INFO org.hibernate.cfg.Environment - Hibernate 3.6.10.Final 2020-04-12 21:00:04,761 [http-bio-8080-exec-6] INFO org.hibernate.cfg.Environment - hibernate.properties not found 2020-04-12 21:00:04,763 [http-bio-8080-exec-6] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist 2020-04-12 21:00:04,765 [http-bio-8080-exec-6] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling 2020-04-12 21:00:04,811 [http-bio-8080-exec-6] INFO org.hibernate.cfg.Configuration - configuring from resource: /hibernate.cfg.xml 2020-04-12 21:00:04,816 [http-bio-8080-exec-6] INFO org.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml 2020-04-12 21:00:04,861 [http-bio-8080-exec-6] WARN org.hibernate.util.DTDEntityResolver - recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide! 2020-04-12 21:00:04,909 [http-bio-8080-exec-6] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null 2020-04-12 21:00:04,968 [http-bio-8080-exec-6] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: net.socialgamer.cah.db.PyxBlackCard 2020-04-12 21:00:05,022 [http-bio-8080-exec-6] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity net.socialgamer.cah.db.PyxBlackCard on table black_cards 2020-04-12 21:00:05,079 [http-bio-8080-exec-6] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: net.socialgamer.cah.db.PyxWhiteCard 2020-04-12 21:00:05,079 [http-bio-8080-exec-6] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity net.socialgamer.cah.db.PyxWhiteCard on table white_cards 2020-04-12 21:00:05,081 [http-bio-8080-exec-6] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: net.socialgamer.cah.db.PyxCardSet 2020-04-12 21:00:05,085 [http-bio-8080-exec-6] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity net.socialgamer.cah.db.PyxCardSet on table card_set 2020-04-12 21:00:05,149 [http-bio-8080-exec-6] INFO org.hibernate.cfg.Configuration - Hibernate Validator not found: ignoring 2020-04-12 21:00:05,156 [http-bio-8080-exec-6] INFO org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled. 2020-04-12 21:00:05,165 [http-bio-8080-exec-6] INFO org.hibernate.connection.ConnectionProviderFactory - Initializing connection provider: org.hibernate.connection.C3P0ConnectionProvider 2020-04-12 21:00:05,165 [http-bio-8080-exec-6] INFO org.hibernate.connection.C3P0ConnectionProvider - C3P0 using driver: org.sqlite.JDBC at URL: jdbc:sqlite:pyx.sqlite 2020-04-12 21:00:05,165 [http-bio-8080-exec-6] INFO org.hibernate.connection.C3P0ConnectionProvider - Connection properties: {user=pyx, password=} 2020-04-12 21:00:05,165 [http-bio-8080-exec-6] INFO org.hibernate.connection.C3P0ConnectionProvider - autocommit mode: false 2020-04-12 21:00:05,183 [http-bio-8080-exec-6] INFO com.mchange.v2.log.MLog - MLog clients using log4j logging. 2020-04-12 21:00:05,268 [http-bio-8080-exec-6] INFO com.mchange.v2.c3p0.C3P0Registry - Initializing c3p0-0.9.1 [built 16-January-2007 14:46:42; debug? true; trace: 10] 2020-04-12 21:00:05,377 [http-bio-8080-exec-6] INFO com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource - Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@536e3de8 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@9a830d5a [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, debugUnreturnedConnectionStackTraces -> false, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1jfmjura9v4nn4x89j6h0|7fedec3f, idleConnectionTestPeriod -> 10, initialPoolSize -> 5, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 300, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 20, maxStatements -> 50, maxStatementsPerConnection -> 0, minPoolSize -> 5, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@4a3a4a08 [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> 1jfmjura9v4nn4x89j6h0|372126f0, jdbcUrl -> jdbc:sqlite:pyx.sqlite, properties -> {user=**, password=**} ], preferredTestQuery -> null, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false; userOverrides: {} ], dataSourceName -> null, factoryClassLocation -> null, identityToken -> 1jfmjura9v4nn4x89j6h0|69d0ecae, numHelperThreads -> 3 ] 2020-04-12 21:00:05,591 [http-bio-8080-exec-6] INFO org.hibernate.dialect.Dialect - Using dialect: net.socialgamer.cah.hibernate.SqliteDialect 2020-04-12 21:00:05,605 [http-bio-8080-exec-6] INFO org.hibernate.engine.jdbc.JdbcSupportLoader - Disabling contextual LOB creation as JDBC driver reported JDBC version [2] less than 4 2020-04-12 21:00:05,606 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Database -> name : SQLite version : 3.8.7 major : 3 minor : 0 2020-04-12 21:00:05,606 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Driver -> name : SQLiteJDBC version : native major : 1 minor : 1 2020-04-12 21:00:05,608 [http-bio-8080-exec-6] INFO org.hibernate.transaction.TransactionFactoryFactory - Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory 2020-04-12 21:00:05,609 [http-bio-8080-exec-6] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) 2020-04-12 21:00:05,612 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled 2020-04-12 21:00:05,612 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled 2020-04-12 21:00:05,612 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: disabled 2020-04-12 21:00:05,612 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): enabled 2020-04-12 21:00:05,612 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto 2020-04-12 21:00:05,613 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1 2020-04-12 21:00:05,613 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled 2020-04-12 21:00:05,613 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled 2020-04-12 21:00:05,613 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled 2020-04-12 21:00:05,613 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory 2020-04-12 21:00:05,614 [http-bio-8080-exec-6] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory 2020-04-12 21:00:05,614 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {} 2020-04-12 21:00:05,614 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled 2020-04-12 21:00:05,615 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: disabled 2020-04-12 21:00:05,615 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled 2020-04-12 21:00:05,615 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory 2020-04-12 21:00:05,616 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled 2020-04-12 21:00:05,620 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled 2020-04-12 21:00:05,622 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled 2020-04-12 21:00:05,622 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled 2020-04-12 21:00:05,623 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo 2020-04-12 21:00:05,624 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Named query checking : enabled 2020-04-12 21:00:05,624 [http-bio-8080-exec-6] INFO org.hibernate.cfg.SettingsFactory - Check Nullability in Core (should be disabled when Bean Validation is on): enabled 2020-04-12 21:00:05,645 [http-bio-8080-exec-6] INFO org.hibernate.impl.SessionFactoryImpl - building session factory 2020-04-12 21:00:05,653 [http-bio-8080-exec-6] INFO org.hibernate.type.BasicTypeRegistry - Type registration [blob] overrides previous : org.hibernate.type.BlobType@2f8e5e47 2020-04-12 21:00:05,653 [http-bio-8080-exec-6] INFO org.hibernate.type.BasicTypeRegistry - Type registration [java.sql.Blob] overrides previous : org.hibernate.type.BlobType@2f8e5e47 2020-04-12 21:00:05,653 [http-bio-8080-exec-6] INFO org.hibernate.type.BasicTypeRegistry - Type registration [characters_clob] overrides previous : org.hibernate.type.PrimitiveCharacterArrayClobType@1486d436 2020-04-12 21:00:05,653 [http-bio-8080-exec-6] INFO org.hibernate.type.BasicTypeRegistry - Type registration [materialized_blob] overrides previous : org.hibernate.type.MaterializedBlobType@defbaea 2020-04-12 21:00:05,653 [http-bio-8080-exec-6] INFO org.hibernate.type.BasicTypeRegistry - Type registration [wrapper_characters_clob] overrides previous : org.hibernate.type.CharacterArrayClobType@338288ab 2020-04-12 21:00:05,653 [http-bio-8080-exec-6] INFO org.hibernate.type.BasicTypeRegistry - Type registration [wrapper_materialized_blob] overrides previous : org.hibernate.type.WrappedMaterializedBlobType@6ea384fa 2020-04-12 21:00:05,653 [http-bio-8080-exec-6] INFO org.hibernate.type.BasicTypeRegistry - Type registration [materialized_clob] overrides previous : org.hibernate.type.MaterializedClobType@4ca6da7c 2020-04-12 21:00:05,654 [http-bio-8080-exec-6] INFO org.hibernate.type.BasicTypeRegistry - Type registration [clob] overrides previous : org.hibernate.type.ClobType@3cee11e8 2020-04-12 21:00:05,654 [http-bio-8080-exec-6] INFO org.hibernate.type.BasicTypeRegistry - Type registration [java.sql.Clob] overrides previous : org.hibernate.type.ClobType@3cee11e8 2020-04-12 21:00:06,011 [http-bio-8080-exec-6] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured 2020-04-12 21:00:06,266 [http-bio-8080-exec-6] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 1, SQLState: null 2020-04-12 21:00:06,268 [http-bio-8080-exec-6] ERROR org.hibernate.util.JDBCExceptionReporter - [SQLITE_ERROR] SQL error or missing database (no such table: card_set) 2020-04-12 21:05:52,319 [http-bio-8080-exec-6] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 1, SQLState: null 2020-04-12 21:05:52,319 [http-bio-8080-exec-6] ERROR org.hibernate.util.JDBCExceptionReporter - [SQLITE_ERROR] SQL error or missing database (no such table: card_set) 2020-04-12 21:07:20,265 [http-bio-8080-exec-2] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 1, SQLState: null 2020-04-12 21:07:20,266 [http-bio-8080-exec-2] ERROR org.hibernate.util.JDBCExceptionReporter - [SQLITE_ERROR] SQL error or missing database (no such table: card_set) 2020-04-12 21:18:00,456 [http-bio-8080-exec-10] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 1, SQLState: null 2020-04-12 21:18:00,456 [http-bio-8080-exec-10] ERROR org.hibernate.util.JDBCExceptionReporter - [SQLITE_ERROR] SQL error or missing database (no such table: card_set) 2020-04-12 21:19:08,023 [http-bio-8080-exec-4] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 1, SQLState: null 2020-04-12 21:19:08,023 [http-bio-8080-exec-4] ERROR org.hibernate.util.JDBCExceptionReporter - [SQLITE_ERROR] SQL error or missing database (no such table: card_set) 2020-04-12 21:19:21,606 [http-bio-8080-exec-6] INFO net.socialgamer.cah.data.ConnectedUsers - New user Rose from 199.201.185.1 (admin=false, id=) 2020-04-12 21:19:21,608 [http-bio-8080-exec-6] INFO net.socialgamer.cah.metrics.GeoIP - Attempting to create GeoIP database reader 2020-04-12 21:19:39,378 [http-bio-8080-exec-6] INFO net.socialgamer.cah.data.Game - Rose joined game 0. 2020-04-12 21:19:39,379 [http-bio-8080-exec-6] INFO net.socialgamer.cah.data.GameManager - Created new game 0 by user Rose. 2020-04-12 21:28:07,473 [timer-task-1] INFO net.socialgamer.cah.data.Game - Removing Rose from game 0. 2020-04-12 21:28:07,473 [timer-task-1] INFO net.socialgamer.cah.data.GameManager - Destroyed game 0. 2020-04-12 21:28:07,473 [timer-task-1] INFO net.socialgamer.cah.data.Game - Removing spectator Rose from game 0. 2020-04-12 21:28:07,473 [timer-task-1] INFO net.socialgamer.cah.data.ConnectedUsers - Automatically kicking user Rose due to pt 2020-04-13 02:01:21,452 [http-bio-8080-exec-8] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 1, SQLState: null 2020-04-13 02:01:21,453 [http-bio-8080-exec-8] ERROR org.hibernate.util.JDBCExceptionReporter - [SQLITE

nhendin commented 4 years ago

There is this file that seems to initialize the database, but perhaps it's not getting loaded? https://github.com/ajanata/PretendYoureXyzzy/blob/master/cah_cards.sql

nhendin commented 4 years ago

Ah, I came in from an address that would let me visit carsets.jsp. I had to be on the server as 127.0.0.1 is allowed as administrator source so I used an ssh proxy to login to the server, and got a different error, pointing to the same root cause:

java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (no such table: card_set) org.sqlite.core.DB.newSQLException(DB.java:890) org.sqlite.core.DB.newSQLException(DB.java:901) org.sqlite.core.DB.throwex(DB.java:868) org.sqlite.core.NativeDB.prepare(Native Method) org.sqlite.core.DB.prepare(DB.java:211)...... It seems the database schema is not being set up in the SQLite database.
joncamfield commented 4 years ago

Is there a functional way to set build.properties / admin IP via Docker environment variables?

emcniece commented 4 years ago

@joncamfield not that I'm aware of at the moment. Some ideas come to mind: it could be templated with something like Jinja2 at Docker image build-time, or the entire original build.properties could be ${env.VAR_NAME} parameterized.

I'm not sure if these ideas are better suited for this containerization or for the upstream project. Probably here, since upstream doesn't define environment at all.

https://stackoverflow.com/questions/25862071/accessing-os-environment-variables-from-jinja2-template - we could define an env prefix like BP_ and loop through everything.