Posts


Below is a bash script that will automatically configure nginx to work with mono to display mvc5 razor or web form sites.

Note that the script assumes you have a clean install. If the default nginx config file as been modified this will not work.

You will need to replace “examplesite.com” with the name of your site.

Tools used:

  • Ubuntu 14.04
  • Mono 3.2.8
  • Nginx 1.4.6
  • Upstart

The scripts installs nginx, mono, modifies the nginx default config file to support mono fastcgi and creates an upstart service to start and monitor the site.

For more details see the following pages.

  • http://www.mono-project.com/FastCGI_Nginx
  • http://wiki.nginx.org/Mono
  • http://sourcecodebean.com/archives/serving-your-asp-net-mvc-site-on-nginx-fastcgi-mono-server4/1617
  • https://github.com/ServiceStack/ServiceStack/wiki/Run-ServiceStack-in-Fastcgi-hosted-on-nginx
configuremono()
{

	apt-get install -y mono-devel libmono-sqlite4.0-cil sqlite3 libmysql6.4-cil 

	echo "configure /etc/mono/registry for use with MVC5"
	rm -rf /etc/mono/registry
	mkdir /etc/mono/registry
	mkdir /etc/mono/registry/LocalMachine
	chmod g+rwx /etc/mono/registry/
	chmod g+rwx /etc/mono/registry/LocalMachine
}


configurenginxbasic()
{

	apt-get install -y nginx mono-fastcgi-server
	rm -rf /var/www
	mkdir /var/www
	ln -fs /vagrant/published-site /var/www/examplesite.com

	# clear default site contents
	# cp /etc/nginx/sites-enabled/default /etc/nginx/sites-enabled/default-backup
	> /etc/nginx/sites-enabled/default

	# config server port 80 with mono
	echo "server {" >> /etc/nginx/sites-enabled/default
	echo "listen 80 default_server;" >> /etc/nginx/sites-enabled/default
	echo "listen [::]:80 default_server ipv6only=on;" >> /etc/nginx/sites-enabled/default
	echo "root /var/www/examplesite.com/;" >> /etc/nginx/sites-enabled/default
	echo "index index.html index.htm default.aspx Default.aspx Index.aspx index.aspx;" >> /etc/nginx/sites-enabled/default
	echo "server_name www.examplesite.com;" >> /etc/nginx/sites-enabled/default
	echo "location / {" >> /etc/nginx/sites-enabled/default
	echo "root /var/www/examplesite.com/;" >> /etc/nginx/sites-enabled/default
	echo "fastcgi_pass 127.0.0.1:9000;" >> /etc/nginx/sites-enabled/default
	echo "include /etc/nginx/fastcgi_params;" >> /etc/nginx/sites-enabled/default
	echo "index index.html index.htm default.aspx Default.aspx Index.aspx index.aspx;" >> /etc/nginx/sites-enabled/default
	echo "}" >> /etc/nginx/sites-enabled/default
	echo "}" >> /etc/nginx/sites-enabled/default
	#\ntry_files $uri $uri/ =404;

	service nginx reload

	# upstart service script
	touch /etc/nginx/startexamplesite
	echo "#!/bin/bash" >> /etc/nginx/startexamplesite
	echo "fastcgi-mono-server4 /applications=/:/var/www/examplesite.com/ /socket=tcp:127.0.0.1:9000" >> /etc/nginx/startexamplesite
	
	# group www-data will need access and execute permissions for the upstart service to be able to bring up fast cgi
	# See https://github.com/ServiceStack/ServiceStack/wiki/Run-ServiceStack-in-Fastcgi-hosted-on-nginx
	chgrp www-data /etc/nginx/startexamplesite
	chmod g+rwx /etc/nginx/startexamplesite

	#fastcgi-mono-server4 /applications=/:/var/www/examplesite.com/ /socket=unix:/tmp/fastcgi.socket
	#fastcgi-mono-server4 /applications=/:/var/www/examplesite.com/ /socket=tcp:127.0.0.1:9000
	touch /etc/init/examplesite.conf
	echo "#!upstart" >> /etc/init/examplesite.conf
	echo "description \"example site services\"" >> /etc/init/examplesite.conf
	echo "author \"Peter\"" >> /etc/init/examplesite.conf
	echo "" >> /etc/init/examplesite.conf
	echo "start on startup" >> /etc/init/examplesite.conf
	echo "stop on shutdown" >> /etc/init/examplesite.conf
	echo "" >> /etc/init/examplesite.conf
	echo "respawn" >> /etc/init/examplesite.conf
	echo "" >> /etc/init/examplesite.conf
	echo "script" >> /etc/init/examplesite.conf
	echo "echo \$\$ > /var/run/examplesite.pid" >> /etc/init/examplesite.conf
	echo "exec /etc/nginx/startexamplesite 2>&1" >> /etc/init/examplesite.conf
	echo "end script" >> /etc/init/examplesite.conf
	echo "" >> /etc/init/examplesite.conf
	echo "pre-start script" >> /etc/init/examplesite.conf
	echo "echo \"[`date`] (sys) Starting\" >> /var/log/examplesite.sys.log" >> /etc/init/examplesite.conf
	echo "end script" >> /etc/init/examplesite.conf
	echo "" >> /etc/init/examplesite.conf
	echo "pre-stop script" >> /etc/init/examplesite.conf
	echo "rm /var/run/examplesite.pid" >> /etc/init/examplesite.conf
	echo "echo \"[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Stopping\" >> /var/log/examplesite.sys.log" >> /etc/init/examplesite.conf
	echo "end script" >> /etc/init/examplesite.conf

	service examplesite start	
	#bash /etc/nginx/startexamplesite &
	service nginx start
	
}

