履歴: オンプレGitLabでgit+CI+npmサーバー2024

各行は、その日時に書かれた内容です。追加・削除は、1 つ前の版との行数の差です (全 15 版)。「差分」は比較する版、「基準」は比べる相手の版を選びます

日時タイトル文字数追加削除内容差分基準
2024/10/11 18:39:53オンプレGitLabでgit+CI+npmサーバー2024 最新版40,236+1 -1表示差分—
2024/10/11 18:39:53オンプレGitLabでgit+CI+npmサーバー2024 40,242+5 -2表示差分選択
2024/9/21 9:34:07オンプレGitLabでgit+CI+npmサーバー2024 40,114+46 -2表示差分選択
2024/9/10 19:22:18オンプレGitLabでgit+CI+npmサーバー2024 39,136+13 -7表示差分選択
2024/9/10 17:24:01オンプレGitLabでgit+CI+npmサーバー2024 38,907+119 -2表示差分選択
2024/9/9 10:31:44オンプレGitLabでgit+CI+npmサーバー2024 36,273+15 -5表示差分選択
2024/9/9 8:03:14オンプレGitLabでgit+CI+npmサーバー2024 36,083+30 -8表示差分選択
2024/9/9 2:20:03オンプレGitLabでgit+CI+npmサーバー2024 35,619+166 -18表示差分選択
2024/9/8 19:19:09オンプレGitLabでgit+CI+npmサーバー2024 31,171+129 -1表示差分選択
2024/9/8 12:41:21オンプレGitLabでgit+CI+npmサーバー2024 27,587+474 -6表示差分選択
2024/9/7 22:45:54オンプレGitLabでgit+CI+npmサーバー2024 14,324+27 -2表示差分選択
2024/9/7 22:12:54オンプレGitLabでgit+CI+npmサーバー2024 13,784+307 -44表示差分選択
2024/9/7 10:39:10オンプレGitLabでgit+CI+npmサーバー2024 5,232+17 -5表示差分選択
2024/9/7 1:22:49オンプレGitLabでgit+CI+npmサーバー2024 5,096+50 -23表示表示中選択
2024/9/7 0:49:18オンプレGitLabでgit+CI+npmサーバー2024 4,572— —表示—基準

基準: オンプレGitLabでgit+CI+npmサーバー2024 (2024/9/7 0:49:18) → 比較: オンプレGitLabでgit+CI+npmサーバー2024 (2024/9/7 1:22:49)

