diff --git a/docs/getting-started.rst b/docs/getting-started.rst --- a/docs/getting-started.rst +++ b/docs/getting-started.rst @@ -61,6 +61,17 @@ documentation `_. +You also need to have access to a superuser account on the database. For that, +the easiest way is to create a PostgreSQL account that has the same name as +your username:: + + sudo -u postgres createuser --createdb --superuser --pwprompt $USER + +You can check that this worked by doing, from your user (no password should be +asked):: + + psql postgres + Node.js modules ~~~~~~~~~~~~~~~ @@ -104,56 +115,25 @@ code artifacts via a REST API. The Software Heritage storage layer comes in two parts: a content-addressable object storage on your file system (for file contents) and a Postgres database (for the graph structure of the archive). See -the :ref:`data-model` for more information. The storage layer is configured via -a YAML configuration file, located at -``~/.config/swh/storage/storage.yml``. Create it with a content like: - -.. code-block:: yaml - - storage: - cls: local - args: - db: "host=localhost port=5432 dbname=softwareheritage-dev user=swhdev password=foobar" - objstorage: - cls: pathslicing - args: - root: /srv/softwareheritage/objects/ - slicing: 0:2/2:4 +the :ref:`data-model` for more information. Make sure that the object storage root exists on the filesystem and is writable -to your user, e.g.:: +to your user:: sudo mkdir /srv/softwareheritage/objects sudo chown "${USER}:" /srv/softwareheritage/objects You are done with object storage setup! Let's setup the database:: - cd swh-storage/sql/ - sudo -u postgres bin/db-init 5432 softwareheritage-dev swhdev - cd - + swh-storage/sql/bin/db-init softwareheritage-dev + +``softwareheritage-dev`` is the default name of the storage DB that will be +created. -Let's unpack the second line. You should have Postgres administrator privileges -to be able to create databases, hence the ``sudo -u postgres``; if your user -has Postgres admin privileges, you can avoid ``sudo`` here. ``5432`` is the -default port of the main Postgres cluster, adapt as needed. -``softwareheritage-dev`` is the name of the DB that will be created, it should -match the ``db`` line in ``storage.yml``; same goes for ``swhdev``, the DB user -name. You will be interactively asked for a password for the DB user; you -should provide one that matches the ``db`` line value. - -To check that you can successfully connect to the DB (you will be interactively -asked for the DB password):: - - psql -h localhost -p 5432 -U swhdev softwareheritage-dev - -Note that you can simplify interactive use and reduce configuration clutter -using Postgres `password -`_ and -`service -`_ -configuration files. Any valid `libpq connection string -`_ -will make the ``db`` line of ``storage.yml`` happy. +To check that you can successfully connect to the DB (you should not be asked +for a password):: + + psql softwareheritage-dev You can now run the storage server like this:: @@ -166,21 +146,9 @@ You are now ready to ingest your first repository into your local Software Heritage. For the sake of example, we will ingest a few Git repositories. The module in charge of ingesting Git repositories is the *Git loader*, Python -module ``swh.loader.git``. Its configuration file is at -``~/.config/swh/loader/git-updater.yml``. Create it with a content like: - -.. code-block:: yaml +module ``swh.loader.git``. - storage: - cls: remote - args: - url: http://localhost:5002 - -It just informs the Git loader to use the storage server running on your -machine. The ``url`` line should match the command line used to run the storage -server. - -You can now ingest Git repository on the command line using the command:: +You can ingest Git repository on the command line using the command:: python3 -m swh.loader.git.updater --origin-url GIT_CLONE_URL @@ -205,22 +173,9 @@ Step 5 --- browse the archive ----------------------------- -You can now setup a local web app to browse what you have locally archived. The -web app uses the configuration file ``~/.config/swh/web/web.yml``. Create it -and fill it with something like: - -.. code-block:: yaml - - storage: - cls: remote - args: - url: http://localhost:5002 - -Nothing new here, the configuration just references the local storage server, -which have been used before for repository ingestion. - -You can now run the web app, and browse your local archive:: +You can now run local web app to browse what you have locally archived:: + cd swh-web make run-django-webpack-devserver xdg-open http://localhost:5004