Compare commits
No commits in common. "6bdf37e91aad232e163214f0e7764ea80bae8920" and "a8ca9bfafe1d4b889b89603bd924fa7d82d916dc" have entirely different histories.
6bdf37e91a
...
a8ca9bfafe
37
README.md
37
README.md
|
|
@ -1,38 +1,3 @@
|
||||||
# Jean-Marie family website
|
# Jean-Marie family website
|
||||||
|
|
||||||
The Jean-Marie family website is a place to share information about family activities
|
The Jean-Marie family website is a place to share information about family activities
|
||||||
|
|
||||||
Postgresql server setup and configuration
|
|
||||||
- Create new debian container
|
|
||||||
- 2GB RAM
|
|
||||||
- 8G Storage
|
|
||||||
- link to ZFS storage pool
|
|
||||||
- Update packages
|
|
||||||
- apt update && apt upgrade -y && apt autoremove -y
|
|
||||||
- Install current postgresql source
|
|
||||||
- apt install -y postgresql-common
|
|
||||||
- /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
|
|
||||||
- apt install -y postgresql
|
|
||||||
- Move cluster to ZFS
|
|
||||||
- Stop postgresql
|
|
||||||
- systemctl stop postgresql
|
|
||||||
- Create new directory for cluster in ZFS
|
|
||||||
- from ZFS server create world writable directory
|
|
||||||
- Move current cluster to new location
|
|
||||||
- from ZFS server ensure ownership of all files in moved directory is postgres
|
|
||||||
- Point to new location
|
|
||||||
- nano /etc/postgresql/<version>/main/postgresql.conf
|
|
||||||
- data_directory = '<new location>'
|
|
||||||
- Restart postgresql
|
|
||||||
- systemctl start postgresql
|
|
||||||
- Allow external access
|
|
||||||
- Edit pg_hba.conf
|
|
||||||
- Change host all address to local network
|
|
||||||
- Edit postgresql.conf
|
|
||||||
- Change listen_adress to '*'
|
|
||||||
- Change password
|
|
||||||
- su postgres
|
|
||||||
- psql
|
|
||||||
- alter user postgres with password '<new password>';
|
|
||||||
- \q
|
|
||||||
- exit
|
|
||||||
|
|
@ -5,20 +5,23 @@ create table if not exists people (
|
||||||
created_by uuid NOT NULL,
|
created_by uuid NOT NULL,
|
||||||
updated_at timestamp without time zone NOT NULL DEFAULT now(),
|
updated_at timestamp without time zone NOT NULL DEFAULT now(),
|
||||||
updated_by uuid NOT NULL,
|
updated_by uuid NOT NULL,
|
||||||
email text NOT NULL unique,
|
email text NOT NULL,
|
||||||
name text NOT NULL,
|
name text NOT NULL,
|
||||||
family_name text NOT NULL,
|
family_name text NOT NULL,
|
||||||
given_name text NOT NULL,
|
given_name text NOT NULL
|
||||||
CONSTRAINT people_pkey PRIMARY KEY (id)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
ALTER TABLE
|
||||||
|
people
|
||||||
|
ADD
|
||||||
|
CONSTRAINT people_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
ALTER TABLE if exists users
|
ALTER TABLE if exists users
|
||||||
ADD COLUMN IF NOT EXISTS person_id uuid REFERENCES people (id) ON DELETE SET NULL;
|
ADD COLUMN person_id uuid REFERENCES people (id) ON DELETE SET NULL;
|
||||||
|
|
||||||
-- Copy accounts(users) to profiles(people)
|
-- Copy accounts(users) to profiles(people)
|
||||||
insert into people (created_by, updated_by, email, name, family_name, given_name)
|
insert into people (created_by, updated_by, email, name, family_name, given_name)
|
||||||
select created_by, updated_by, email, name, family_name, given_name from users
|
select created_by, updated_by, email, name, family_name, given_name from users;
|
||||||
on conflict do nothing;
|
|
||||||
|
|
||||||
-- Link accounts to profiles
|
-- Link accounts to profiles
|
||||||
update users u set person_id = p.id from people p where p.email = u.email;
|
update users u set person_id = p.id from people p where p.email = u.email;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue