LoginSignup
0
1

More than 5 years have passed since last update.

digital ocean でnode.jsサーバー立てるまで

Last updated at Posted at 2014-12-09

ターミナルからログイン

  1. ssh root@IP
  2. ドロップレット作成時にアカウント宛に届いたパスを入力
  3. パスワード変更

環境構築

  1. sudo apt-get update
  2. sudo apt-get install nodejs
  3. sudo apt-get install npm
  4. sudo apt-get install git

gitデプロイつなぎ込み

解説記事

  1. /var/repo/site.git/ を作成して git init —bare
  2. /var/repo/site.git/hooks/ へ移動
  3. cat > post-receivepost-receiveファイルを作成
  4. vimモードにするなどして以下記入:xで保存
    #!/bin/sh
    git --work-tree=/var/www/ディレクトリ名 --git-dir=/var/repo/site.git checkout -f
  5. chmod +x post-receive

  6. ローカルレポジトリにgitパスをつなぎ込み
    ssh://root@IP/var/repo/site.git

  7. SSHキーの登録(新規アカウント作成時のみ)

  8. プッシュしてデプロイ

サーバー永続化

npmpm2をインストール
pm2 start app.js でサーバー永続化

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1