configuremono
configurenginxbasic

If you want to see how to create an initial mvc5 razor site see https://www.majorsilence.com/ubuntu_14.04_monodevelop_mvc5_project.


Creating a new mvc5 project on ubuntu 14.04 with the version of monodevelop (4.0.12) included is not fun. It does not have an option for mvc 5 and when you attempt to create a mvc3 site there is an error stating it is missing templates needed to create the project.

To work around this and other problems I have created a base example project that I can use whenever I need a new mvc razor site.

The example site can be cloned from https://github.com/majorsilence/AspMvc5Mono.

If you want to host the site using nginx see https://www.majorsilence.com/ubuntu_14.04_mvc5_with_razor_and_nginx.


Running fitnesse on ubuntu linux using mono is very simple. Follow the following instructions and you should have it running in 5 minutes.

See http://schuchert.wikispaces.com/Acceptance+Testing.UsingSlimDotNetInFitN... for more detailed instructions.

For a working example see https://github.com/majorsilence/FitnesseMono.

Create a folder called fitnesse. Place the fitnesse-standalone.jar file in it. Inside the fitnesse folder create a folder called nslim. Unzip the contents of fitsharp into it.

Also in the fitnesse folder areate a runner.sh file and place the following in it. Make the script executable with chmod +x runner.sh.

#!/usr/bin/env bash
/usr/bin/mono ./nslim/Runner.exe $@

Also in the fitnesse folder create a start.sh file and place the following in it. Make the script executable with chmod +x start.sh.

#!/usr/bin/env bash
java -jar fitnesse-standalone.jar -p 8075 -e 0

I am assuming this is being committed to a git or subversion repo. The -e 0 tells it to not store history in zip files as it will be stored using git.

When the wiki is running you can open firefox or chrome and access it at localhost:8075. Create a new page and paste in the following.

Please not that due to some markdown problems line 3 below should not have a \ character anywhere.

!contents -R2 -g -p -f -h

!define TEST_SYSTEM {slim}
!define COMMAND_PATTERN \{\%m -r fitSharp.Slim.Service.Runner,./nslim/fitSharp.dll \%p\}
!define TEST_RUNNER {./runner.sh}
 
!path ../FitnesseTests/bin/Debug/FitnesseTests.dll

|import|
|slim_example|

!|Create Shows|5/6/2009 |
|Name |Episode |Channel|Start Time|Duration|Id? |
|House |Wilson Gets Mad |8 |19:00 |60 | House:8|
|Chuck |He Gets Kung Fu Power |9 |19:00 |60 | Chuck:9|
|Dr. Phil |Episode #405:Teens in Trouble|3 |16:00 |60 | Dr. Phil:3|
|Dr. Who |Yet another doctor |12 |20:00 |30 |$lastProgram=|

After creating the above test page you may need to edit the page properties to make it a test. Load the page -> Tools -> Properties. Under page type make sure Test is checked and click Save Properties.

In a c# project file paste in.

using System;

namespace slim_example
{
	public class CreateShows
	{
		public String ProgramDate { get; set; }
		public String Name { get; set; }
		public String Episode { get; set; }
		public int Channel { get; set; }
		public String StartTime { get; set; }
		public int Duration { get; set; }
		public String LastId { get; set; }

