Giter VIP home page Giter VIP logo

dotnetsignals's Introduction

What is dotnetsignals?

Dotnetsignals (.Net Signals) is a link aggregator written entirely in C# and running on .Net Core.

The current goal is to build a community around sharing .Net knowledge by giving its users a place to share relevant .Net links to articles, blogs, projects, etc. The community is able to filter out noise by voting to the top the links the community deems to be the best.

Instructions on running the dotnetsignals project

Although dotnetsignals was created for use on our website, it can be used by others seeking to form similar communities. The source code has been written to allow for other uses by using non-specific .net names.

Install dotnet on linux

The following bash commands will install the .NET Core 1.0.5 runtime (LTS). If you wish to change the version, replace the download link in the curl line.

sudo apt-get install curl libunwind8 gettext
curl -sSL -o dotnet.tar.gz https://download.microsoft.com/download/2/4/A/24A06858-E8AC-469B-8AE6-D0CEC9BA982A/dotnet-debian-x64.1.0.5.tar.gz
sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet
sudo ln -s /opt/dotnet/dotnet /usr/local/bin

Install RabbitMQ

Please go to the RabbitMQ Documentation to install RabbitMQ. Our sample script looks like:

echo "deb http://www.rabbitmq.com/debian/ testing main" | sudo tee /etc/apt/sources.list.d/rabbitmq.list     
wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -    
sudo apt-get update
sudo apt-get install rabbitmq-server

Setup RabbitMQ

sudo rabbitmqctl add_user username password # change password to actual password
sudo rabbitmqctl set_user_tags username administrator
sudo rabbitmqctl set_permissions -p / username ".*" ".*" ".*"

./rabbitmqadmin declare exchange name=stories.ranking type=direct
./rabbitmqadmin declare queue name=stories.queues.stories durable=true
./rabbitmqadmin declare queue name=stories.queues.comments durable=true
./rabbitmqadmin declare binding source="stories.ranking" destination_type="queue" destination="stories.queues.stories" routing_key="story"
./rabbitmqadmin declare binding source="stories.ranking" destination_type="queue" destination="stories.queues.comments" routing_key="comment"

Remember to disable the default Guest user.

Also, update the appsettings.json files to use the correct username and password

Deploy Stories Website

To deploy the application using Powershell, navigate to the src/Stories folder and run

dotnet publish -c release -r debian.8-x64

A folder will be created under ~\src\Stories\bin\Release\netcoreapp1.2\debian.8-x64\publish Zip and send to your server.

Make sure to setup kestrel to run the application. See Microsoft documentation

Install RankConsumer

Publishing the RankConsumer contains the same steps in the Deploy Stories Website section. The publish folder will be located in the bin of the Stories.Messaging.RankComsumer project.

The RankConsumer can also be run by systemd using this configuration.

[Unit]
Description=.Net Signals Rank Consumer

[Service]
WorkingDirectory=/opt/dotnetsignals/rankconsumer
ExecStart=/usr/local/bin/dotnet /opt/dotnetsignals/rankconsumer/Stories.Messaging.RankConsumer.dll
Restart=always
RestartSec=10
SyslogIdentifier=dotnet-stories-rankconsumer
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production

[Install]
WantedBy=multi-user.target

Install StaleScoreUpdateTask

Publishing the StaleScoreUpdateTask uses the same previous steps.

This application will update the scores of stories/comments that haven't had any activity within the last 12h.

Setup A Cronjob

Add the following to crontab

1 */12 * * *  /usr/local/bin/dotnet /opt/dotnetsignals/stalescoreupdater/Stories.Jobs.StaleScoreUpdateTask.dll

Make sure to change the location of your dll.

Environment Variable

We will add an environment variable of Production for the system so that the task can run with the right config.

echo ASPNETCORE_ENVIRONMENT=Production >> /etc/environment

Dependencies

The application has been tested with the following dependencies

  • .Net Core v1.0.5
  • RabbitMQ 3.6.10
  • Debian Jessie (8)

dotnetsignals's People

Contributors

mattrobineau avatar leboeuf avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.