Skip to content

Instantly share code, notes, and snippets.

@bijanebrahimi
Last active February 20, 2017 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bijanebrahimi/1e82665510dddae70a15b05a012af3b1 to your computer and use it in GitHub Desktop.
Save bijanebrahimi/1e82665510dddae70a15b05a012af3b1 to your computer and use it in GitHub Desktop.
Enable graphviz on gitlab markdown language
$ nano /etc/gitlab/gitlab.rb
nginx['custom_nginx_config'] = "include /var/opt/gitlab/nginx/conf/webtools.zharfpouyan.net;"
$ nano /var/opt/gitlab/nginx/conf/webtools.zharfpouyan.net
server {
listen *:80;
server_name webtools.zharfpouyan.net;
access_log /var/log/webtools.zharfpouyan.net.access.log;
error_log /var/log/webtools.zharfpouyan.net.error.log;
location / {
proxy_pass http://127.0.0.1:8090;
}
}
$ apt-get install apache2 libapache2-mod-php5 graphviz
$ nano /etc/apache2/ports.conf
Listen 8090
$ nano /etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:8090>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/webtools.zharfpouyan.net
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
$ nano /var/www/webtools.zharfpouyan.net/graphviz/index.php
<?php
$dot_content = rawurldecode($_SERVER['QUERY_STRING']);
$dot_file = tempnam("/tmp", "dot_");
file_put_contents($dot_file, $dot_content);
header('Content-type: image/svg+xml');
system("dot -Tsvg ".$dot_file);
unlink($dot_file);
?>
$ nano /etc/hosts
192.168.0.40 webtools.zharfpouyan.net
![Alt Image](http://webtools.zharfpouyan.net/graphviz/?
digraph G {
aize ="4,4";
main [shape=box];
main -> parse [weight=8];
parse -> execute;
main -> init [style=dotted];
main -> cleanup;
execute -> { make_string; printf};
init -> make_string;
edge [color=red];
main -> printf [style=bold,label="100 times"];
make_string [label="make a string"];
node [shape=box,style=filled,color=".7 .3 1.0"];
execute -> compare;
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment