Skip to content

Instantly share code, notes, and snippets.

@psturc
Created July 20, 2018 14:01
Show Gist options
  • Save psturc/46233e2a3a696ed5771be13fb786ee11 to your computer and use it in GitHub Desktop.
Save psturc/46233e2a3a696ed5771be13fb786ee11 to your computer and use it in GitHub Desktop.
λ ~/work/aerogear/data-sync-server/ postgres-datasource* npm run db:init:memeo:postgres
> data-sync-server@1.0.0 db:init:memeo:postgres /Users/psturc/work/aerogear/data-sync-server
> FORCE_DROP=true node ./scripts/sync_models && sequelize db:seed --seed memeolist-example-postgres.js && docker exec aerogeardatasyncserver_postgres_memeo_1 psql -U postgres -d memeolist_db -f /tmp/examples/memeolist.tables.sql
{"level":30,"time":1532095119016,"msg":"Using default schemaListener since SCHEMA_LISTENER_CONFIG environment variable is not defined","pid":38687,"hostname":"Pavels-MacBook-Pro.local","v":1}
{"level":30,"time":1532095119548,"msg":"Executing (default): DROP TABLE IF EXISTS \"Resolvers\" CASCADE;","pid":38687,"hostname":"Pavels-MacBook-Pro.local","v":1}
{"level":30,"time":1532095119551,"msg":"Executing (default): DROP TABLE IF EXISTS \"GraphQLSchemas\" CASCADE;","pid":38687,"hostname":"Pavels-MacBook-Pro.local","v":1}
{"level":30,"time":1532095119553,"msg":"Executing (default): DROP TABLE IF EXISTS \"DataSources\" CASCADE;","pid":38687,"hostname":"Pavels-MacBook-Pro.local","v":1}
{"level":30,"time":1532095119554,"msg":"Executing (default): DROP TYPE IF EXISTS \"public\".\"enum_DataSources_type\";","pid":38687,"hostname":"Pavels-MacBook-Pro.local","v":1}
{"level":30,"time":1532095119557,"msg":"Executing (default): DROP TABLE IF EXISTS \"DataSources\" CASCADE;","pid":38687,"hostname":"Pavels-MacBook-Pro.local","v":1}
{"level":30,"time":1532095119558,"msg":"Executing (default): DROP TYPE IF EXISTS \"public\".\"enum_DataSources_type\";","pid":38687,"hostname":"Pavels-MacBook-Pro.local","v":1}
{"level":30,"time":1532095119560,"msg":"Executing (default): SELECT t.typname enum_name, array_agg(e.enumlabel ORDER BY enumsortorder) enum_value FROM pg_type t JOIN pg_enum e ON t.oid = e.enumtypid JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace WHERE n.nspname = 'public' AND t.typname='enum_DataSources_type' GROUP BY 1","pid":38687,"hostname":"Pavels-MacBook-Pro.local","v":1}
{"level":30,"time":1532095119565,"msg":"Executing (default): DROP TYPE IF EXISTS \"public\".\"enum_DataSources_type\"; CREATE TYPE \"public\".\"enum_DataSources_type\" AS ENUM('InMemory', 'Postgres');","pid":38687,"hostname":"Pavels-MacBook-Pro.local","v":1}
{"level":30,"time":1532095119576,"msg":"Executing (default): SELECT typname, typtype, oid, typarray FROM pg_type WHERE (typtype = 'b' AND typname IN ('hstore', 'geometry', 'geography')) OR (typtype = 'e')","pid":38687,"hostname":"Pavels-MacBook-Pro.local","v":1}
{"level":30,"time":1532095119579,"msg":"Executing (default): CREATE TABLE IF NOT EXISTS \"DataSources\" (\"id\" SERIAL , \"name\" VARCHAR(255), \"type\" \"public\".\"enum_DataSources_type\", \"config\" JSON, \"createdAt\" TIMESTAMP WITH TIME ZONE NOT NULL, \"updatedAt\" TIMESTAMP WITH TIME ZONE NOT NULL, PRIMARY KEY (\"id\"));","pid":38687,"hostname":"Pavels-MacBook-Pro.local","v":1}
{"level":30,"time":1532095119595,"msg":"Executing (default): SELECT i.relname AS name, ix.indisprimary AS primary, ix.indisunique AS unique, ix.indkey AS indkey, array_agg(a.attnum) as column_indexes, array_agg(a.attname) AS column_names, pg_get_indexdef(ix.indexrelid) AS definition FROM pg_class t, pg_class i, pg_index ix, pg_attribute a WHERE t.oid = ix.indrelid AND i.oid = ix.indexrelid AND a.attrelid = t.oid AND t.relkind = 'r' and t.relname = 'DataSources' GROUP BY i.relname, ix.indexrelid, ix.indisprimary, ix.indisunique, ix.indkey ORDER BY i.relname;","pid":38687,"hostname":"Pavels-MacBook-Pro.local","v":1}
{"level":30,"time":1532095119609,"msg":"Executing (default): DROP TABLE IF EXISTS \"GraphQLSchemas\" CASCADE;","pid":38687,"hostname":"Pavels-MacBook-Pro.local","v":1}
{"level":30,"time":1532095119612,"msg":"Executing (default): CREATE TABLE IF NOT EXISTS \"GraphQLSchemas\" (\"id\" SERIAL , \"name\" VARCHAR(255), \"schema\" TEXT, \"createdAt\" TIMESTAMP WITH TIME ZONE NOT NULL, \"updatedAt\" TIMESTAMP WITH TIME ZONE NOT NULL, PRIMARY KEY (\"id\"));","pid":38687,"hostname":"Pavels-MacBook-Pro.local","v":1}
{"level":30,"time":1532095119715,"msg":"Executing (default): SELECT i.relname AS name, ix.indisprimary AS primary, ix.indisunique AS unique, ix.indkey AS indkey, array_agg(a.attnum) as column_indexes, array_agg(a.attname) AS column_names, pg_get_indexdef(ix.indexrelid) AS definition FROM pg_class t, pg_class i, pg_index ix, pg_attribute a WHERE t.oid = ix.indrelid AND i.oid = ix.indexrelid AND a.attrelid = t.oid AND t.relkind = 'r' and t.relname = 'GraphQLSchemas' GROUP BY i.relname, ix.indexrelid, ix.indisprimary, ix.indisunique, ix.indkey ORDER BY i.relname;","pid":38687,"hostname":"Pavels-MacBook-Pro.local","v":1}
{"level":30,"time":1532095119725,"msg":"Executing (default): DROP TABLE IF EXISTS \"Resolvers\" CASCADE;","pid":38687,"hostname":"Pavels-MacBook-Pro.local","v":1}
{"level":30,"time":1532095119729,"msg":"Executing (default): CREATE TABLE IF NOT EXISTS \"Resolvers\" (\"id\" SERIAL , \"type\" VARCHAR(255), \"field\" VARCHAR(255), \"requestMapping\" TEXT, \"responseMapping\" TEXT, \"createdAt\" TIMESTAMP WITH TIME ZONE NOT NULL, \"updatedAt\" TIMESTAMP WITH TIME ZONE NOT NULL, \"DataSourceId\" INTEGER REFERENCES \"DataSources\" (\"id\") ON DELETE SET NULL ON UPDATE CASCADE, \"GraphQLSchemaId\" INTEGER NOT NULL REFERENCES \"GraphQLSchemas\" (\"id\") ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (\"id\"));","pid":38687,"hostname":"Pavels-MacBook-Pro.local","v":1}
{"level":30,"time":1532095119756,"msg":"Executing (default): SELECT i.relname AS name, ix.indisprimary AS primary, ix.indisunique AS unique, ix.indkey AS indkey, array_agg(a.attnum) as column_indexes, array_agg(a.attname) AS column_names, pg_get_indexdef(ix.indexrelid) AS definition FROM pg_class t, pg_class i, pg_index ix, pg_attribute a WHERE t.oid = ix.indrelid AND i.oid = ix.indexrelid AND a.attrelid = t.oid AND t.relkind = 'r' and t.relname = 'Resolvers' GROUP BY i.relname, ix.indexrelid, ix.indisprimary, ix.indisunique, ix.indkey ORDER BY i.relname;","pid":38687,"hostname":"Pavels-MacBook-Pro.local","v":1}
sequelize done
Sequelize CLI [Node: 8.11.2, CLI: 4.0.0, ORM: 4.38.0]
{"level":30,"time":1532095120691,"msg":"Using default schemaListener since SCHEMA_LISTENER_CONFIG environment variable is not defined","pid":38689,"hostname":"Pavels-MacBook-Pro.local","v":1}
Loaded configuration file "sequelize/config/database.js".
Using environment "development".
sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators node_modules/sequelize/lib/sequelize.js:242:13
== memeolist-example-postgres: migrating =======
== memeolist-example-postgres: migrated (0.049s)
Error: No such container: aerogeardatasyncserver_postgres_memeo_1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! data-sync-server@1.0.0 db:init:memeo:postgres: `FORCE_DROP=true node ./scripts/sync_models && sequelize db:seed --seed memeolist-example-postgres.js && docker exec aerogeardatasyncserver_postgres_memeo_1 psql -U postgres -d memeolist_db -f /tmp/examples/memeolist.tables.sql`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the data-sync-server@1.0.0 db:init:memeo:postgres script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/psturc/.npm/_logs/2018-07-20T13_58_41_118Z-debug.log
λ ~/work/aerogear/data-sync-server/ postgres-datasource* docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
eb8483f7bac2 c738b744c693 "entrypoint.sh /bin/…" 8 days ago Created loving_fermat
8a359b1cd4e5 437e2e64bcca "entrypoint.sh /bin/…" 8 days ago Created distracted_bartik
λ ~/work/aerogear/data-sync-server/ postgres-datasource* docker-compose up
Creating data-sync-server_postgres_1 ... done
Creating data-sync-server_postgres_memeo_1 ... done
Attaching to data-sync-server_postgres_1, data-sync-server_postgres_memeo_1
postgres_1 | The files belonging to this database system will be owned by user "postgres".
postgres_1 | This user must also own the server process.
postgres_1 |
postgres_1 | The database cluster will be initialized with locale "en_US.utf8".
postgres_1 | The default database encoding has accordingly been set to "UTF8".
postgres_1 | The default text search configuration will be set to "english".
postgres_1 |
postgres_1 | Data page checksums are disabled.
postgres_1 |
postgres_1 | fixing permissions on existing directory /var/lib/postgresql/data ... ok
postgres_1 | creating subdirectories ... ok
postgres_1 | selecting default max_connections ... 100
postgres_1 | selecting default shared_buffers ... 128MB
postgres_1 | selecting dynamic shared memory implementation ... posix
postgres_memeo_1 | The files belonging to this database system will be owned by user "postgres".
postgres_memeo_1 | This user must also own the server process.
postgres_memeo_1 |
postgres_memeo_1 | The database cluster will be initialized with locale "en_US.utf8".
postgres_memeo_1 | The default database encoding has accordingly been set to "UTF8".
postgres_memeo_1 | The default text search configuration will be set to "english".
postgres_memeo_1 |
postgres_memeo_1 | Data page checksums are disabled.
postgres_memeo_1 |
postgres_memeo_1 | fixing permissions on existing directory /var/lib/postgresql/data ... ok
postgres_memeo_1 | creating subdirectories ... ok
postgres_memeo_1 | selecting default max_connections ... 100
postgres_memeo_1 | selecting default shared_buffers ... 128MB
postgres_memeo_1 | selecting dynamic shared memory implementation ... posix
postgres_1 | creating configuration files ... ok
postgres_memeo_1 | creating configuration files ... ok
postgres_1 | running bootstrap script ... ok
postgres_memeo_1 | running bootstrap script ... ok
postgres_1 | performing post-bootstrap initialization ... ok
postgres_memeo_1 | performing post-bootstrap initialization ... ok
postgres_1 | syncing data to disk ...
postgres_1 | WARNING: enabling "trust" authentication for local connections
postgres_1 | You can change this by editing pg_hba.conf or using the option -A, or
postgres_1 | --auth-local and --auth-host, the next time you run initdb.
postgres_1 | ok
postgres_1 |
postgres_1 | Success. You can now start the database server using:
postgres_1 |
postgres_1 | pg_ctl -D /var/lib/postgresql/data -l logfile start
postgres_1 |
postgres_memeo_1 | syncing data to disk ... ok
postgres_memeo_1 |
postgres_memeo_1 | Success. You can now start the database server using:
postgres_memeo_1 |
postgres_memeo_1 | pg_ctl -D /var/lib/postgresql/data -l logfile start
postgres_memeo_1 |
postgres_memeo_1 |
postgres_memeo_1 | WARNING: enabling "trust" authentication for local connections
postgres_memeo_1 | You can change this by editing pg_hba.conf or using the option -A, or
postgres_memeo_1 | --auth-local and --auth-host, the next time you run initdb.
postgres_1 | waiting for server to start....LOG: database system was shut down at 2018-07-20 13:58:14 UTC
postgres_1 | LOG: MultiXact member wraparound protections are now enabled
postgres_1 | LOG: autovacuum launcher started
postgres_memeo_1 | waiting for server to start....LOG: database system was shut down at 2018-07-20 13:58:14 UTC
postgres_1 | LOG: database system is ready to accept connections
postgres_memeo_1 | LOG: MultiXact member wraparound protections are now enabled
postgres_memeo_1 | LOG: autovacuum launcher started
postgres_memeo_1 | LOG: database system is ready to accept connections
postgres_1 | done
postgres_1 | server started
postgres_memeo_1 | done
postgres_memeo_1 | server started
postgres_memeo_1 | CREATE DATABASE
postgres_1 | CREATE DATABASE
postgres_memeo_1 |
postgres_1 |
postgres_1 | CREATE ROLE
postgres_1 |
postgres_1 |
postgres_1 | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
postgres_1 |
postgres_1 | waiting for server to shut down....LOG: received fast shutdown request
postgres_1 | LOG: aborting any active transactions
postgres_1 | LOG: autovacuum launcher shutting down
postgres_memeo_1 | CREATE ROLE
postgres_1 | LOG: shutting down
postgres_memeo_1 |
postgres_memeo_1 |
postgres_memeo_1 | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
postgres_memeo_1 |
postgres_memeo_1 | LOG: received fast shutdown request
postgres_memeo_1 | LOG: aborting any active transactions
postgres_memeo_1 | waiting for server to shut down....LOG: autovacuum launcher shutting down
postgres_memeo_1 | LOG: shutting down
postgres_1 | LOG: database system is shut down
postgres_memeo_1 | LOG: database system is shut down
postgres_1 | done
postgres_1 | server stopped
postgres_1 |
postgres_1 | PostgreSQL init process complete; ready for start up.
postgres_1 |
postgres_memeo_1 | done
postgres_memeo_1 | server stopped
postgres_1 | LOG: database system was shut down at 2018-07-20 13:58:17 UTC
postgres_memeo_1 |
postgres_memeo_1 | PostgreSQL init process complete; ready for start up.
postgres_memeo_1 |
postgres_1 | LOG: MultiXact member wraparound protections are now enabled
postgres_1 | LOG: database system is ready to accept connections
postgres_1 | LOG: autovacuum launcher started
postgres_memeo_1 | LOG: database system was shut down at 2018-07-20 13:58:17 UTC
postgres_memeo_1 | LOG: MultiXact member wraparound protections are now enabled
postgres_memeo_1 | LOG: database system is ready to accept connections
postgres_memeo_1 | LOG: autovacuum launcher started
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment