Thursday, July 18, 2013

Avoiding fake server requests in nginx

I have been having requests to my server with HTTP_HOST header gameframe.net or server5.cyberpods.net which are not related to me. They were causing error mails sent to me by my Django site since these domains were not listed in my ALLOWED_HOSTS list. I was tired of having error messages every day so after some research  I found the solution.

I told my nginx server to listen only my own domains but it was listening to other domains as well. I added the following block to the top of my config file

server {
        return 404;
}

before the original server settings:

server {
       listen 80;
       server_name my.domain.com myother.domain.com;
       ...
}

This way any domain that is not in my list gets 404 by default. Hope it helps!


Monday, July 8, 2013

Adding local maven dependencies to Ivy

If you want to use your local maven packages in your app configured with ivy, you should add some lines to ivy.xml and ivysettings.xml. Below is an example.

ivysettings.xml

  <property name="my.local.maven"
    value="file:///${user.home}/.m2/repository/"
    override="false"/>   

ivy.xml

    <dependency org="org.apache.giraph" name="giraph-core" rev="1.1.0-SNAPSHOT" conf="*->default"/>
    <dependency org="org.apache.giraph" name="giraph-examples" rev="1.1.0-SNAPSHOT" conf="*->default"/>
    <dependency org="org.apache.giraph" name="giraph-hbase" rev="1.1.0-SNAPSHOT" conf="*->default"/>
    <dependency org="org.apache.hbase" name="hbase" rev="0.90.5" conf="*->default"/>

Thursday, July 4, 2013

Adding maven dependencies into the target jar file

I wanted to add hbase and giraph-hbase dependencies to giraph-example module. I realized that I should specify scope for each to get the into the resulting giraph-example.jar.

    <dependency>
      <groupId>org.apache.giraph</groupId>
      <artifactId>giraph-hbase</artifactId>
      <version>1.1.0-SNAPSHOT</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.hbase</groupId>
      <artifactId>hbase</artifactId>
      <version>0.90.5</version>
      <scope>compile</scope>
    </dependency>