gratipay / inside.gratipay.com

Here lieth a pioneer in open source sustainability. RIP
https://gratipay.news/the-end-cbfba8f50981
58 stars 38 forks source link

onboard @kzisme #253

Closed chadwhitacre closed 8 years ago

chadwhitacre commented 9 years ago

Got a first PR from @kzisme at https://github.com/gratipay/gratipay.com/pull/3559.

@kzisme Here's a ticket to help you get onboarded. Any random questions you have about contributing to Gratipay, feel free to ask them here. How can we help you contribute more?

chadwhitacre commented 9 years ago

Seems like you're off and running, @kzisme. Welcome aboard! :-)

chadwhitacre commented 8 years ago

Reopening to help @kzisme get a PR under his belt.

Waddya say, @kzisme? Can you remind me: do you have Gratipay.com installed locally? That's the first step ...

kzisme commented 8 years ago

@whit537 So any tasks you would like me to look at?

I'm on winter break now as well, so I can put some more time towards this (depends on work schedule)

I do not currently on my Mac - I'll try to do that now.

kzisme commented 8 years ago

@whit537 Currently cloning the repo - and installed progresql with brew

chadwhitacre commented 8 years ago

I'm on winter break now as well, so I can put some more time towards this (depends on work schedule)

Awesome!

I do not currently on my Mac - I'll try to do that now.

Cool. Ping here if you get stuck.

So any tasks you would like me to look at?

There are a few tickets about inefficiencies in the admin experience on the site ... low priority overall but fairly straightforward, and maybe a low-pressure place to start. Wanna pick one of these?

https://github.com/gratipay/gratipay.com/issues/3879 https://github.com/gratipay/gratipay.com/issues/3845 https://github.com/gratipay/gratipay.com/issues/3548 https://github.com/gratipay/gratipay.com/issues/3121

chadwhitacre commented 8 years ago

Currently cloning the repo - and installed progresql with brew

Cool. If you find any snags with brew-installed postgres let's make sure we note them in the README if needed, m'kay?

Signing off for tonight ...

!m @kzisme :dancer:

kzisme commented 8 years ago

Currently - I cloned the repo, created a virtualenv, and installed postgres without a hitch.

Although I'm currently getting this error when following the local quick start.

[kevinzita@Godric~/projects/gratipay.com$] sudo -u postgres createuser --superuser $USER
sudo: unknown user: postgres
[kevinzita@Godric~/projects/gratipay.com$] sudo postgres createuser --superuser $USER
"root" execution of the PostgreSQL server is not permitted.
The server must be started under an unprivileged user ID to prevent
possible system security compromise.  See the documentation for
more information on how to properly start the server.
[kevinzita@Godric~/projects/gratipay.com$] 

So I suppose after this step I have to run createdb gratipay and then fill the db with fake data based on the schema.

First time messing with postgresql

As for the issues - I'll take a look and probably look more after I get my local Gratipay up and running

chadwhitacre commented 8 years ago

Okay ... you need to figure out how brew-installed Postgres sets up permissions and user accounts, and then either adapt the README instructions to whatever your Postgres is already configured for, or modify your Postgres permissions to conform to what the README expects. Does that give you enough to go on?

kzisme commented 8 years ago

Hopefully I'll take a look when I get off work this evening. I was just following the quick start guide last night

kzisme commented 8 years ago

@whit537 brew installed 9.4.5 postgres. Which instructions are you referring to? I'm looking at the "Local Database Setup" area in README.

So, currently I'm confused and stuck since I'm not sure which permissions are expected.

rohitpaulk commented 8 years ago

@kzisme - What happens when you run just postgres createuser --superuser $USER without sudo?

Hop on IRC if you're free and we'll try to get this sorted out together :)

rohitpaulk commented 8 years ago

From http://exponential.io/blog/2015/02/21/install-postgresql-on-mac-os-x-via-brew/, it looks like brew creates a user by default using the logged in user's name (kevinzita, in your case), so you might be able to skip the createuser step..

kzisme commented 8 years ago

I'll check tomorrow! I work until 3pm then I'll try again. What channels do you frequent?

