M Makefile.docker => Makefile.docker +18 -43
@@ 30,13 30,16 @@ CERTDIR=/var/deploy/certs
keys:
ssh-keygen -A -f etc/ssh/
+databases:
+ $(CONMAN) inspect $(HUTTESE_NETWORK) >/dev/null 2>&1
+ $(CONMAN) inspect -f '{{.State.Running}}' $(HUTTESE_POSTGRES) >/dev/null 2>&1
+ $(CONMAN) inspect -f '{{.State.Running}}' $(HUTTESE_REDIS) >/dev/null 2>&1
+
cleanup:
$(CONMAN) network disconnect --force $(HUTTESE_NETWORK) $(HUTTESE_REDIS) >/dev/null 2>&1 || true
- $(CONMAN) network disconnect --force $(HUTTESE_NETWORK) $(HUTTESE_POSTGRES) >/dev/null 2>&1 || true
-
$(CONMAN) rm --force $(HUTTESE_REDIS) >/dev/null 2>&1 || true
$(CONMAN) image rm --force $(REDIS_LOCALNAME):latest >/dev/null 2>&1 || true
-
+ $(CONMAN) network disconnect --force $(HUTTESE_NETWORK) $(HUTTESE_POSTGRES) >/dev/null 2>&1 || true
$(CONMAN) rm --force $(HUTTESE_POSTGRES) >/dev/null 2>&1 || true
$(CONMAN) image rm --force $(POSTGRES_LOCALNAME):latest >/dev/null 2>&1 || true
@@ 74,64 77,47 @@ image:
--tag $(SRHT_LOCALNAME):$(SRHT_LOCALVERSION) \
sr/
+ # again, only necessary if on aarch64
rm -rf sr/pkg sr/etc/apk/keys
-dbinit: image
- $(CONMAN) inspect $(HUTTESE_NETWORK) >/dev/null 2>&1
- $(CONMAN) inspect -f '{{.State.Running}}' $(HUTTESE_POSTGRES) >/dev/null 2>&1
-
+dbinit: databases image
$(CONMAN) exec $(HUTTESE_POSTGRES) \
createdb -U postgres meta.sr.ht
$(CONMAN) exec $(HUTTESE_POSTGRES) \
createdb -U postgres git.sr.ht
$(CONMAN) exec $(HUTTESE_POSTGRES) \
createdb -U postgres todo.sr.ht
-
$(CONMAN) run --name $(HUTTESE_SRHT)_dbinit --rm \
--network $(HUTTESE_NETWORK) \
$(SRHT_LOCALNAME) metasrht-initdb
-
$(CONMAN) run --name $(HUTTESE_SRHT)_dbinit --rm \
--network $(HUTTESE_NETWORK) \
$(SRHT_LOCALNAME) gitsrht-initdb
-
$(CONMAN) run --name $(HUTTESE_SRHT)_dbinit --rm \
--network $(HUTTESE_NETWORK) \
$(SRHT_LOCALNAME) todosrht-initdb
-dbmigrate: image
- $(CONMAN) inspect $(HUTTESE_NETWORK) >/dev/null 2>&1
- $(CONMAN) inspect -f '{{.State.Running}}' $(HUTTESE_POSTGRES) >/dev/null 2>&1
-
+dbmigrate: databases image
$(CONMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \
--network $(HUTTESE_NETWORK) \
$(SRHT_LOCALNAME) srht-migrate meta.sr.ht -a upgrade head
-
$(CONMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \
--network $(HUTTESE_NETWORK) \
$(SRHT_LOCALNAME) metasrht-migrate -a upgrade head
-
$(CONMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \
--network $(HUTTESE_NETWORK) \
$(SRHT_LOCALNAME) srht-migrate git.sr.ht -a upgrade head
-
$(CONMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \
--network $(HUTTESE_NETWORK) \
$(SRHT_LOCALNAME) gitsrht-migrate -a upgrade head
-
$(CONMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \
--network $(HUTTESE_NETWORK) \
$(SRHT_LOCALNAME) srht-migrate todo.sr.ht -a upgrade head
-
$(CONMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \
--network $(HUTTESE_NETWORK) \
$(SRHT_LOCALNAME) todosrht-migrate -a upgrade head
-start: image
- $(CONMAN) inspect $(HUTTESE_NETWORK) >/dev/null 2>&1
- $(CONMAN) inspect -f '{{.State.Running}}' $(HUTTESE_POSTGRES) >/dev/null 2>&1
- $(CONMAN) inspect -f '{{.State.Running}}' $(HUTTESE_REDIS) >/dev/null 2>&1
-
+start: databases image
$(CONMAN) run --detach --name $(HUTTESE_SRHT) --restart always \
--hostname tatooine \
--hostname dominic-ricottone.com \
@@ 147,40 133,29 @@ start: image
USER_EMAIL?=
USER_NAME?=
-adduser:
- $(CONMAN) inspect -f '{{.State.Running}}' $(HUTTESE_POSTGRES) >/dev/null 2>&1
- $(CONMAN) inspect -f '{{.State.Running}}' $(HUTTESE_REDIS) >/dev/null 2>&1
+adduser: databases
$(CONMAN) exec -it $(HUTTESE_SRHT) metasrht-manageuser -e $(USER_EMAIL) -t active_free $(USER_NAME) \
|| echo "USAGE: USER_EMAIL=me@example.com USER_NAME=me make adduser"
-USER_EMAIL?=
-USER_NAME?=
-addadmin:
- $(CONMAN) inspect -f '{{.State.Running}}' $(HUTTESE_POSTGRES) >/dev/null 2>&1
- $(CONMAN) inspect -f '{{.State.Running}}' $(HUTTESE_REDIS) >/dev/null 2>&1
-
+addadmin: databases
$(CONMAN) exec -it $(HUTTESE_SRHT) metasrht-manageuser -e $(USER_EMAIL) -t admin $(USER_NAME) \
|| echo "USAGE: USER_EMAIL=me@example.com USER_NAME=me make adduser"
-shell: image
- $(CONMAN) inspect $(HUTTESE_NETWORK) >/dev/null 2>&1
- $(CONMAN) inspect -f '{{.State.Running}}' $(HUTTESE_POSTGRES) >/dev/null 2>&1
- $(CONMAN) inspect -f '{{.State.Running}}' $(HUTTESE_REDIS) >/dev/null 2>&1
-
+shell:
$(CONMAN) exec -it $(HUTTESE_SRHT) sh
+psql: databases
+ $(CONMAN) exec -it huttpg psql --username=postgres
+
stop:
$(CONMAN) stop $(HUTTESE_SRHT)
-restart:
- $(CONMAN) inspect $(HUTTESE_NETWORK) >/dev/null 2>&1
- $(CONMAN) inspect -f '{{.State.Running}}' $(HUTTESE_POSTGRES) >/dev/null 2>&1
- $(CONMAN) inspect -f '{{.State.Running}}' $(HUTTESE_REDIS) >/dev/null 2>&1
-
+restart: databases
$(CONMAN) restart $(HUTTESE_SRHT)
clean:
$(CONMAN) rm --force $(HUTTESE_SRHT) >/dev/null 2>&1 || true
$(CONMAN) image rm --force $(SRHT_LOCALNAME):latest >/dev/null 2>&1 || true
+.PHONY: databases cleanup setup image dbinit dbmigrate start adduser addadmin shell psql stop restart clean
M Makefile.podman => Makefile.podman +15 -35
@@ 40,10 40,13 @@ pod:
--add-host=todo.dominic-ricottone.com:127.0.0.1 \
--publish 0.0.0.0:80:80 --publish 0.0.0.0:443:443 --publish 0.0.0.0:8822:22
+databases:
+ $(PODMAN) inspect -f '{{.State.Running}}' $(HUTTESE_POSTGRES) >/dev/null 2>&1
+ $(PODMAN) inspect -f '{{.State.Running}}' $(HUTTESE_REDIS) >/dev/null 2>&1
+
cleanup:
$(PODMAN) rm --force $(HUTTESE_REDIS) >/dev/null 2>&1 || true
$(PODMAN) image rm --force $(REDIS_LOCALNAME):latest >/dev/null 2>&1 || true
-
$(PODMAN) rm --force $(HUTTESE_POSTGRES) >/dev/null 2>&1 || true
$(PODMAN) image rm --force $(POSTGRES_LOCALNAME):latest >/dev/null 2>&1 || true
@@ 76,61 79,47 @@ image:
--tag $(SRHT_LOCALNAME):$(SRHT_LOCALVERSION) \
sr/
+ # again, only necessary if on aarch64
rm -rf sr/pkg sr/etc/apk/keys
-dbinit: pod image
- $(PODMAN) inspect -f '{{.State.Running}}' $(HUTTESE_POSTGRES) >/dev/null 2>&1
+dbinit: pod databases image
$(PODMAN) exec $(HUTTESE_POSTGRES) \
createdb -U postgres meta.sr.ht
$(PODMAN) exec $(HUTTESE_POSTGRES) \
createdb -U postgres git.sr.ht
$(PODMAN) exec $(HUTTESE_POSTGRES) \
createdb -U postgres todo.sr.ht
-
$(PODMAN) run --name $(HUTTESE_SRHT)_dbinit --rm \
--pod podracing \
$(SRHT_LOCALNAME) metasrht-initdb
-
$(PODMAN) run --name $(HUTTESE_SRHT)_dbinit --rm \
--pod podracing \
$(SRHT_LOCALNAME) gitsrht-initdb
-
$(PODMAN) run --name $(HUTTESE_SRHT)_dbinit --rm \
--pod podracing \
$(SRHT_LOCALNAME) todosrht-initdb
-dbmigrate: pod image
- $(PODMAN) inspect $(HUTTESE_NETWORK) >/dev/null 2>&1
- $(PODMAN) inspect -f '{{.State.Running}}' $(HUTTESE_POSTGRES) >/dev/null 2>&1
-
+dbmigrate: pod databases image
$(PODMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \
--pod podracing \
$(SRHT_LOCALNAME) srht-migrate meta.sr.ht -a upgrade head
-
$(PODMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \
--pod podracing \
$(SRHT_LOCALNAME) metasrht-migrate -a upgrade head
-
$(PODMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \
--pod podracing \
$(SRHT_LOCALNAME) srht-migrate git.sr.ht -a upgrade head
-
$(PODMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \
--pod podracing \
$(SRHT_LOCALNAME) gitsrht-migrate -a upgrade head
-
$(PODMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \
--pod podracing \
$(SRHT_LOCALNAME) srht-migrate todo.sr.ht -a upgrade head
-
$(PODMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \
--pod podracing \
$(SRHT_LOCALNAME) todosrht-migrate -a upgrade head
-start: pod image
- $(PODMAN) inspect -f '{{.State.Running}}' $(HUTTESE_POSTGRES) >/dev/null 2>&1
- $(PODMAN) inspect -f '{{.State.Running}}' $(HUTTESE_REDIS) >/dev/null 2>&1
-
+start: pod databases image
$(PODMAN) run --detach --name $(HUTTESE_SRHT) --restart always \
--pod podracing \
--mount type=bind,src=$(GIT_DATADIR),dst=/var/lib/git,Z \
@@ 139,38 128,29 @@ start: pod image
USER_EMAIL?=
USER_NAME?=
-adduser:
- $(PODMAN) inspect -f '{{.State.Running}}' $(HUTTESE_POSTGRES) >/dev/null 2>&1
- $(PODMAN) inspect -f '{{.State.Running}}' $(HUTTESE_REDIS) >/dev/null 2>&1
+adduser: databases
$(PODMAN) exec -it $(HUTTESE_SRHT) metasrht-manageuser -e $(USER_EMAIL) -t active_free $(USER_NAME) \
|| echo "USAGE: USER_EMAIL=me@example.com USER_NAME=me make adduser"
-USER_EMAIL?=
-USER_NAME?=
-addadmin:
- $(PODMAN) inspect -f '{{.State.Running}}' $(HUTTESE_POSTGRES) >/dev/null 2>&1
- $(PODMAN) inspect -f '{{.State.Running}}' $(HUTTESE_REDIS) >/dev/null 2>&1
-
+addadmin: databases
$(PODMAN) exec -it $(HUTTESE_SRHT) metasrht-manageuser -e $(USER_EMAIL) -t admin $(USER_NAME) \
|| echo "USAGE: USER_EMAIL=me@example.com USER_NAME=me make adduser"
shell:
- $(PODMAN) inspect -f '{{.State.Running}}' $(HUTTESE_POSTGRES) >/dev/null 2>&1
- $(PODMAN) inspect -f '{{.State.Running}}' $(HUTTESE_REDIS) >/dev/null 2>&1
-
$(PODMAN) exec -it $(HUTTESE_SRHT) sh
+psql: databases
+ $(PODMAN) exec -it huttpg psql --username=postgres
+
stop:
$(PODMAN) stop $(HUTTESE_SRHT)
-restart:
- $(PODMAN) inspect -f '{{.State.Running}}' $(HUTTESE_POSTGRES) >/dev/null 2>&1
- $(PODMAN) inspect -f '{{.State.Running}}' $(HUTTESE_REDIS) >/dev/null 2>&1
-
+restart: databases
$(PODMAN) restart $(HUTTESE_SRHT)
clean:
$(PODMAN) rm --force $(HUTTESE_SRHT) >/dev/null 2>&1 || true
$(PODMAN) image rm --force $(SRHT_LOCALNAME):latest >/dev/null 2>&1 || true
+.PHONY: pod databases cleanup setup image dbinit dbmigrate start adduser addadmin shell psql stop restart clean
M sr/etc/postfix/transport => sr/etc/postfix/transport +2 -0
@@ 1,4 1,6 @@
lists.tatooine.localdomain lmtp:unix:/tmp/lists.sr.ht-lmtp.sock
lists.tatooine lmtp:unix:/tmp/lists.sr.ht-lmtp.sock
+todo.tatooine.localdomain lmtp:unix:/tmp/todo.sr.ht-lmtp.sock
+todo.tatooine lmtp:unix:/tmp/todo.sr.ht-lmtp.sock
tatooine.localdomain local:tatooine
tatooine local:tatooine