Skip to content

Commit

Permalink
#4610 Merge from Develop
Browse files Browse the repository at this point in the history
  • Loading branch information
sekmiller committed Oct 1, 2018
2 parents 64643c4 + ec377d2 commit 09fb45e
Show file tree
Hide file tree
Showing 17 changed files with 595 additions and 159 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ conf/docker-aio/dv/install/dvinstall.zip
# or copy of test data
conf/docker-aio/testdata/
scripts/installer/default.config
*.pem
191 changes: 191 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd">

<module name="Checker">
<!--
If you set the basedir property below, then all reported file
names will be relative to the specified directory. See
http://checkstyle.sourceforge.net/5.x/config.html#Checker
<property name="basedir" value="${basedir}"/>
-->

<!-- <property name="fileExtensions" value="java, properties"/> -->
<property name="fileExtensions" value="java"/>

<!-- Checks that a package-info.java file exists for each package. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
<!-- <module name="JavadocPackage"/> -->

<!-- Checks whether files end with a new line. -->
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
<!--<module name="NewlineAtEndOfFile"/>-->

<!-- Checks that property files contain the same keys. -->
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
<!--
<module name="Translation"/>
-->

<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<!-- <module name="FileLength"/> -->

<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<!-- Checks that there are no tab characters ('\t') in the source code. http://checkstyle.sourceforge.net/config_whitespace.html#FileTabCharacter-->
<module name="FileTabCharacter"/>

<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<!--
<module name="RegexpSingleline">
<property name="format" value="[^\s]\s+$"/>
<property name="minimum" value="0"/>
<property name="maximum" value="0"/>
<property name="message" value="Line has trailing spaces."/>
</module>
-->

<!-- Checks for Headers -->
<!-- See http://checkstyle.sf.net/config_header.html -->
<!--
<module name="RegexpHeader">
<property name="headerFile" value="${checkstyle.header.file}"/>
<property name="fileExtensions" value="java"/>
</module>
-->

<module name="TreeWalker">

<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<!--
<module name="JavadocMethod">
<property name="severity" value="info"/>
<property name="allowMissingParamTags" value="true"/>
</module>
<module name="JavadocType"/>
<module name="JavadocVariable">
<property name="ignoreNamePattern" value="^[A-Z_\-]+$" />
</module>
<module name="JavadocStyle">
<property name="checkFirstSentence" value="false" />
</module>
-->

<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sf.net/config_naming.html -->
<!--
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
-->

<!-- Checks for imports -->
<!-- See http://checkstyle.sf.net/config_import.html -->
<!--
<module name="AvoidStarImport">
<property name="excludes" value="lombok,java.util,org.springframework.web.bind.annotation"/>
</module>
-->
<!-- <module name="IllegalImport"/> --> <!-- defaults to sun.* packages -->
<!-- <module name="RedundantImport"/> -->
<!-- <module name="UnusedImports">
<property name="processJavadoc" value="false"/>
</module> -->
<!-- <module name="CustomImportOrder" /> -->

<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<!--
<module name="LineLength">
<property name="max" value="120"/>
<!- ignore lines with javadoc inside ->
<property name="ignorePattern" value="^ *\* *[^ ]+$"/>
</module>
<module name="MethodLength"/>
<module name="ParameterNumber"/>
-->

<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<!--
<module name="EmptyForIteratorPad"/>
<module name="GenericWhitespace"/>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>
-->

<!-- Modifier Checks -->
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
<!--
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
-->

<!-- Checks for blocks. You know, those {}'s -->
<!-- See http://checkstyle.sf.net/config_blocks.html -->

<!--<module name="AvoidNestedBlocks"/>-->
<!--<module name="EmptyBlock"/>-->
<!-- Put the left curly at the end of the line above, not on the next line. http://checkstyle.sourceforge.net/config_blocks.html#LeftCurly-->
<module name="LeftCurly"/>
<!--<module name="NeedBraces"/>-->
<!--<module name="RightCurly"/>-->


<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<!--
<module name="AvoidInlineConditionals"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField">
<property name="ignoreConstructorParameter" value="true"/>
<property name="ignoreSetter" value="true"/>
</module>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MagicNumber"/>
<module name="MissingSwitchDefault"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
-->

<!-- Checks for class design -->
<!-- See http://checkstyle.sf.net/config_design.html -->
<!-- <module name="DesignForExtension"/> -->
<!-- <module name="FinalClass"/> -->
<!-- <module name="HideUtilityClassConstructor"/> -->
<!-- <module name="InterfaceIsType"/> -->
<!-- <module name="VisibilityModifier"/> -->

<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<!-- <module name="ArrayTypeStyle"/> -->
<!-- <module name="FinalParameters"/> -->
<!--
<module name="TodoComment">
<property name="severity" value="info"/>
</module>
-->
<!-- <module name="UpperEll"/> -->

