Postgres database says database exist but I cannot Alter owner - ruby-on-rails

This is my first VPS and first rails project ever.
Inside of postgres console:
postgres=# \list
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------------+----------+----------+-------------+-------------+-----------------------
blog_production | blog | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)
postgres=# ALTER DATABASE blog_development OWNER TO watashi;
ERROR: database "blog_development" does not exist
How can it not exist when it obviously is on the list? How can I drop this database? and if I can it hurt my vps?
Link to site is: www.morningharwood.com
it doesnt error out until www.morningharwood.com/works

Rails can't find the works table, it should have been created as part of your RAILS_ENV=production bundle exec rake db:migrate command, what was the output of that?
Also check that you are running the rails server in production mode.

Related

How to log into the database under the user?

I install postres9 on linux mint 18. I login under default postres user. I try create new user and login under this user.
kalinin#lenovo ~ $ sudo -i -u postgres
postgres#lenovo ~ $ psql
psql (9.5.16)
Type "help" for help.
postgres=# CREATE DATABASE db_test;
CREATE DATABASE
postgres=# CREATE USER user_test WITH PASSWORD 'qwerty';
CREATE ROLE
postgres=#
postgres=#
postgres=# GRANT ALL PRIVILEGES ON DATABASE "db_test" to user_test;
GRANT
postgres=# \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------------------+-----------
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
user_test | | {}
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-------------+----------+----------+-------------+-------------+------------------------
db_test | postgres | UTF8 | ru_RU.UTF-8 | ru_RU.UTF-8 | =Tc/postgres +
| | | | | postgres=CTc/postgres +
| | | | | user_test=CTc/postgres
postgres | postgres | UTF8 | ru_RU.UTF-8 | ru_RU.UTF-8 |
postgres=# \q
postgres#lenovo ~ $ exit
logout
kalinin#lenovo ~ $ sudo -i -u user_test
sudo: unknown user: user_test
sudo: unable to initialize policy plugin
you see what i am creating new user with password and new database. after that i exit from postgres and try login again. But login failed. Please help fix it.

Column1+Column2 on google spreadsheet

I would like to ask on how to do this in google spreadsheet without using script. Apologies for the title, it is my first time posting a question here. Thank you very much :)
Example:
| 1 | A | A-1 |
| 2 | B | A-2 |
| 3 | C | A-3 |
| | | B-1 |
| | | B-2 |
| | | B-3 |
| | | C-1 |
| | | C-2 |
| | | C-3 |
Assuming 1 is in A1, drag down from Row1:
=OFFSET(B$1,INT((ROW()-1)/3),)&"-"&OFFSET(A$1,MOD((ROW()-1),3),)

Cloud Foundry setup become unresponsive after few hours

