User:Waldyrious/Toolforge
Appearance
What is toolforge
[edit]- wikitech:About Toolforge#What is Toolforge?
- wikitech:Help:Cloud Services Introduction#WMCS products and services
Getting started
[edit]- wikitech:Portal:Toolforge#Toolforge quickstart
- wikitech:Help:Getting Started#Get started with Toolforge
How-to
[edit]- Using Github or other external service
- Auto-update a tool from GitHub
- TODO: figure out if it's possible to also sync a GitHub repo with a Phabricator Diffusion clone. E.g. the Wikidata Lexeme Forms tool (phabricator, github)
- How to commit using the user account
- If you configure your git credentials in your user account, but then clone a repo within a tool's acount (after
become
ing that tool), then your user won't have permissions to make commits. - If you add the credentials to the tool's account, then any maintainer that accesses that tool would commit with your credentials
- The solution is to make the git repo's directory writable by others:
ssh USER@login.toolforge.org
become MYTOOL
chmod -R a+w path/to/repo
- If you configure your git credentials in your user account, but then clone a repo within a tool's acount (after
- Web Service Introduction
ssh USER@login.toolforge.org
become MYTOOL
git clone https://github.com/USER/REPO ~/public_html
webservice start
- Website will be available at https://MYTOOL.toolforge.org
- Static file server
ssh USER@login.toolforge.org
become MYTOOL
mkdir ~/www
git clone https://github.com/USER/REPO ~/www/static
- Website will be available at https://tools-static.wmflabs.org/MYTOOL/
- See link above to set up auto-updating of the repo
Toolserver
[edit]Toolforge sort of replaces the old Toolserver.
The archived homepage for my account there can be found at toolserver:~waldir.
Archive of the contents:
index.php
[edit]Note: this is a condensed version, to highlight the PHP code. See the full contents here.
<!DOCTYPE HTML>
<?php $live = ($_SERVER['SERVER_NAME'] == "toolserver.org"); ?>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Waldir's Wikimedia tools</title>
<style type="text/css">/* ...SNIP... */</style>
</head>
<body>
<?php if($live) { ?>
<form action="update.php" style="float: right;">
<button type="submit">Update</button>
</form>
<?php } ?>
<h1><a href="https://wiki.toolserver.org/view/User:Waldir">Waldir</a>'s
Wikimedia tools</h1>
<!-- ...SNIP... -->
<div id="footer">
<b><a href="https://wiki.toolserver.org/view/User:Waldir">Waldir</a>'s Wikimedia tools: </b>
<a href="https://fisheye.toolserver.org/browse/waldir">browse svn</a> |
<a href="javascript:alert('svn checkout https://svn.toolserver.org/svnroot/waldir');">fork</a> |
<?php if($live) { ?>
<a href="https://fisheye.toolserver.org/browse/<?=str_replace('/~','',$_SERVER['SCRIPT_NAME']);?>?r=HEAD">view source of this page/tool</a> |
<?php } ?>
<a href="http://validator.w3.org/check?uri=referer">valid html5</a>
</div>
</body>
</html>
update.php
[edit]<?php
// Note: for debugging purposes, one can see the output of a shell command by doing:
// echo shell_exec('2>&1 command');
if($_SERVER['SERVER_NAME'] == "toolserver.org")
{
shell_exec('svn export https://svn.toolserver.org/svnroot/waldir . --force');
shell_exec('chmod --recursive a+w .');
}
header("Location: {$_SERVER['HTTP_REFERER']}");
?>
notes.txt
[edit]I should be able to add a post commit hook to perform a svn export (probably by logging in to ssh and doing the command there?) - See http://svnbook.red-bean.com/en/1.1/ch05s02.html#svn-ch-5-sect-2.1 for info on svn hook scripts. - See https://jira.toolserver.org/browse/TS-301 for a sample request to add a post-commit hook Otherwise, I need to manually login to ssh and run "svn export https://svn.toolserver.org/svnroot/waldir public_html --force" **Update**: I managed to make it work with a simple update script: php calls svn export. See update.php's source code. Note that for it to work, you need to initially set public_html (or whatever directory you're planning to export to) to be writable by everyone, by doing: chmod a+w public_html
wiki-userpage.txt
[edit]Source code | Rendered |
---|---|
[[m:user:waldir|Waldir@meta.wikimedia]] ---- * http://toolserver.org/~waldir/ * svn: https://fisheye.toolserver.org/browse/waldir (repo: https://svn.toolserver.org/svnroot/waldir) * [[Getting started]] * [[Toolserver Intuition]] (for tool translation) * To learn: How to run bots from ts? == Random notes == To copy files from local to the toolserver: $ scp /path/to/local/file.ext waldir@login.toolserver.org:/path/to/remote/directory # remote path relative to home I copied .bashrc and .bash_aliases, but they didn't seem to have any effect. This solved the issue: $ source .barshrc (that also reloaded .bash_aliases) * However, something broke: common commands (svn, nano) failed with stuff like "no svn in /sge62/bin/sol-amd64 /usr/bin ." O.o |
Random notes[edit]To copy files from local to the toolserver: $ scp /path/to/local/file.ext waldir@login.toolserver.org:/path/to/remote/directory # remote path relative to home I copied .bashrc and .bash_aliases, but they didn't seem to have any effect. This solved the issue: $ source .barshrc (that also reloaded .bash_aliases)
|