I appreciate the help! On Dec 20, 2015 1:20 AM, "Paul Kuruvilla" notifications@github.com wrote:

@kzisme https://github.com/kzisme - What happens when you run just postgres createuser --superuser $USER without sudo?

Hop on IRC if you're free and we'll try to get this sorted out together :)

— Reply to this email directly or view it on GitHub https://github.com/gratipay/inside.gratipay.com/issues/253#issuecomment-166069921 .

rohitpaulk commented 8 years ago

What channels do you frequent?

Just #gratipay :)

kzisme commented 8 years ago

Alright! I'll be in there tomorrow afternoon. On Dec 20, 2015 1:26 AM, "Kevin Zita" bleedgreenandgold@gmail.com wrote:

I'll check tomorrow! I work until 3pm then I'll try again. What channels do you frequent?

I appreciate the help! On Dec 20, 2015 1:20 AM, "Paul Kuruvilla" notifications@github.com wrote:

@kzisme https://github.com/kzisme - What happens when you run just postgres createuser --superuser $USER without sudo?

Hop on IRC if you're free and we'll try to get this sorted out together :)

— Reply to this email directly or view it on GitHub https://github.com/gratipay/inside.gratipay.com/issues/253#issuecomment-166069921 .

kzisme commented 8 years ago

@rohitpaulk I'm online now!

kzisme commented 8 years ago

Also running postgres createuser --superuser $USER

returns

postgres: invalid argument: "createuser"

rohitpaulk commented 8 years ago

@kzisme - Try just createuser --superuser $USER (without the postgres)?

kzisme commented 8 years ago
 createuser: could not connect to database postgres: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
kzisme commented 8 years ago
The files belonging to this database system will be owned by user "kevinzita".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

initdb: directory "/usr/local/var/postgres" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/usr/local/var/postgres" or run initdb
with an argument other than "/usr/local/var/postgres".
kzisme commented 8 years ago
screen shot 2015-12-20 at 16 27 31

Success! !m @rohitpaulk and @whit537 for hanging in there through my questions!

rohitpaulk commented 8 years ago

Aha, we're close

rohitpaulk commented 8 years ago

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

rohitpaulk commented 8 years ago

Perfect :)

kzisme commented 8 years ago

After running the provided commands - make test and make run worked.

Any other tips about stopping the service or general things I might run into @rohitpaulk?

I gotta run some errands ,but I'll look at it soon.

chadwhitacre commented 8 years ago

Nice! :dancer:

!m @kzisme @rohitpaulk

kzisme commented 8 years ago

@whit537 Should I have (or do I have to) request access to fresh desk?

Also does #3548 and #3879 relate to each other? (Does one fix work for both possibly?) Just trying to find a starting point

and some more initial questions!

