Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Misskey install shell script v1.0.0
Install Misskey with one shell script!
You can install misskey on an Ubuntu server just by answering some questions.
There is also an update script.
[**日本語版はこちら**](./README.md)
## Ingredients
1. A Domain
2. An Ubuntu Server
3. A Cloudflare Account (recommended)
## Procedures
### 1. SSH
Connect to the server via SSH.
(If you have the desktop open, open the shell.)
### 2. Clean up
Make sure all packages are up to date and reboot.
```
sudo apt update; sudo apt full-upgrade -y; sudo reboot
```
### 3. Start the installation
Reconnect SSH and let's start installing Misskey.
```
wget https://raw.githubusercontent.com/joinmisskey/bash-install/main/ubuntu.sh -O ubuntu.sh; sudo bash ubuntu.sh
```
### 4. To update
There is also an update script.
First, download the script.
```
wget https://raw.githubusercontent.com/joinmisskey/bash-install/main/update.ubuntu.sh -O update.sh
```
Run it when you want to update Misskey.
```
sudo bash update.sh
```
- In the systemd environment, the `-r` option can be used to update and reboot the system.
- In the docker environment, you can specify repository:tag as an argument.
## Environments in which the operation was tested
### Oracle Cloud Infrastructure
This script runs well on following compute shapes complemented by Oracle Cloud Infrastructure Always Free services.
- VM.Standard.E2.1.Micro (AMD)
- VM.Standard.A1.Flex (ARM) [1OCPU RAM6GB or greater]
## Issues & PRs Welcome
If it does not work in the above environment, it may be a bug. We would appreciate it if you could report it as an issue, with the specified requirements you entered to the script.
It is difficult to provide assistance for environments other than the above, but we may be able to solve your problem if you provide us with details of your environment.
Suggestions for features are also welcome.
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# Tips
仕様や選択肢の選び方など。
## Systemd or Docker?
v1から、インストールメソッドにsystemdとDockerとを選べるようにしました。
Dockerと言っても、**MisskeyだけをDockerで実行**し、RedisやPostgresなどはホストで直接実行します。
[docker-composeですべての機能を動かす方法については、mamemonongaさんが作成したこちらの記事がおすすめです。](https://gist.github.com/mamemomonga/5549bb69cad8e5618e5527593d4890e0)
Docker Hubイメージを使う設定であれば、Misskeyのビルドが不要になるため、**一番お勧めです**。
ただし、マイグレーションは必要なので、Misskeyを使えない時間がゼロになるわけではありません。
また、Misskeyのビルド環境を準備しない(git pullしない)ので、フォークを動かしたくなった時に設定が面倒になります。
ローカルでDockerをビルドする方式は、パフォーマンス面で非推奨です。
systemdは、Docker Hubにイメージを上げるまでもないものの、フォークを使いたい場合にお勧めです。
お勧めする順番は次の通りです。
1. Docker Hub
2. systemd
3. Dockerビルド
## .envファイルについて
インストールスクリプトは、2つの.envファイルを作成します。
アップデートの際に使用します。
### /root/.misskey.env
misskeyを実行するユーザーを覚えておくために必要です。
### /home/(misskeyユーザー)/.misskey.env
systemdの場合に生成されます。
主にディレクトリを覚えておくのに使用します。
### /home/(misskeyユーザー)/.misskey-docker.env
Dockerの場合に生成されます。
実行されているコンテナとイメージの番号を保存しています。
コンテナの番号はアップデートの際に更新されます。古いイメージは削除されます。
## 自分で管理する
インストール後、構成を変更する際に役立つはずのメモです。
"example.com"を自分のドメインに置き換えて読んでください。
### Misskeyディレクトリ
Misskeyのソースは`/home/ユーザー/ディレクトリ`としてcloneされます。
(ユーザー、ディレクトリの初期値はともにmisskeyです。)
Misskeyディレクトリへは、以下のように移動するとよいでしょう。
```
sudo su - ユーザー
cd ディレクトリ
```
もとのユーザーに戻るにはexitを実行します。
```
exit
```
### systemd
systemdのプロセス名はexample.comです。
たとえば再起動するには次のようにします。
```
sudo systemctl restart example.com
```
journalctlでログを確認できます。
```
journalctl -t example.com
```
設定ファイルは`/etc/systemd/system/example.com.service`として保存されています。
### Docker
DockerはMisskeyユーザーでrootless実行されています。
sudo suでMisskeyユーザーに入るときは、`XDG_RUNTIME_DIR`と`DOCKER_HOST`を変更する必要があります。
```
sudo su - ユーザー
export XDG_RUNTIME_DIR=/run/user/$UID
export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock
docker ps
```
### nginx
nginxの設定は`/etc/nginx/conf.d/example.com.conf`として保存されています。
### Redis
requirepassとbindを`/etc/redis/misskey.conf`で設定しています。
## Q. アップデート後に502でアクセスできない
アップデート後にアクセスできない、ということが稀にあります。
スクリプトのバグはともかくとして、一般的に一番多い理由は、yarn installに失敗している場合です。
Misskeyディレクトリで次の内容を実行し、もう一度アップデートを実行してみてください。
```
npm run cleanall
```
journalctlでログを確認すると、たいていre2が云々という記述が見当たります。
## Q. 同じサーバーにもう1つMisskeyを建てたい
スクリプトは同じサーバーに追加でMisskeyをインストールすることは想定していません。
幾つかの設定が上書きされるか、途中でエラーになってしまうでしょう。