Skip to content

Commit 36ec7e9

Browse files
committed
[logseq-plugin-git:commit] 2024-12-09T04:08:45.182Z
1 parent 8d27897 commit 36ec7e9

6 files changed

+432
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
public:: true
2+
3+
- {{renderer :tocgen}}
4+
- # Useful Command
5+
- Check doker container
6+
`doker container ps`
7+
- Check logs
8+
`docker logs -f gitlab`
9+
- Get into container with bash
10+
`docker exec -it gitlab bash`
11+
- # Backup Gitlab in docker
12+
id:: 64153b91-5c7a-40a2-8298-a1019bc911fd
13+
collapsed:: true
14+
[Backup and restore Gitlab in docker - A code to remember (copdips.com)](https://copdips.com/2018/09/backup-and-restore-gitlab-in-docker.html#backup-gitlab-in-docker)
15+
- ## Check backup path
16+
- ### Synology NAS
17+
```bash
18+
# depeneds on the space set for docker
19+
# locate Gitlab configuration file gitlab.rb
20+
21+
Pointshare@PointNAS:/$ sudo ls volume1/gitlab/config/
22+
Password:
23+
gitlab.rb ssh_host_ecdsa_key.pub ssh_host_rsa_key
24+
gitlab-secrets.json ssh_host_ed25519_key ssh_host_rsa_key.pub
25+
ssh_host_ecdsa_key ssh_host_ed25519_key.pub trusted-certs
26+
27+
# Locate backup_path
28+
29+
Pointshare@PointNAS:/$ sudo cat volume1/gitlab/config/gitlab.rb | grep backup_path
30+
# gitlab_rails['manage_backup_path'] = true
31+
# gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"
32+
# gitlab_rails['backup_gitaly_backup_path'] = "/opt/gitlab/embedded/bin/gitaly-backup"
33+
```
34+
- ## Create Backup
35+
- ### Backup
36+
```bash
37+
root@d44c48535c28:/# sudo docker exec -it gitlab gitlab-rake gitlab:backup:create
38+
2023-03-18 04:48:17 +0000 -- Dumping database ...
39+
Dumping PostgreSQL database gitlabhq_production ... [DONE]
40+
2023-03-18 04:48:25 +0000 -- Dumping database ... done
41+
2023-03-18 04:48:25 +0000 -- Dumping repositories ...
42+
.
43+
.
44+
.
45+
2023-03-18 04:48:45 +0000 -- Dumping repositories ... done
46+
2023-03-18 04:48:45 +0000 -- Dumping uploads ...
47+
2023-03-18 04:48:47 +0000 -- Dumping uploads ... done
48+
2023-03-18 04:48:47 +0000 -- Dumping builds ...
49+
2023-03-18 04:48:47 +0000 -- Dumping builds ... done
50+
2023-03-18 04:48:47 +0000 -- Dumping artifacts ...
51+
2023-03-18 04:49:01 +0000 -- Dumping artifacts ... done
52+
2023-03-18 04:49:01 +0000 -- Dumping pages ...
53+
2023-03-18 04:49:01 +0000 -- Dumping pages ... done
54+
2023-03-18 04:49:01 +0000 -- Dumping lfs objects ...
55+
2023-03-18 04:49:01 +0000 -- Dumping lfs objects ... done
56+
2023-03-18 04:49:01 +0000 -- Dumping terraform states ...
57+
2023-03-18 04:49:01 +0000 -- Dumping terraform states ... done
58+
2023-03-18 04:49:01 +0000 -- Dumping container registry images ... [DISABLED]
59+
2023-03-18 04:49:01 +0000 -- Dumping packages ...
60+
2023-03-18 04:49:01 +0000 -- Dumping packages ... done
61+
2023-03-18 04:49:01 +0000 -- Creating backup archive: 1679114897_2023_03_18_15.0.4_gitlab_backup.tar ...
62+
2023-03-18 04:49:14 +0000 -- Creating backup archive: 1679114897_2023_03_18_15.0.4_gitlab_backup.tar ... done
63+
2023-03-18 04:49:14 +0000 -- Uploading backup archive to remote storage ...
64+
[SKIPPED]
65+
2023-03-18 04:49:14 +0000 -- Deleting tar staging files ...
66+
2023-03-18 04:49:14 +0000 -- Cleaning up /var/opt/gitlab/backups/backup_information.yml
67+
2023-03-18 04:49:14 +0000 -- Cleaning up /var/opt/gitlab/backups/db
68+
2023-03-18 04:49:14 +0000 -- Cleaning up /var/opt/gitlab/backups/repositories
69+
2023-03-18 04:49:14 +0000 -- Cleaning up /var/opt/gitlab/backups/uploads.tar.gz
70+
2023-03-18 04:49:14 +0000 -- Cleaning up /var/opt/gitlab/backups/builds.tar.gz
71+
2023-03-18 04:49:14 +0000 -- Cleaning up /var/opt/gitlab/backups/artifacts.tar.gz
72+
2023-03-18 04:49:14 +0000 -- Cleaning up /var/opt/gitlab/backups/pages.tar.gz
73+
2023-03-18 04:49:14 +0000 -- Cleaning up /var/opt/gitlab/backups/lfs.tar.gz
74+
2023-03-18 04:49:14 +0000 -- Cleaning up /var/opt/gitlab/backups/terraform_state.tar.gz
75+
2023-03-18 04:49:14 +0000 -- Cleaning up /var/opt/gitlab/backups/packages.tar.gz
76+
2023-03-18 04:49:14 +0000 -- Deleting tar staging files ... done
77+
2023-03-18 04:49:14 +0000 -- Deleting old backups ... [SKIPPED]
78+
2023-03-18 04:49:14 +0000 -- Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data
79+
and are not included in this backup. You will need these files to restore a backup.
80+
Please back them up manually.
81+
2023-03-18 04:49:14 +0000 -- Backup 1679114897_2023_03_18_15.0.4 is done.
82+
```
83+
- ### Backup configuration and secret files
84+
- ### Entering container
85+
```bash
86+
docker exec -it gitlab bash
87+
```
88+
- `gitlab.rb` and `gitlab-secrets.json` locate in `/etc/gitlab/`
89+
```bash
90+
root@d44c48535c28:/# ls -al /etc/gitlab/
91+
total 172
92+
drwxrwxr-x 1 root root 322 Aug 4 2022 .
93+
drwxr-xr-x 1 root root 1362 Aug 4 2022 ..
94+
-rw------- 1 root root 19205 Sep 22 01:56 gitlab-secrets.json
95+
-rw------- 1 root root 130379 Feb 12 2022 gitlab.rb
96+
-rw------- 1 root root 505 Feb 10 2022 ssh_host_ecdsa_key
97+
-rwxrwxrwx 1 root root 173 Feb 10 2022 ssh_host_ecdsa_key.pub
98+
-rw------- 1 root root 399 Feb 10 2022 ssh_host_ed25519_key
99+
-rwxrwxrwx 1 root root 93 Feb 10 2022 ssh_host_ed25519_key.pub
100+
-rw------- 1 root root 2590 Feb 10 2022 ssh_host_rsa_key
101+
-rwxrwxrwx 1 root root 565 Feb 10 2022 ssh_host_rsa_key.pub
102+
drwxr-xr-x 1 root root 0 Feb 10 2022 trusted-certs
103+
```
104+
- Copy `gitlab.rb` and `gitlab-secrets.json`
105+
```bash
106+
root@d44c48535c28:/# cp /etc/gitlab/gitlab.rb /var/opt/gitlab/backups/gitlab.rb
107+
root@d44c48535c28:/# cp /etc/gitlab/gitlab-secrets.json /var/opt/gitlab/backups/gitlab-secrets.json
108+
```
109+
- ## Check backup
110+
- ```bash
111+
root@d44c48535c28:/# ls -lart /var/opt/gitlab/backups/
112+
total 2605248
113+
-rw------- 1 git git 1007308800 Aug 4 2022 1659582860_2022_08_04_14.7.2_gitlab_backup.tar
114+
drwxr-xr-x 1 root root 506 Sep 22 01:56 ..
115+
-rw------- 1 git git 1660313600 Mar 18 04:49 1679114897_2023_03_18_15.0.4_gitlab_backup.tar
116+
drwx------ 1 git root 240 Mar 18 04:49 .
117+
-rw------- 1 root root 130379 Mar 18 05:56 gitlab.rb
118+
-rw------- 1 root root 19205 Mar 18 05:56 gitlab-secrets.json
119+
```
120+
- ### Copy to Exterior Storage
121+
```bash
122+
Pointshare@PointNAS:/$ sudo docker cp gitlab:/var/opt/gitlab/backups /volume2/Personal/Dino/
123+
```
124+
- # Update Gitlab in docker
125+
[Update Gitlab in docker - A code to remember (copdips.com)](https://copdips.com/2018/10/update-gitlab-in-docker.html)
126+
- ## Backup (important)
127+
Refer to ((64153b91-5c7a-40a2-8298-a1019bc911fd))
128+
- ## Verify the docker container volumes
129+
- ```bash
130+
Pointshare@PointNAS:/$ sudo docker container inspect -f "{{ json .HostConfig
131+
.Binds }}" gitlab | python3 -m json.tool
132+
Password:
133+
[
134+
"/volume1/gitlab/log:/var/log/gitlab",
135+
"/volume1/gitlab/data:/var/opt/gitlab",
136+
"/volume1/gitlab/config:/etc/gitlab"
137+
]
138+
```
139+
- ### Update Gitlab docker version
140+
[GitLab Docker images | GitLab](https://docs.gitlab.com/ee/install/docker.html#upgrade-gitlab-to-newer-version)
141+
- Check previously specified options when creating the container
142+
```bash
143+
root@PointNAS:~# docker container ps
144+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
145+
d92ed934028e gitlab/gitlab-ce:latest "/assets/wrapper" 8 hours ago Up 7 hours (healthy) 443/tcp, 0.0.0.0:2222->22/tcp, 0.0.0.0:8080->80/tcp gitlab
146+
```
147+
- Pull new image
148+
`sudo docker pull gitlab/gitlab-ce:latest`
149+
- Stop old container
150+
`docker stop gitlab`
151+
- Remove old container
152+
`docker rm gitlab`
153+
- Create the container with same options when creating the old one
154+
```bash
155+
docker run --detach \
156+
--publish 8080:80 --publish 2222:22 \
157+
--name gitlab \
158+
--restart always \
159+
--volume /volume1/gitlab/log:/var/log/gitlab \
160+
--volume /volume1/gitlab/data:/var/opt/gitlab \
161+
--volume /volume1/gitlab/config:/etc/gitlab \
162+
gitlab/gitlab-ce:latest
163+
```
164+
- ## Other Related links
165+
- [Upgrading GitLab | GitLab](https://docs.gitlab.com/ee/update/)
166+
- [Upgrading GitLab without downtime](https://docs.gitlab.com/ee/update/#upgrading-without-downtime)
167+
- [Back up and restore GitLab | GitLab](https://docs.gitlab.com/ee/raketasks/backup_restore.html)
168+
-
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
public:: true
2+
3+
- {{renderer :tocgen}}
4+
- # Useful Command
5+
- Check doker container
6+
`doker container ps`
7+
- Check logs
8+
`docker logs -f gitlab`
9+
- Get into container with bash
10+
`docker exec -it gitlab bash`
11+
- # Backup Gitlab in docker
12+
id:: 64153b91-5c7a-40a2-8298-a1019bc911fd
13+
collapsed:: true
14+
[Backup and restore Gitlab in docker - A code to remember (copdips.com)](https://copdips.com/2018/09/backup-and-restore-gitlab-in-docker.html#backup-gitlab-in-docker)
15+
- ## Check backup path
16+
- ### Synology NAS
17+
```bash
18+
# depeneds on the space set for docker
19+
# locate Gitlab configuration file gitlab.rb
20+
21+
Pointshare@PointNAS:/$ sudo ls volume1/gitlab/config/
22+
Password:
23+
gitlab.rb ssh_host_ecdsa_key.pub ssh_host_rsa_key
24+
gitlab-secrets.json ssh_host_ed25519_key ssh_host_rsa_key.pub
25+
ssh_host_ecdsa_key ssh_host_ed25519_key.pub trusted-certs
26+
27+
# Locate backup_path
28+
29+
Pointshare@PointNAS:/$ sudo cat volume1/gitlab/config/gitlab.rb | grep backup_path
30+
# gitlab_rails['manage_backup_path'] = true
31+
# gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"
32+
# gitlab_rails['backup_gitaly_backup_path'] = "/opt/gitlab/embedded/bin/gitaly-backup"
33+
```
34+
- ## Create Backup
35+
- ### Backup
36+
```bash
37+
root@d44c48535c28:/# sudo docker exec -it gitlab gitlab-rake gitlab:backup:create
38+
2023-03-18 04:48:17 +0000 -- Dumping database ...
39+
Dumping PostgreSQL database gitlabhq_production ... [DONE]
40+
2023-03-18 04:48:25 +0000 -- Dumping database ... done
41+
2023-03-18 04:48:25 +0000 -- Dumping repositories ...
42+
.
43+
.
44+
.
45+
2023-03-18 04:48:45 +0000 -- Dumping repositories ... done
46+
2023-03-18 04:48:45 +0000 -- Dumping uploads ...
47+
2023-03-18 04:48:47 +0000 -- Dumping uploads ... done
48+
2023-03-18 04:48:47 +0000 -- Dumping builds ...
49+
2023-03-18 04:48:47 +0000 -- Dumping builds ... done
50+
2023-03-18 04:48:47 +0000 -- Dumping artifacts ...
51+
2023-03-18 04:49:01 +0000 -- Dumping artifacts ... done
52+
2023-03-18 04:49:01 +0000 -- Dumping pages ...
53+
2023-03-18 04:49:01 +0000 -- Dumping pages ... done
54+
2023-03-18 04:49:01 +0000 -- Dumping lfs objects ...
55+
2023-03-18 04:49:01 +0000 -- Dumping lfs objects ... done
56+
2023-03-18 04:49:01 +0000 -- Dumping terraform states ...
57+
2023-03-18 04:49:01 +0000 -- Dumping terraform states ... done
58+
2023-03-18 04:49:01 +0000 -- Dumping container registry images ... [DISABLED]
59+
2023-03-18 04:49:01 +0000 -- Dumping packages ...
60+
2023-03-18 04:49:01 +0000 -- Dumping packages ... done
61+
2023-03-18 04:49:01 +0000 -- Creating backup archive: 1679114897_2023_03_18_15.0.4_gitlab_backup.tar ...
62+
2023-03-18 04:49:14 +0000 -- Creating backup archive: 1679114897_2023_03_18_15.0.4_gitlab_backup.tar ... done
63+
2023-03-18 04:49:14 +0000 -- Uploading backup archive to remote storage ...
64+
[SKIPPED]
65+
2023-03-18 04:49:14 +0000 -- Deleting tar staging files ...
66+
2023-03-18 04:49:14 +0000 -- Cleaning up /var/opt/gitlab/backups/backup_information.yml
67+
2023-03-18 04:49:14 +0000 -- Cleaning up /var/opt/gitlab/backups/db
68+
2023-03-18 04:49:14 +0000 -- Cleaning up /var/opt/gitlab/backups/repositories
69+
2023-03-18 04:49:14 +0000 -- Cleaning up /var/opt/gitlab/backups/uploads.tar.gz
70+
2023-03-18 04:49:14 +0000 -- Cleaning up /var/opt/gitlab/backups/builds.tar.gz
71+
2023-03-18 04:49:14 +0000 -- Cleaning up /var/opt/gitlab/backups/artifacts.tar.gz
72+
2023-03-18 04:49:14 +0000 -- Cleaning up /var/opt/gitlab/backups/pages.tar.gz
73+
2023-03-18 04:49:14 +0000 -- Cleaning up /var/opt/gitlab/backups/lfs.tar.gz
74+
2023-03-18 04:49:14 +0000 -- Cleaning up /var/opt/gitlab/backups/terraform_state.tar.gz
75+
2023-03-18 04:49:14 +0000 -- Cleaning up /var/opt/gitlab/backups/packages.tar.gz
76+
2023-03-18 04:49:14 +0000 -- Deleting tar staging files ... done
77+
2023-03-18 04:49:14 +0000 -- Deleting old backups ... [SKIPPED]
78+
2023-03-18 04:49:14 +0000 -- Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data
79+
and are not included in this backup. You will need these files to restore a backup.
80+
Please back them up manually.
81+
2023-03-18 04:49:14 +0000 -- Backup 1679114897_2023_03_18_15.0.4 is done.
82+
```
83+
- ### Backup configuration and secret files
84+
- ### Entering container
85+
```bash
86+
docker exec -it gitlab bash
87+
```
88+
- `gitlab.rb` and `gitlab-secrets.json` locate in `/etc/gitlab/`
89+
```bash
90+
root@d44c48535c28:/# ls -al /etc/gitlab/
91+
total 172
92+
drwxrwxr-x 1 root root 322 Aug 4 2022 .
93+
drwxr-xr-x 1 root root 1362 Aug 4 2022 ..
94+
-rw------- 1 root root 19205 Sep 22 01:56 gitlab-secrets.json
95+
-rw------- 1 root root 130379 Feb 12 2022 gitlab.rb
96+
-rw------- 1 root root 505 Feb 10 2022 ssh_host_ecdsa_key
97+
-rwxrwxrwx 1 root root 173 Feb 10 2022 ssh_host_ecdsa_key.pub
98+
-rw------- 1 root root 399 Feb 10 2022 ssh_host_ed25519_key
99+
-rwxrwxrwx 1 root root 93 Feb 10 2022 ssh_host_ed25519_key.pub
100+
-rw------- 1 root root 2590 Feb 10 2022 ssh_host_rsa_key
101+
-rwxrwxrwx 1 root root 565 Feb 10 2022 ssh_host_rsa_key.pub
102+
drwxr-xr-x 1 root root 0 Feb 10 2022 trusted-certs
103+
```
104+
- Copy `gitlab.rb` and `gitlab-secrets.json`
105+
```bash
106+
root@d44c48535c28:/# cp /etc/gitlab/gitlab.rb /var/opt/gitlab/backups/gitlab.rb
107+
root@d44c48535c28:/# cp /etc/gitlab/gitlab-secrets.json /var/opt/gitlab/backups/gitlab-secrets.json
108+
```
109+
- ## Check backup
110+
- ```bash
111+
root@d44c48535c28:/# ls -lart /var/opt/gitlab/backups/
112+
total 2605248
113+
-rw------- 1 git git 1007308800 Aug 4 2022 1659582860_2022_08_04_14.7.2_gitlab_backup.tar
114+
drwxr-xr-x 1 root root 506 Sep 22 01:56 ..
115+
-rw------- 1 git git 1660313600 Mar 18 04:49 1679114897_2023_03_18_15.0.4_gitlab_backup.tar
116+
drwx------ 1 git root 240 Mar 18 04:49 .
117+
-rw------- 1 root root 130379 Mar 18 05:56 gitlab.rb
118+
-rw------- 1 root root 19205 Mar 18 05:56 gitlab-secrets.json
119+
```
120+
- ### Copy to Exterior Storage
121+
```bash
122+
Pointshare@PointNAS:/$ sudo docker cp gitlab:/var/opt/gitlab/backups /volume2/Personal/Dino/
123+
```
124+
- # Update Gitlab in docker
125+
[Update Gitlab in docker - A code to remember (copdips.com)](https://copdips.com/2018/10/update-gitlab-in-docker.html)
126+
- ## Backup (important)
127+
Refer to ((64153b91-5c7a-40a2-8298-a1019bc911fd))
128+
- ## Verify the docker container volumes
129+
- ```bash
130+
Pointshare@PointNAS:/$ sudo docker container inspect -f "{{ json .HostConfig
131+
.Binds }}" gitlab | python3 -m json.tool
132+
Password:
133+
[
134+
"/volume1/gitlab/log:/var/log/gitlab",
135+
"/volume1/gitlab/data:/var/opt/gitlab",
136+
"/volume1/gitlab/config:/etc/gitlab"
137+
]
138+
```
139+
- ### Update Gitlab docker version
140+
[GitLab Docker images | GitLab](https://docs.gitlab.com/ee/install/docker.html#upgrade-gitlab-to-newer-version)
141+
- Check previously specified options when creating the container
142+
```bash
143+
root@PointNAS:~# docker container ps
144+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
145+
d92ed934028e gitlab/gitlab-ce:latest "/assets/wrapper" 8 hours ago Up 7 hours (healthy) 443/tcp, 0.0.0.0:2222->22/tcp, 0.0.0.0:8080->80/tcp gitlab
146+
```
147+
- Pull new image
148+
`sudo docker pull gitlab/gitlab-ce:latest`
149+
- Stop old container
150+
`docker stop gitlab`
151+
- Remove old container
152+
`docker rm gitlab`
153+
- Create the container with same options when creating the old one
154+
```bash
155+
docker run --detach \
156+
--publish 8080:80 --publish 2222:22 \
157+
--name gitlab \
158+
--restart always \
159+
--volume /volume1/gitlab/log:/var/log/gitlab \
160+
--volume /volume1/gitlab/data:/var/opt/gitlab \
161+
--volume /volume1/gitlab/config:/etc/gitlab \
162+
gitlab/gitlab-ce:latest
163+
```
164+
- ## Other Related links
165+
- [Upgrading GitLab | GitLab](https://docs.gitlab.com/ee/update/)
166+
- [Upgrading GitLab without downtime](https://docs.gitlab.com/ee/update/#upgrading-without-downtime)
167+
- [Back up and restore GitLab | GitLab](https://docs.gitlab.com/ee/raketasks/backup_restore.html)
168+
-

logseq/bak/pages/VS_Code/2023-07-27T09_41_25.292Z.Desktop.md logseq/bak/pages/VS_Code/2024-12-08T07_00_02.207Z.Desktop.md

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
public:: true
12
title:: VS_Code
23
#vscode
3-
{{renderer :tocgen2}}
44

5-
- # VS Code
65
- ## Navigate
76
collapsed:: true
87
[42 Visual Studio Code Shortcuts for Boosting Your Productivity](https://www.sitepoint.com/visual-studio-code-keyboard-shortcuts/)
@@ -27,12 +26,7 @@ title:: VS_Code
2726
Then the terminal can be focus with `Ctrl` + `KEY_YOU_DEFINE`
2827
-
2928
- ## Git with vscode
30-
- ## Extensions
31-
- ### Git Graph
32-
- ### GitLens
3329
- ## git clone
34-
- ## git merge
35-
-
3630
- ## Coo-work Tips
3731
- ### Recommended extesion
3832
`ctrl + shift + P` and type `Extensions: Configure Recommended Extensions (Workspace)`

0 commit comments

Comments
 (0)