</module>

</module>
4 changes: 2 additions & 2 deletions doc/sphinx-guides/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
# built documents.
#
# The short X.Y version.
version = '4.9.2'
version = '4.9.3'
# The full version, including alpha/beta/rc tags.
release = '4.9.2'
release = '4.9.3'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
34 changes: 29 additions & 5 deletions doc/sphinx-guides/source/developers/coding-style.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Formatting Code
Tabs vs. Spaces
^^^^^^^^^^^^^^^

Don't use tabs. Use spaces.
Don't use tabs. Use 4 spaces.

Braces Placement
^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -59,10 +59,20 @@ Format Code You Changed with Netbeans

As you probably gathered from the :doc:`dev-environment` section, IQSS has standardized on Netbeans. It is much appreciated when you format your code (but only the code you touched!) using the out-of-the-box Netbeans configuration. If you have created an entirely new Java class, you can just click Source -> Format. If you are adjusting code in an existing class, highlight the code you changed and then click Source -> Format. Keeping the "diff" in your pull requests small makes them easier to code review.

The Netbeans formatting syntax appears not to be documented anywhere, however from an initial approximation `astyle --mode=java --style=attach --add-braces ${source_file}` is reasonably close.
If `astyle` is not installed on your system, it is available from `<http://astyle.sourceforge.net>`_.
Checking Your Formatting With Checkstyle
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

We would like to someday automate the detection and possibly correction of code that hasn't been formatted using our house style (the default Netbeans style). We've heard that https://maven.apache.org/plugins/maven-checkstyle-plugin/ can do this but we would be happy to see a pull request in this area, especially if it also hooks up to our builds at https://travis-ci.org/IQSS/dataverse .
The easiest way to adopt Dataverse coding style is to use Netbeans as your IDE, avoid change the default Netbeans formatting settings, and only reformat code you've changed, as described above.

If you do not use Netbeans, you are encouraged to check the formatting of your code using Checkstyle.

To check the entire project:

``mvn checkstyle:checkstyle``

To check a single file:

``mvn checkstyle:checkstyle -Dcheckstyle.includes=**\/SystemConfig*.java``

Logging
~~~~~~~
Expand Down Expand Up @@ -93,6 +103,20 @@ If you just downloaded Netbeans and are using the out-of-the-box settings, you s

If you know of a way to easily share Netbeans configuration across a team, please get in touch.

Bash
----

Generally, Google's Shell Style Guide at https://google.github.io/styleguide/shell.xml seems to have good advice.

Formatting Code
~~~~~~~~~~~~~~~

Tabs vs. Spaces
^^^^^^^^^^^^^^^

Don't use tabs. Use 2 spaces.

shfmt from https://github.com/mvdan/sh seems like a decent way to enforce indentation of two spaces (i.e. ``shfmt -i 2 -w path/to/script.sh``) but be aware that it makes other changes.

Bike Shedding
-------------
Expand All @@ -103,4 +127,4 @@ Come debate with us about coding style in this Google doc that has public commen

----

Previous: :doc:`debugging` | Next: :doc:`containers`
Previous: :doc:`debugging` | Next: :doc:`deployment`
2 changes: 1 addition & 1 deletion doc/sphinx-guides/source/developers/containers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -410,4 +410,4 @@ Again, Dataverse Docker images on Docker Hub are highly experimental at this poi

----

Previous: :doc:`coding-style` | Next: :doc:`making-releases`
Previous: :doc:`deployment` | Next: :doc:`making-releases`
97 changes: 97 additions & 0 deletions doc/sphinx-guides/source/developers/deployment.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
==========
Deployment
==========

Developers often only deploy Dataverse to their :doc:`dev-environment` but it can be useful to deploy Dataverse to cloud services such as Amazon Web Services (AWS).

.. contents:: |toctitle|
:local:

Deploying Dataverse to Amazon Web Services (AWS)
------------------------------------------------

We have written scripts to deploy Dataverse to Amazon Web Services (AWS) but they require some setup.

Install AWS CLI
~~~~~~~~~~~~~~~

First, you need to have AWS Command Line Interface (AWS CLI) installed, which is called ``aws`` in your terminal. Launching your terminal and running the following command to print out the version of AWS CLI will tell you if it is installed or not:

``aws --version``

If you have not yet installed AWS CLI you should install it by following the instructions at https://docs.aws.amazon.com/cli/latest/userguide/installing.html

Afterwards, you should re-run the "version" command above to verify that AWS CLI has been properly installed. If "version" still doesn't work, read on for troubleshooting advice. If "version" works, you can skip down to the "Configure AWS CLI" step.

