Skip to content

Instantly share code, notes, and snippets.

@jeszy75
Last active March 4, 2023 11:51
Show Gist options
  • Save jeszy75/6cc8badf7947e1bc2b9a217dd540f5d9 to your computer and use it in GitHub Desktop.
Save jeszy75/6cc8badf7947e1bc2b9a217dd540f5d9 to your computer and use it in GitHub Desktop.
Deploying the Project Website to shrek.unideb.hu

Deploying the Project Website to shrek.unideb.hu

Creating the public_html Directory

Execute the following commands (requires an eduID):

ssh <eduID>@shrek.unideb.hu
pwd # prints the current directory (i.e., the path to your home directory)
mkdir public_html
chmod a+x .
chmod a+rx public_html

Note that the shrek.unideb.hu server can be accessed over SSH on port 22 (i.e., on the default SSH port) only within the University network. Instead, port 2222 must be used from outside the University network:

ssh <eduID>@shrek.unideb.hu -p 2222

pom.xml

Add the following element to the project/build element for SSH support:

<extensions>
  <extension>
    <groupId>org.apache.maven.wagon</groupId>
    <artifactId>wagon-ssh</artifactId>
    <version>3.5.3</version>
  </extension>
</extensions>

Add the following element to the project element:

<distributionManagement>
  <site>
    <id>shrek</id>
    <url>scp://@shrek.unideb.hu:2222/home/<eduID>/public_html/${project.artifactId}</url>
  </site>
</distributionManagement>

Deploying the Website

The website of the project can be deployed by executing

mvn site-deploy

The command prompts for your password that is shown on the console. Thus, this way of providing your password is not secure.

Moreover, this works only when your username on your local computer is the same as your username on shrek.unideb.hu (i.e., your eduID). If not, you must also include your eduID in the url element as follows:

<url>scp://<eduID>@shrek.unideb.hu:2222/home/<eduID>/public_html/${project.artifactId}</url>

Note that you do not have to add your eduID before the @ character when your username and password are stored in the settings.xml file.

After successful deployment, the website of the project can be found at https://shrek.unideb.hu/~eduID/ and also at https://web.unideb.hu/~eduID/.

Storing Your Password

Use the ~/.m2/settings.xml file for storing your password adding the following element to the settings/servers element:

<server>
  <id>shrek</id>
  <username>eduID</username>
  <password>password</password>
</server>

The password is still provided in clear text, thus, this way of providing your password is not secure.

Password Encryption

You should store your password encrypted according to this guide: https://maven.apache.org/guides/mini/guide-encryption.html

Create the ~/.m2/settings-security.xml file with the following contents:

<settingsSecurity>
    <master></master>
</settingsSecurity>

Encrypt an arbitrary chosen master password by executing the following command (emp stands for encrypt master password):

mvn -emp

Insert the output (i.e., the encrypted master password) to the master element in the ~/.m2/settings-security.xml file.

In the following, you can encrypt any password (e.g., your password to shrek.unideb.hu) using your master password by executing the following command (ep stands for encrypt password):

mvn -ep

Insert the output (i.e., the encrypted password) to the server/password element in the ~/.m2/settings.xml file.

<settingsSecurity>
<master></master>
</settingsSecurity>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>shrek</id>
<username></username>
<password></password>
</server>
</servers>
</settings>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment