Jhernandez has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/374975 )

Change subject: Docs: Add periodic updates to staging server guide
......................................................................

Docs: Add periodic updates to staging server guide

Add notes about periodically updating the server via cron jobs, and
a caveats section to explain the issues with the current implementation.

Change-Id: I61a82e8e5629fb8da898eca527899b9a6296c493
---
M docs/setting-a-staging-server.md
1 file changed, 48 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/marvin refs/changes/75/374975/1

diff --git a/docs/setting-a-staging-server.md b/docs/setting-a-staging-server.md
index 9822f96..b85612f 100644
--- a/docs/setting-a-staging-server.md
+++ b/docs/setting-a-staging-server.md
@@ -152,8 +152,9 @@
 echo "Running post-merge hook"
 
 echo "Installing and building server bundle"
-npm install
-npm run build
+# Use our newer install of npm:
+/usr/local/bin/npm install
+/usr/local/bin/npm run build
 
 echo "Removing previously started server processes"
 killall node || true
@@ -190,4 +191,48 @@
 Server started on http://localhost:8080/
 ```
 
-Then you should be able to access your site from the browser!
\ No newline at end of file
+Then you should be able to access your site from the browser!
+
+## 5. Auto updating the repository
+
+Let's set up a cron job to auto-update the repository every 5 minutes. For 
that,
+as the **marvin** user, run `crontab -e`, and add this line at the end:
+
+```
+*/5 * * * * cd /home/marvin/sources && git pull >> /home/marvin/cron.log 2>&1
+```
+
+Every five minutes, a git pull will be done in the repo, and the log will be
+written in `/home/marvin/cron.log`.
+
+After you save, wait for 5 minutes and check the log file, you should see a log
+of the cron run, like this:
+
+```
+Already up-to-date.
+```
+
+Everything should be ready to go.
+
+## Notes and caveats
+
+This is a raw setup, so if any exceptions rise from your node server, the
+process will die, and the service won't be available. Same will happen if the
+server is rebooted.
+
+Right now we're not saving the logs anywhere so it may be difficult to debug if
+a problem comes up.
+
+We may improve this setup later by using some process runner like pm2 or
+forever, and when we do so we will update this guide.
+
+If you have to restart the process, you can use the git hook to restart it:
+
+```
+$ sudo su marvin
+marvin@marvin-staging:~$ cd ~/sources
+marvin@marvin-staging:~/sources$ ./.git/hooks/post-merge
+```
+
+That will trigger a full re-install, re-build, and launch the process back up
+again.
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/374975
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I61a82e8e5629fb8da898eca527899b9a6296c493
Gerrit-PatchSet: 1
Gerrit-Project: marvin
Gerrit-Branch: master
Gerrit-Owner: Jhernandez <jhernan...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to