		public CreateShows(string programDate)
		{
			ProgramDate = programDate;
		}

		public void Execute()
		{
			Console.WriteLine("Hi");
			LastId = string.Format("{0}:{1}", Name, Channel);
		}

		public String Id()
		{
			return LastId;
		}
	}
}



Some basic instruction for easy setup of ruby on rails on a ubuntu 14.04 server.

sudo apt-get install ruby ruby-dev nodejs
sudo gem install rails
sudo gem install rdoc-data; sudo rdoc-data --install
rails new path/to/your/new/application
cd path/to/your/new/application
rails server

 

Now browse to http://localhost:3000

More details on creating view/controllers/models see http://guides.rubyonrails.org/getting_started.html.


Majorsilence Reporting is a report and charting system based on Microsoft’s Report Definition Language (RDL). Tabular, free form, matrix, charts are fully supported. HTML, PDF, XML, .Net Control, and printing supported. An experimental Gtk/WPF/Cocoa viewer also exist. There are also language wrappers available for php, python, and ruby that make it easy to generate reports. The WYSIWYG designer allows you to create reports without knowledge of RDL. Wizards are available for creating new reports and for inserting new tables, matrixes, charts, and barcodes into existing reports.

Majorsilence reporting started as My-FyiReporting which was a fork of fyiReporting after it died. It has been re-branded as Majorsilence Reporting to make it clearer that it is a separate forked project. Its purpose is to keep the project alive and useful.

Release 4.5.5

  • https://github.com/majorsilence/My-FyiReporting/issues/44 added examples of using hyperlink actions.
  • https://github.com/majorsilence/My-FyiReporting/issues/53 new page change event in winform viewer. See https://github.com/majorsilence/My-FyiReporting/wiki/Report-Viewer-Events.
  • https://github.com/majorsilence/My-FyiReporting/issues/75 no longer generate pdf with errors.
  • https://github.com/majorsilence/My-FyiReporting/issues/45 initial php, python, and ruby support. Can be used to generate reports and export as pdf, html, doc, excel and any other format that is supported.
  • https://github.com/majorsilence/My-FyiReporting/issues/69 multiple changes to php language support. Still a work in progress but some work is in master.
  • https://github.com/majorsilence/My-FyiReporting/pull/73 and https://github.com/majorsilence/My-FyiReporting/pull/72 localization support. Includes Russian translation of everything in designer and reviewer. See https://github.com/majorsilence/My-FyiReporting/wiki/Localization.
  • https://github.com/majorsilence/My-FyiReporting/issues/64 add Microsoft sql Compact Edition support to RdlEngineConfig.xml.
  • https://github.com/majorsilence/My-FyiReporting/issues/65 fix functions next and previous sometimes not working.
  • https://github.com/majorsilence/My-FyiReporting/pull/61 fix bug of Validate RDL enable and Start Desktop caption on clicking Tools menu.
  • https://github.com/majorsilence/My-FyiReporting/issues/42 new designer control that can be used in .net applications. See https://github.com/majorsilence/My-FyiReporting/wiki/Designer-Control. Works in winform or wpf. Still need bugs fixed.

Other Changes

  • Update to latest version of xwt in LibRdlCrossPlatformViewer (Windows: WPF engine, Gtk engine (using Gtk#), MacOS X: Cocoa engine (using MonoMac) and Gtk engine (using Gtk#), Linux: Gtk engine (using Gtk#)).
  • Include initial nunit test.
  • Setup travis-ci to build project and run unit tests on every push to github.
  • Fix lost events in dataset and report parameter controls.
  • Switch name to Majorsilence Reporting. See https://github.com/majorsilence/My-FyiReporting/commit/5e4a42a0ea4bbab43b5ea10d274342a889205d75.
  • Sort dataproviders when creating a new report. See https://github.com/majorsilence/My-FyiReporting/commit/109d656926a8f0d4f73dd3a7920ec876921cec9c.
  • RdlCmd support exporting to pdf using itextsharp or the builtin code. See https://github.com/majorsilence/My-FyiReporting/commit/3978d37ef8ebc89a87c4e308e1a9fbb748fa3091.
  • RdlReader will can open previous reports if in the startup file
  • Other minor changes

Release 4.5.6

https://github.com/majorsilence/My-FyiReporting/issues/76 fix broken expression functions from 4.5.5 release.

Downloads

http://files.majorsilence.com/myfyireporting/ https://github.com/majorsilence/My-FyiReporting/wiki/Downloads