Troubleshooting "aws: command not found"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Please note that as of this writing the AWS docs are not especially clear about how to fix errors such as ``aws: command not found``. If the AWS CLI cannot be found after you followed the AWS installation docs, it is very likely that the ``aws`` program is not in your ``$PATH``. ``$PATH`` is an "environment variable" that tells your shell (usually Bash) where to look for programs.

To see what ``$PATH`` is set to, run the following command:

``echo $PATH``

On Mac, to update your ``$PATH`` to include the location where the current AWS docs install AWS CLI on the version of Python included with your Mac, run the following command:

``export PATH=$PATH:$HOME/Library/Python/2.7/bin``

After all this, you can try the "version" command again.

Note that it's possible to add an ``export`` line like the one above to your ``~/.bash_profile`` file so you don't have to run it yourself when you open a new terminal.

Configure AWS CLI
~~~~~~~~~~~~~~~~~

Next you need to configure AWS CLI.

Create a ``.aws`` directory in your home directory (which is called ``~``) like this:

``mkdir ~/.aws``

We will be creating two plain text files in the ``.aws`` directory and it is important that these files do not end in ".txt" or any other extension. After creating the files, you can verify their names with the following command:

``ls ~/.aws``

Create a plain text file at ``~/.aws/config`` with the following content::

[default]
region = us-east-1

Please note that at this time the region must be set to "us-east-1" but in the future we could improve our scripts to support other regions.

Create a plain text file at ``~/.aws/credentials`` with the following content::

[default]
aws_access_key_id = XXXXXXXXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Then update the file and replace the values for "aws_access_key_id" and "aws_secret_access_key" with your actual credentials by following the instructions at https://aws.amazon.com/blogs/security/wheres-my-secret-access-key/

If you are having trouble configuring the files manually as described above, see https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html which documents the ``aws configure`` command.

Download and Run the "Create Instance" Script
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Once you have done the configuration above, you are ready to try running the "create instance" script to spin up Dataverse in AWS.

Download :download:`ec2-create-instance.sh <../../../../scripts/installer/ec2-create-instance.sh>` and put it somewhere reasonable. For the purpose of these instructions we'll assume it's in the "Downloads" directory in your home directory.

You need to decide which branch you'd like to deploy to AWS. Select a branch from https://github.com/IQSS/dataverse/branches/all such as "develop" and pass it to the script with ``-b`` as in the following example. (Branches such as "master" and "develop" are described in the :doc:`version-control` section.)

``bash ~/Downloads/ec2-create-instance.sh -b develop``

You must specify the branch with ``-b`` but you can also specify a non-IQSS git repo URL with ``-r`` as in the following example.

``bash ~/Downloads/ec2-create-instance.sh -b develop -r https://github.com/scholarsportal/dataverse.git``

Now you will need to wait around 15 minutes until the deployment is finished. Eventually, the output should tell you how to access the installation of Dataverse in a web browser or via ssh. It will also provide instructions on how to delete the instance when you are finished with it. Please be aware that AWS charges per minute for a running instance. You can also delete your instance from https://console.aws.amazon.com/console/home?region=us-east-1 .

Caveats
~~~~~~~

Please note that while the script should work fine on newish branches, older branches that have different dependencies such as an older version of Solr are now expected to yield a working Dataverse installation. Your mileage may vary.

----

Previous: :doc:`coding-style` | Next: :doc:`containers`
1 change: 1 addition & 0 deletions doc/sphinx-guides/source/developers/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Developer Guide
documentation
debugging
coding-style
deployment
containers
making-releases
tools
Expand Down
6 changes: 4 additions & 2 deletions doc/sphinx-guides/source/installation/prep.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ Installing Dataverse involves some system configuration followed by executing an
Advanced Installation
+++++++++++++++++++++

There are some community-lead projects to use configuration management tools such as Puppet and Ansible to automate Dataverse installation and configuration, but support for these solutions is limited to what the Dataverse community can offer as described in each project's webpage:
There are some community-lead projects to use configuration management tools such as Ansible and Puppet to automate Dataverse installation and configuration, but support for these solutions is limited to what the Dataverse community can offer as described in each project's webpage:

- https://github.com/IQSS/dataverse-puppet
- https://github.com/IQSS/dataverse-ansible
- https://github.com/IQSS/dataverse-puppet

(Please note that the "dataverse-ansible" repo is used in a script that allows Dataverse to be installed on Amazon Web Services (AWS) from arbitrary GitHub branches as described in the :doc:`/developers/deployment` section of the Developer Guide.)

The Dataverse development team is happy to "bless" additional community efforts along these lines (i.e. Docker, Chef, Salt, etc.) by creating a repo under https://github.com/IQSS and managing team access.

Expand Down
Loading

0 comments on commit 09fb45e

Please sign in to comment.