I have a 5 node Cloud Foundry setup on Azure as part of API provisioning platform.
(3.5GB)3 nodes - Garden container
(1.5GB)1 node - Postgres
(28 GB)1 node - Rest of Cloud Foundry components like cloud controller, haproxy, gorouter, stager, auctioneer etc
boshuser#boshvm:~$ bosh instances --ps
Acting as user 'admin' on deployment 'single-vm-cf-on-azure' on 'bosh'
Director task 184
Task 184 done
+-------------------------------------------------------+---------+-----+----------------------+---------------+
| Instance | State | AZ | VM Type | IPs |
+-------------------------------------------------------+---------+-----+----------------------+---------------+
| cell_api_z1/0 (cf0f2f38-9676-4a25-9716-67255be18006)* | running | n/a | resource_api_z1 | x.x.x.x |
| rep | running | | | |
| consul_agent | running | | | |
| garden | running | | | |
| metron_agent | running | | | |
+-------------------------------------------------------+---------+-----+----------------------+---------------+
| cell_api_z1/1 (4147fa15-98ad-4ba9-a65d-7bd3f0dfafb6) | running | n/a | resource_api_z1 | x.x.x.x |
| rep | running | | | |
| consul_agent | running | | | |
| garden | running | | | |
| metron_agent | running | | | |
+-------------------------------------------------------+---------+-----+----------------------+---------------+
| cell_api_z1/2 (51219434-846c-4edc-a3f7-ad0b28bbc68d) | running | n/a | resource_api_z1 | x.x.x.x |
| rep | running | | | |
| consul_agent | running | | | |
| garden | running | | | |
| metron_agent | running | | | |
+-------------------------------------------------------+---------+-----+----------------------+---------------+
| cf_z1/0 (770622e7-0fbb-407e-904a-cc69f5341cef)* | running | n/a | resource_z1 | x.x.x.x |
| | | | | x.x.x.x |
| consul_agent | running | | | |
| nats | running | | | |
| nats_stream_forwarder | running | | | |
| metron_agent | running | | | |
| etcd | running | | | |
| etcd_metrics_server | running | | | |
| rpc_nfsd | running | | | |
| rpc_mountd | running | | | |
| cloud_controller_ng | running | | | |
| cloud_controller_worker_local_1 | running | | | |
| cloud_controller_worker_local_2 | running | | | |
| nginx_cc | running | | | |
| cloud_controller_worker_1 | running | | | |
| cloud_controller_clock | running | | | |
| nfs_mounter | running | | | |
| route_registrar | running | | | |
| consul_template | running | | | |
| haproxy_config | running | | | |
| haproxy | running | | | |
| doppler | running | | | |
| loggregator_trafficcontroller | running | | | |
| uaa | running | | | |
| gorouter | running | | | |
| statsd-injector | running | | | |
| syslog_drain_binder | running | | | |
| bbs | running | | | |
| auctioneer | running | | | |
| converger | running | | | |
| stager | running | | | |
| nsync_listener | running | | | |
| nsync_bulker | running | | | |
| tps_listener | running | | | |
| tps_watcher | running | | | |
| cc_uploader | running | | | |
| ssh_proxy | running | | | |
| file_server | running | | | |
| route_emitter | running | | | |
+-------------------------------------------------------+---------+-----+----------------------+---------------+
| postgres_z1/0 (40f5d667-81c6-4065-98e5-8e272b17ed7d)* | running | n/a | resource_postgres_z1 | x.x.x.x |
| postgres | running | | | |
| metron_agent | running | | | |
+-------------------------------------------------------+---------+-----+----------------------+---------------+
When I deploy the cloud foundry manifest using BOSH. It gets deployed successfully and everything works fine which it should.
The problem starts after few hours of deployment. The 'cf' commands stop responding and the apps deployed on cloud foundry do not respond when accessed from browser.
As a solution I have to recreate the cloud controller node. The setup works fine for few hours and then fail again.
Earlier the cloud controller node had 8GB RAM. I did some memory usage analysis when the setup became unresponsive. I found that on a 8GB node the memory was getting choked. So I concluded the issue might be happening because of low RAM.
As a solution I updated the cloud controller node from 8GB to 28GB and redeployed the cloud foundry manifest. The setup worked fine and I was able to access the apps from browser.
But again after few hours the 'cf' commands became unresponsive and I was not able to access apps from browser. Out of 28GB only around 8GB is getting used. So there cannot be an issue because of low memory.
Not sure why the setup becomes unresponsive after few hours.
Any help would be very much appreciated.
Thanks

How to not get lost reviewing Gerrit reviews comments?

