cl-library-docs / common-lisp-libraries

common-lisp-libraries.readthedocs.io
https://cl-library-docs.github.io/common-lisp-libraries/
21 stars 3 forks source link

Some corrections and additional info on postmodern #6

Closed sabracrolleton closed 4 years ago

sabracrolleton commented 4 years ago

Some corrections on postgresql installation.

Additional info on toplevel v. with-connection

Additional ELI5 for migrations

digikar99 commented 4 years ago

Ah, thanks for correcting the errors!

About the port number, my reasons for changing it a non-default one was to require the learner to peek into things to learn about it. I find port number configuration to be kinda worth knowing. Also, I am not exactly sure if this is with a fresh install or not. The root postgres server is up at 5432, and I wanted to avoid dealing with the root server, and use a user-defined one instead. I do not have any knowledge about which is preferred or why.

sabracrolleton commented 4 years ago

You can run multiple databases on the same postgres server. Actually template0, template1 and postgres are all different databases and generally assumed to be running on each database instance, alongside the databases you yourself create. Those three databases are created in the init process and used for administrative purposes. You cannot change template0. Template1 has the defaults that any new database are assumed to use (e.g. UTF-8, locale, collation, etc) so you change your defaults there. The postgres database exists because you need to be able to connect to a database in order to do anything. Most admin tools assume that the postgres database will exist so try to connect to it as their way to connect to the running postgresql instance. You can delete it or modify it, but it generally is not recommended.

If you want to run a postgres server on a different port (and still have another server running on 5432), then you need to install a second postgresql server and edit the postgresql.conf file so that it runs on a different port. How you do that will depend on your operating system. Your use of port 8080 surprised me because people tend to run webservers on that port, but it does not really make any difference, you can use it, but, like I said, you need to edit the postgresql.conf file to change that.

I agree it is good to know how to do this. I often need to run multiple postgres servers with different configurations (either in development or in production), and that requires using different ports if they are running on the same box.

sabracrolleton commented 4 years ago

I will add a longer discussion to meet your use case on multiple servers.

digikar99 commented 4 years ago

Also about the directory name - are there any reasons to use postgres. I had decided postmodern to clarify that the database postgres is different from the directory.

Your use of port 8080 surprised me because people tend to run webservers on that port,

I have definitely seen 8000 being used for webservers, not sure about 8080. Any other usual port than the default 5432?

install a second postgresql server

The installation instructions on the linked page do include the instructions, no? Post that, once we have access to the postgres, pg_ctl and psql commands, the steps for setting up another server are common, no?

I will add a longer discussion to meet your use case on multiple servers.

If it's something VIP the user needs to know, sure. But, I do want to keep things short. Long enough to be useful, and short enough to get the user up and running. I mean, "Starting the Postgres server" does deal with this, no?

Optionally, change port and unix_socket_directories from postmodern/postgresql.conf

I find this note to be sufficient, but YMMV perhaps.

sabracrolleton commented 4 years ago

Now that I know that you are trying to show the flexibility of using non-standard locations, what you did makes more sense. I think you just need to flag that.

Re directory name. You can make it anything you want. If I am running multiple postgres instances on the same server, I typically will name them after the reason for running the separate instance, which might be the name of a single database running on that instance or something that indicates a non-standard configuration. For your purpose here, naming it postmodern would be fine.

Re: ports. Whatever is available. It does not matter.

Agree with the rest of your comments.

digikar99 commented 4 years ago

About 1.32, I thought about reparsing the official docs, and noticed a few inconsistencies while commiting - for example, database-version is exported but not mentioned in the doc - rather removed, as compared to 1.30. Also some others like database-error-cause (haven't looked into it completely).

sabracrolleton commented 4 years ago

Thank you. Will fix. Plus any others you notice.

sabracrolleton commented 4 years ago

database-version is deprecated in favor of postgresql-version which is why it was dropped from the documentation. Database-version implies that it returns a version number for someone's database rather than the postgresql server. I kept it in exports because some people may actually use it.

digikar99 commented 4 years ago

I'll check further symbols sometime next week.

Re: database-version - deprecation did seem like a possible explanation, but I did not get any warnings upon its usage or compilation. (Perhaps, this discussion is better suited to be continued over in postmodern's issues.)

digikar99 commented 4 years ago

Do you have any opinions about madnificent/database-migrations? If not, given the lack of much activity here - I'll probably mention all the four. Also, any opinions / experience with postmodern-passenger-pigeon?

sabracrolleton commented 4 years ago

Sorry. No experience with them.

digikar99 commented 4 years ago

Alright, I've added others as well; hopefully, enough people test enough of these so that there develops an informed opinion in the community.

Thanks for the improvements!