@@ -1,7 +1,7 @@
-#author("2024-09-06T15:49:18+00:00","default:administrator","administrator")
+#author("2024-09-06T16:22:49+00:00","default:administrator","administrator")
[[プログラミング/svelte]]
-* 自前サーバーで GitLab を動かしてプライベートなプロジェクトを置きたい [#p3da9108]
+* 自前サーバーで GitLab を動かしてプライベートな npm プロジェクトなどを置きたい [#p3da9108]
GitLab は、
@@ -17,6 +17,9 @@
Docker を使ってサクッと動かす。(動かせるといいな)
+** 目次 [#xea030b5]
+
+#contents
* GitLab サーバーを docker compose で動かす [#bf994d2a]
https://gitlab-docs.creationline.com/ee/install/docker.html#install-gitlab-using-docker-compose
@@ -27,8 +30,9 @@
- サーバーには apache2 が https://myserver.com/ への通信を受け付ける状況になっている
- gitlab は https://myserver.com/gitlab/ というアドレスで動かす
-という条件で、GitLab を動かすのは非常に簡単でした。
+という条件で GitLab を動かします。。
+ LANG:console
$ cd ~
$ mkdir gitlab
$ cd gitlab
@@ -44,7 +48,7 @@
external_url 'https://myserver.com/gitlab'
gitlab_rails['gitlab_shell_ssh_port'] = 2224
ports:
- - '8929:80'
+ - '8980:80'
volumes:
- '$GITLAB_HOME/etc:/etc/gitlab'
- '$GITLAB_HOME/log:/var/log/gitlab'
@@ -83,8 +87,8 @@
Allow from all
</Location>
RequestHeader set X_FORWARDED_PROTO 'https'
- ProxyPass /gitlab http://localhost:8929/gitlab
- ProxyPassReverse /gitlab http://localhost:8929/gitlab
+ ProxyPass /gitlab http://localhost:8980/gitlab
+ ProxyPassReverse /gitlab http://localhost:8980/gitlab
</IfModule>
と設定して、
@@ -93,6 +97,9 @@
$ sudo a2enmod proxy
$ sudo service apache2 reload
+とすることで apache2 がプロキシサーバーとして振る舞い、
+https://myserver.com/gitlab 以下へのアクセスを http://localhost:8929/gitlab へ転送してくれる。
+
結構重要なのが AllowEncodedSlashes NoDecode だ。
これをしておかないと GitLab を npm サーバーとして使う際に、パッケージリポジトリへの PUT が 404 で失敗する。
@@ -110,26 +117,10 @@
npm error 404 Note that you can also install from a
npm error 404 tarball, folder, http url, or git url.
-npm publish で認証は通過しているのに、そして、アップロードしようとしているのに 404 で落ちるていたらこの設定を見直すといい。
+のように、npm publish で認証は通過しているのに、そして、アップロードしようとしているのに 404 で落ちるていたらこの設定を見直すといい。
-* root でログインする [#u468af48]
-初期設定で root という管理者ユーザーが登録されているので、
-ウェブサーバーから https://myserver.com/gitlab へアクセスして root でログインする。
-管理者 root の初期パスワードは gitlab の docker-compose.yml を作ったフォルダの下の etc フォルダを調べるとわかる。
-
- LANG:console
- $ sudo cat etc/initial_root_password
-
-* ユーザーを登録する [#re2d726c]
-
-https://myserver.com/gitlab/admin/users
-
-ここでユーザーを登録できる。
-
-と、その前にメールを送れるように設定する。
-
* メールを送れるように設定する [#aa2a5159]
ホストで exim4 が動いていて、正しくメールが送れているとする。
@@ -156,12 +147,23 @@
を設定した。
+* root でログインする [#u468af48]
+
+初期設定で root という管理者ユーザーが登録されているので、
+ウェブサーバーから https://myserver.com/gitlab へアクセスして root でログインする。
+
+管理者 root の初期パスワードは gitlab の docker-compose.yml を作ったフォルダの下の etc フォルダを調べるとわかる。
+
+ LANG:console
+ $ sudo cat etc/initial_root_password
+
* root のパスワードを忘れてしまった場合 [#p77da698]
https://blog.k-bushi.com/post/tech/environment/construct-gitlab-runner-docker/#gitlab%E3%81%B8%E3%81%AE%E3%83%AD%E3%82%B0%E3%82%A4%E3%83%B3
にあるように、
+ LANG:console
$ docker compose exec web gitlab-rake "gitlab:password:reset"
Enter username: root
Enter password:
@@ -171,3 +173,28 @@
とすればパスワードを設定しなおせるらしい。
* runner も docker で動かす [#a35f227c]
+
+同時に使用する人数と比較するとこのサーバーには余裕があるので、
+CI サーバーも同じホストで動かしてしまう。
+
+先の docker-compose.yml に以下を追加する。
+
+ runner:
+ image: 'gitlab/gitlab-runner:latest'
+ restart: unless-stopped
+ volumes:
+ - '$GITLAB_HOME/runner:/etc/gitlab-runner'
+ - /var/run/docker.sock:/var/run/docker.sock
+ ports:
+ - '8093:8093'
+
+そして、
+
+ LANG:console
+ $ sudo docker compose up -d
+
+* runner を GitLab に追加する [#k5e1dceb]
+
+https://myserver.com/gitlab/admin/runners
+
+から