The database holds details of the following:
- courtesy accounts
- hook scripts
- public keys, used to permit SSH access
- group membership and invitations
- user associations
- SVN/Git/Hg permissions
- directory meta-data
Each time SVN/Git/Hg permissions or group membership
are changed, new SVN/Git/Hg authorization files are
generated in /var/forge/service/.
Enter the database server to create a less
privileged account, the database itself, and some
tables:
You might have to enter adminPassword
first for the sake of sudo, but the prompt
should be clear about this. Then you will definitely
have to enter mysqlRootPassword, which you
specified before.
Create a database forge:
CREATE DATABASE `forge` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `forge` ;
Create a less privileged user forge
within MySQL to access the forge database
routinely:
CREATE USER 'forge'@'localhost' IDENTIFIED BY 'mysqlForgePassword';
GRANT SHOW VIEW, SHOW CREATE FUNCTION, TRIGGER, LOCK TABLES, SELECT, INSERT, UPDATE, DELETE, EXECUTE ON `forge`.* TO 'forge'@'localhost';
You can get the database structure from
dbstructure.sql, but note that it is
currently on Forge@Lancaster. If that's not up (because
you're recovering it), you might still have direct
access to the repository, and will have to change the
URL accordingly:
svn cat "$${BASE}/webtools/repowebman/branches/stable/dbstructure.sql" > dbstructure.sql
mysql forge < dbstructure.sql
Create a privileged group of managers:
INSERT INTO `entities` (`type`, `flags`) VALUES ('GROUP', 'AUTHZ_ADMIN,GROUP_ADMIN,USER_ADMIN,ROOT,REPO_MAKER,DOMAIN_OWNER');
SET @rootid = LAST_INSERT_ID();
INSERT INTO `group_info` (`id`, `title`, `svn_label`, `token`) VALUES (@rootid, 'Managers', '@managers', 'super');
Create an internal user to be a manager:
INSERT INTO `entities` (`type`, `flags`) VALUES ('USER', '');
SET @superid = LAST_INSERT_ID();
INSERT INTO `internal_users` (`id`, `surname`, `given_name`, `email`, `passwd`) VALUES (@superid, 'Bloggs', 'Fred', 'f.blogs@example.com', ENCRYPT('mypassword'));
Or create an external user fbloggs to
be a manager:
INSERT INTO `entities` (`type`, `flags`) VALUES ('USER', 'EXTERNAL');
SET @superid = LAST_INSERT_ID();
INSERT INTO `user_data` (`id`, `username`) VALUES (@superid, 'fbloggs');
Make the user a manager:
INSERT INTO `membership` (`container`, `item`) VALUES (@rootid, @superid);
Create the other special groups:
INSERT INTO `entities` (`type`, `flags`) VALUES ('GROUP', 'ROOT,USER_ADMIN');
INSERT INTO `group_info` (`id`, `title`, `token`) VALUES (LAST_INSERT_ID(), 'User makers', 'user_makers');
INSERT INTO `entities` (`type`, `flags`) VALUES ('GROUP', 'ROOT,REPO_MAKER');
INSERT INTO `group_info` (`id`, `title`, `token`) VALUES (LAST_INSERT_ID(), 'Repository makers', 'repo_makers');
INSERT INTO `entities` (`type`, `flags`) VALUES ('GROUP', 'ROOT,DOMAIN_OWNER');
INSERT INTO `group_info` (`id`, `title`, `token`) VALUES (LAST_INSERT_ID(), 'Domain owners', 'domain_owners');
INSERT INTO `entities` (`type`, `flags`) VALUES ('GROUP', 'ROOT,AUTHN,NOT_MEMBER');
INSERT INTO `group_info` (`id`, `title`, `svn_label`, `token`) VALUES (LAST_INSERT_ID(), 'Authenticated users', '$$authenticated', 'authn');
INSERT INTO `entities` (`type`, `flags`) VALUES ('GROUP', 'ROOT,ANON,NOT_HG,NOT_MEMBER');
INSERT INTO `group_info` (`id`, `title`, `svn_label`, `token`) VALUES (LAST_INSERT_ID(), 'Anonymous users', '$$anonymous', 'anon');
INSERT INTO `entities` (`type`, `flags`) VALUES ('GROUP', 'ROOT,AUTHN,ANON,NOT_MEMBER');
INSERT INTO `group_info` (`id`, `title`, `svn_label`, `token`) VALUES (LAST_INSERT_ID(), 'Anyone', '*', 'all');