How do I go about viewing the described actions in each issue (for instance - how do I access the admin panel within my local Gratipay account).
...(may think of more while I'm poking around)

rohitpaulk commented 8 years ago

how do I access the admin panel within my local Gratipay account

Set is_admin on your local user to true. You can do this by running a SQL query via the postgres console ($ psql -d gratipay). Does that help?

kzisme commented 8 years ago

Alright just going to update with some progress - Postgres seems super cool BUT it's the first cli db system I've used (My db design course used MSSQL)

[kevinzita@Godric~/projects/gratipay.com$] psql -d gratipay
psql (9.4.5)
Type "help" for help.

gratipay=# SELECT table_name
gratipay-#   FROM information_schema.tables
gratipay-#  WHERE table_schema='public'
gratipay-#    AND table_type='BASE TABLE';
      table_name      
----------------------
 elsewhere
 tips
 exchange_routes
 transfers
 exchanges
 absorptions
 paydays
 communities
 community_members
 statements
 takes
 events
 emails
 email_queue
 balances_at
 participants
 payroll
 payments
 payment_instructions
 teams
(20 rows)

Alright - so it appears I have to add my local user after querying the participants table.

Currently looking for a way to get Postgres to properly align everything after I submit a query... Using \x auto formats wrapped lines nicely if it doesn't do it automatically.

Also worth noting that...

\list or \l: list all databases
\dt: list all tables in the current database

So I am currently signed in via Github (locally), but I am not listed as a participant - must I add myself via Postgres Query - or since I signed in will (or should I have been added)

mattbk commented 8 years ago

If you signed in with Github, you should be in the participants table. Wish I could help with Postgres, but I downloaded a GUI (Mac) to help visualize the database.

kzisme commented 8 years ago

@mattbk Which GUI Client did you (or do you) use?

rohitpaulk commented 8 years ago

@kzisme - I've used http://www.sequelpro.com/ on the Mac

mattbk commented 8 years ago

I use https://eggerapps.at/postico/ for the little that I do in the db.

kzisme commented 8 years ago

@rohitpaulk Are you able to hop on IRC for a bit?

kzisme commented 8 years ago

Update:

So - I tried Sequelpro - looked into it further and it seems that it's only meant for MySQL.

Took another crack at the cli console and found my username by doing the following:

gratipay=# SELECT * FROM participants WHERE username = kzisme;
ERROR:  column "kzisme" does not exist
LINE 1: SELECT * FROM participants WHERE username = kzisme;
                                                    ^
gratipay=# SELECT * FROM participants WHERE id = 101;
-[ RECORD 1 ]----------+------------------------------------------------------
username               | kzisme
session_token          | 6ccbc715f24440c0aa63206f04990419
session_expires        | 2015-12-22 10:54:42.374986+00
ctime                  | 2015-12-21 02:47:55.266991+00
claimed_time           | 2015-12-21 02:47:55.276749+00
is_admin               | f
balance                | 0.00
anonymous_giving       | f
balanced_customer_href | 
is_suspicious          | 
id                     | 101
username_lower         | kzisme
api_key                | 
avatar_url             | https://avatars.githubusercontent.com/u/3493562?s=160
is_closed              | f
giving                 | 0.00
taking                 | 0.00
is_free_rider          | 
email_address          | 
email_lang             | 
is_searchable          | t
old_auth_usage         | 
notifications          | {}
notify_charge          | 3
braintree_customer_id  | 
ngiving_to             | 0
ntaking_from           | 0
status_of_1_0_payout   | completed

Then...

gratipay=# UPDATE participants SET is_admin = true WHERE id = 101;
UPDATE 1

Successfully updated my account with admin privileges.

I've been looking around and I haven't found it documented anywhere, but in test environments we have to use accepted test CC numbers found here

rohitpaulk commented 8 years ago

looked into it further and it seems that it's only meant for MySQL

Whoopsy, sorry about that :) We use MySQL at work, hence the confusion

rohitpaulk commented 8 years ago

SELECT * FROM participants WHERE username = kzisme;

You'll need single quotes around kzisme

kzisme commented 8 years ago

Ah, is that why it was searching for columns instead of rows? I figured it was something small like that :)

rohitpaulk commented 8 years ago

I used to use double quotes instead of single quotes and get the same error... Turns out that a single quote is used for a string constant, but double quotes are used for identifiers.

From http://www.postgresql.org/docs/9.4/static/sql-syntax-lexical.html:

A string constant in SQL is an arbitrary sequence of characters bounded by single quotes ('), for example 'This is a string'. To include a single-quote character within a string constant, write two adjacent single quotes, e.g., 'Dianne''s horse'. Note that this is not the same as a double-quote character (").

There is a second kind of identifier: the delimited identifier or quoted identifier. It is formed by enclosing an arbitrary sequence of characters in double-quotes ("). A delimited identifier is always an identifier, never a key word. So "select" could be used to refer to a column or table named "select", whereas an unquoted select would be taken as a key word and would therefore provoke a parse error when used where a table or column name is expected. The example can be written with quoted identifiers like this:

kzisme commented 8 years ago

Awesome! I've began looking at https://github.com/gratipay/gratipay.com/issues/3845 and have pinged you there :dancer:

rohitpaulk commented 8 years ago

!m @kzisme

chadwhitacre commented 8 years ago

@kzisme Seems like you're as onboarded as you're gonna be for now, eh? :-)

kzisme commented 8 years ago

@whit537 I would have to agree :)