Greg greg
  • Joined on 2018-11-05
greg pushed to feature/pg_encfs at kosmos/chef 2020-06-04 17:55:47 +00:00
1e60722ec4 Create an initial encfs cookbook
eded62a3ec Merge branch 'master' into feature/pg_encfs
27845525da Use the same JWT_SECRET as on our previous Gitea
c8e50fd226 Install git, it is a required dependency for Gitea
2d6c514257 Add the gitea role
Compare 22 commits »
greg commented on pull request kosmos/chef#166 2020-06-04 14:32:05 +00:00
Encrypt PostgreSQL data directory

I took another look at this issue, I'm starting to think a full disk encryption setup would make more sense instead of encFS directories, something similar to https://github.com/TheReal1604/disk-encryption-hetzner/blob/master/ubuntu/ubuntu_swraid_lvm_luks.md

greg closed issue kosmos/chef#173 2020-06-02 15:58:18 +00:00
Remove all GKE resources
greg commented on issue kosmos/chef#173 2020-06-02 15:58:13 +00:00
Remove all GKE resources

Done, deleted the GKE resources, as well as the VM instances, volumes and snapshots. The billing page is showing a €2.37 bill for June for now, that should be the last charge

I also took a look at https://gitea.kosmos.org/kosmos/gitea.kosmos.org, I think we can delete the entire repo, it is all specific to the instance we were running on GKE