Hey guys I'm having a problem forgetting to answer gerrit reviews comments. I'm wondering if there is any way to summarize all gerrit comments (from all patch sets with its respective replies). Let me give a example:
Me -> P1
Review1 -> comments 1a, 1b, 1c;
Me -> P2 (without answer any comments)
Me -> P3
Me -> 1a done, 1c done;
Me -> P4
Review1 +1, +2, finished;
How can I see that we forget to address the comment 1b ?
Bye
It's not possible. In Gerrit database, there's no difference between "answered" comments and "not answered" ones.
Take a look at the patch_comments Gerrit table:
+-----------------------+--------------+------+-----+-------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------------+--------------+------+-----+-------------------+-----------------------------+
| line_nbr | int(11) | NO | | 0 | |
| author_id | int(11) | NO | | 0 | |
| written_on | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| status | char(1) | NO | MUL | | |
| side | smallint(6) | NO | | 0 | |
| message | text | YES | | NULL | |
| parent_uuid | varchar(40) | YES | | NULL | |
| change_id | int(11) | NO | PRI | 0 | |
| patch_set_id | int(11) | NO | PRI | 0 | |
| file_name | varchar(255) | NO | PRI | | |
| uuid | varchar(40) | NO | PRI | | |
| range_end_character | int(11) | YES | | NULL | |
| range_end_line | int(11) | YES | | NULL | |
| range_start_character | int(11) | YES | | NULL | |
| range_start_line | int(11) | YES | | NULL | |
+-----------------------+--------------+------+-----+-------------------+-----------------------------+

Why doesn't my Erlang shell load rebar dependencies?

I have a simple project using rebar with this config:
{sub_dirs, [
"gen",
"apps/basilisk_server",
"rel"
"apps/*"
"ebin"
"deps/*/ebin"
]}.
{erl_opts, [debug_info, fail_on_warning]}.
{
deps,
[
{ email_address, ".*", { git, "git://github.com/mswimmer/erlang-email-address.git", "master"}},
{ gen_smtp , ".*", { git, "https://github.com/Vagabond/gen_smtp.git" , "master"}},
{ pat , ".*", { git, "https://github.com/selectel/pat.git" , "master"}},
{ thrift , ".*", { git, "https://github.com/MustyMustelidae/ThriftErl.git", "master"}}
]
}.
My directory structure is:
+---.rebar
+---deps
| +---edown
| | +---.rebar
| | +---bin
| | +---doc
| | +---ebin
| | +---priv
| | | \---scripts
| | +---samples
| | \---src
| +---email_address
| | +---.rebar
| | +---ebin
| | +---src
| | \---test
| +---gen_smtp
| | +---.rebar
| | +---ebin
| | +---src
| | +---test
| | \---testdata
| +---gproc
| | +---.rebar
| | +---doc
| | +---ebin
| | +---include
| | +---patches
| | | +---gen_leader
| | | +---kernel
| | | \---stdlib
| | +---priv
| | +---reference
| | +---src
| | +---test
| | | \---eqc
| | \---tetrapak
| +---lager
| | +---.rebar
| | +---ebin
| | +---include
| | +---src
| | \---test
| +---pat
| | +---.rebar
| | +---ebin
| | +---include
| | \---src
| +---proper
| | +---.rebar
| | +---doc
| | +---ebin
| | +---examples
| | +---include
| | +---src
| | \---test
| +---tempo
| | +---.rebar
| | +---c_src
| | +---doc
| | | \---utf8
| | +---ebin
| | +---src
| | \---test
| \---thrift
| +---.rebar
| +---ebin
| +---include
| +---out
| | \---production
| | \---erl
| +---src
| \---test
+---ebin <--- My .app/.beam
\---src <--- My source files
\---gen <---More source files
(Sorry for the wall)
Each of the dependencies has a .app file in it's ebin folder, and I'm running the command erl -pa apps/*/ebin -pa ebin -pa deps/*/ebin. I expect I should be able to run application:ensure_all_started(somedep). where "somedep" is the name of a dependency with a .app defined in it's ebin folder. But when I run it for any of them I get the error {error,{somedep,{"no such file or directory","somedep.app"}}}. When I run it for my own application I get the correct response ({ok,_}). Because I can't start the dependencies' applications, my own application fails with an undef error. Am I missing some step to register my .app files with the shell?
The Windows command shell doesn't expand the wildcards in apps/*/ebin and deps/*/ebin, so the Erlang load path isn't getting set properly.

Resources