greg deleted branch bugfix/147-gitea_fixes from kosmos/chef 2020-06-02 14:24:17 +00:00
greg pushed to master at kosmos/chef 2020-06-02 14:24:12 +00:00
db4792e836 Merge pull request 'Gitea fixes' (#174) from bugfix/147-gitea_fixes into master
ccd49aefa4 Add Gitea to the run lists for Andromeda and Centaurus
759fa52e03 Enable the certbot resource
0f10723c81 Enable secure cookies
55865c526c Add the Let's Encrypt hook dir to the config
Compare 9 commits »
greg merged pull request kosmos/chef#174 2020-06-02 14:24:12 +00:00
Gitea fixes
greg created pull request kosmos/chef#174 2020-06-02 14:22:19 +00:00
Gitea fixes
greg pushed to bugfix/147-gitea_fixes at kosmos/chef 2020-06-02 14:20:10 +00:00
ccd49aefa4 Add Gitea to the run lists for Andromeda and Centaurus
759fa52e03 Enable the certbot resource
0f10723c81 Enable secure cookies
55865c526c Add the Let's Encrypt hook dir to the config
0c502580c2 Fix the condition for the Let's Encrypt cert in the template
greg deleted branch feature/147-gitea_cookbook from kosmos/chef 2020-06-02 09:17:02 +00:00
greg merged pull request kosmos/chef#168 2020-06-02 09:16:44 +00:00
Initial kosmos_gitea cookbook
greg merged pull request kosmos/chef#168 2020-06-02 09:16:43 +00:00
Initial kosmos_gitea cookbook
greg pushed to master at kosmos/chef 2020-06-02 09:16:43 +00:00
8342298c89 Merge branch 'feature/147-gitea_cookbook' of kosmos/chef into master
94330f2052 Comment out the COOKIE_SECURE config for now
baaae695af Merge branch 'master' into feature/147-gitea_cookbook
baa0739936 Add the backup recipe
3332a1b2e8 Write initial README
Compare 8 commits »
greg commented on pull request kosmos/chef#168 2020-06-02 08:47:35 +00:00
Initial kosmos_gitea cookbook
greg commented on pull request kosmos/chef#168 2020-05-29 14:07:31 +00:00
Initial kosmos_gitea cookbook

I copied your question to #147 and answered it there. Is this PR good to merge?

greg commented on issue kosmos/chef#147 2020-05-29 13:40:25 +00:00
Prepare Gitea migration (from GKE to Kosmos server)

Copied this question from the PR:

As we're importing a database dump, the /home/git/.ssh/authorized_keys file on centaurus will be empty at first, this admin task generates the content of the file with users’ public key. It is then managed by Gitea, so new keys are automatically added, deleted keys deleted, etc

Yes, that's obvious from the original post. But what is this task? It is just English text in your post, but is it a script somewhere? How is it run?

Originally this was a maintenance task executed from the Gitea admin dashboard, so a link on https://gitea.kosmos.org/admin

I have found a better way, this is also available as a script, I have added the line to the checklist above:

$ sudo su - git -c "/usr/local/bin/gitea admin regenerate keys --config /etc/gitea/app.ini"
greg commented on issue kosmos/chef#147 2020-05-29 09:08:59 +00:00
Prepare Gitea migration (from GKE to Kosmos server)

Copied from the PR:

I think we can finally migrate away Gitea to Centaurus (with the DB on Andromeda as the master). Tomorrow I will check everything on Andromeda and Centaurus, then we can pick a time and date to do the switch. It will involve a DNS switch, in preparation for this I have just lowered the TTL on gitea.kosmos.org down to 300s, the lowest Gandi supports. It was previously set to 1800s.

Here are my notes for the dump/import:

Perform a dump

From https://discourse.gitea.io/t/migrate-gitea-db-from-mariadb-to-postgresql/2072/3

$ kubectl exec gitea-server-5d57fc877d-ghvps -n default -- /app/gitea/gitea dump -d postgres -c /data/gitea/conf/app.ini -f /data/gitea/gitea-dump.zip
$ kubectl cp gitea-server-5d57fc877d-ghvps:/data/gitea/gitea-dump.zip gitea-dump.zip
$ kubectl exec gitea-server-5d57fc877d-ghvps -n default -- /bin/rm /data/gitea/gitea-dump.zip

Import the dump

on Andromeda:

$ sudo su - postgres -c "psql gitea < gitea-db.sql"

on Centaurus:

SCP and unzip gitea-dump.zip

$ scp gitea-dump.zip centaurus.kosmos.org:
$ ssh centaurus.kosmos.org
$ sudo systemctl stop gitea
$ mkdir dump; mv gitea-dump.zip dump; cd dump; unzip gitea-dump.zip; sudo cp -R repositories /home/git/gitea-repositories
# Copy the content of `data`:
$ sudo cp -R dump/data/sessions /var/lib/gitea/
$ sudo cp -R dump/data/indexers /var/lib/gitea/data/
$ sudo cp -R dump/data/attachments /var/lib/gitea/data/
$ sudo cp -R dump/data/avatars /var/lib/gitea/data/
$ sudo cp -R dump/data/repo-avatars /var/lib/gitea/data/
$ sudo rm -rf /var/lib/gitea/data/queues; sudo cp -R dump/data/queues /var/lib/gitea/data/
$ sudo chown -R git:git /var/lib/gitea/data/
$ sudo systemctl start gitea

Log in, run Update the '.ssh/authorized_keys' file with Gitea SSH keys on http://gitea.kosmos.org/admin so the users' public keys are copied to the /home/git/.ssh/authorized_key file

greg commented on pull request kosmos/chef#168 2020-05-29 09:07:32 +00:00
Initial kosmos_gitea cookbook

I think the only thing that is not clear to me is:

Log in, run Update the '.ssh/authorized_keys' file with Gitea SSH keys on http://gitea.kosmos.org/admin

As we're importing a database dump, the /home/git/.ssh/authorized_keys file on centaurus will be empty at first, this admin task generates the content of the file with users' public key. It is then managed by Gitea, so new keys are automatically added, deleted keys deleted, etc

Also, are you sure the deployment should be part of the cookbook PR? We agreed that only master is being deployed to production, and I also don't see how the cookbook PR should include an entire production migration to begin with. The work done for that is different than for the cookbook code.

That's right, I will move this checklist to the issue instead

greg commented on pull request kosmos/chef#168 2020-05-28 17:06:06 +00:00
Initial kosmos_gitea cookbook

I think we can finally migrate away Gitea to Centaurus (with the DB on Andromeda as the master). Tomorrow I will check everything on Andromeda and Centaurus, then we can pick a time and date to do the switch. It will involve a DNS switch, in preparation for this I have just lowered the TTL on gitea.kosmos.org down to 300s, the lowest Gandi supports. It was previously set to 1800s.

Here are my notes for the dump/import:

Perform a dump

From https://discourse.gitea.io/t/migrate-gitea-db-from-mariadb-to-postgresql/2072/3

$ kubectl exec gitea-server-5d57fc877d-ghvps -n default -- /app/gitea/gitea dump -d postgres -c /data/gitea/conf/app.ini -f /data/gitea/gitea-dump.zip
$ kubectl cp gitea-server-5d57fc877d-ghvps:/data/gitea/gitea-dump.zip gitea-dump.zip
$ kubectl exec gitea-server-5d57fc877d-ghvps -n default -- /bin/rm /data/gitea/gitea-dump.zip

Import the dump

on Andromeda:

$ sudo su - postgres -c "psql gitea < gitea-db.sql"

on Centaurus:

SCP and unzip gitea-dump.zip

$ scp gitea-dump.zip centaurus.kosmos.org:
$ ssh centaurus.kosmos.org
$ sudo systemctl stop gitea
$ mkdir dump; mv gitea-dump.zip dump; cd dump; unzip gitea-dump.zip; sudo cp -R repositories /home/git/gitea-repositories
# Copy the content of `data`:
$ sudo cp -R dump/data/sessions /var/lib/gitea/
$ sudo cp -R dump/data/indexers /var/lib/gitea/data/
$ sudo cp -R dump/data/attachments /var/lib/gitea/data/
$ sudo cp -R dump/data/avatars /var/lib/gitea/data/
$ sudo cp -R dump/data/repo-avatars /var/lib/gitea/data/
$ sudo rm -rf /var/lib/gitea/data/queues; sudo cp -R dump/data/queues /var/lib/gitea/data/
$ sudo chown -R git:git /var/lib/gitea/data/
$ sudo systemctl start gitea

Log in, run Update the '.ssh/authorized_keys' file with Gitea SSH keys on http://gitea.kosmos.org/admin so authorized SSH keys work for everyone

greg pushed to feature/147-gitea_cookbook at kosmos/chef 2020-05-28 16:45:36 +00:00
94330f2052 Comment out the COOKIE_SECURE config for now
baaae695af Merge branch 'master' into feature/147-gitea_cookbook
5b2d4f269d Merge branch 'bugfix/171-letsencrypt_resource' of kosmos/chef into master
210c76c479 Fix the name of the Let's Encrypt cert execute resource
6469d2286e Merge branch 'feature/zoom_options' of kosmos/chef into master
Compare 8 commits »