Description

First steps with the Bitnami Subversion Stack

Welcome to your new Bitnami application running on Amazon Web Services! Here are a few questions (and answers!) you might need when first starting with your application.

What credentials do I need?

You need two sets of credentials:

The application credentials that allow you to log in to your new Bitnami application. These credentials consist of a username and password.

The server credentials that allow you to log in to your AWS Cloud server using an SSH client and execute commands on the server using the command line. These credentials consist of an SSH username and key.

Watch the following video to learn quickly how to obtain the application credentials of those applications deployed using the AWS Console:

What are the default ports?

A port is an endpoint of communication in an operating system that identifies a specific process or a type of service. Bitnami stacks include several services or servers that require a port.

Remember that if you need to open some ports you can follow the instructions given in the FAQ to learn how to open the server ports for remote access.

Port 22 is the default port for SSH connections.

Bitnami opens some ports for the main servers. These are the ports opened by default: 80, 443.

How to start or stop the services?

Each Bitnami stack includes a control script that lets you easily stop, start and restart services. The script is located at /opt/bitnami/ctlscript.sh. Call it without any service name arguments to start all services:

$ sudo /opt/bitnami/ctlscript.sh start

Or use it to restart a single service, such as Apache only, by passing the service name as argument:

$ sudo /opt/bitnami/ctlscript.sh restart apache

Use this script to stop all services:

$ sudo /opt/bitnami/ctlscript.sh stop

Restart the services by running the script without any arguments:

$ sudo /opt/bitnami/ctlscript.sh restart

Obtain a list of available services and operations by running the script without any arguments:

$ sudo /opt/bitnami/ctlscript.sh

How to create a full backup of Subversion?

Backup

The Bitnami Subversion Stack is self-contained and the simplest option for performing a backup is to copy or compress the Bitnami stack installation directory. To do so in a safe manner, you will need to stop all servers, so this method may not be appropriate if you have people accessing the application continuously.

Follow these steps:

Change to the directory in which you wish to save your backup:

$ cd /your/directory

Stop all servers:

$ sudo /opt/bitnami/ctlscript.sh stop

Create a compressed file with the stack contents:

$ sudo tar -pczvf application-backup.tar.gz /opt/bitnami

Restart all servers:

$ sudo /opt/bitnami/ctlscript.sh start

You should now download or transfer the application-backup.tar.gz file to a safe location.

Restore

Follow these steps:

Change to the directory containing your backup:

$ cd /your/directory

Stop all servers:

$ sudo /opt/bitnami/ctlscript.sh stop

Move the current stack to a different location:

$ sudo mv /opt/bitnami /tmp/bitnami-backup

Uncompress the backup file to the original directoryv

$ sudo tar -pxzvf application-backup.tar.gz -C /

Start all servers:

$ sudo /opt/bitnami/ctlscript.sh start

If you want to create only a database backup, refer to these instructions for MySQL and PostgreSQL.

How to enable HTTPS support with SSL certificates?

NOTE: The steps below assume that you are using a custom domain name and that you have already configured the custom domain name to point to your cloud server.

Bitnami images come with SSL support already pre-configured and with a dummy certificate in place. Although this dummy certificate is fine for testing and development purposes, you will usually want to use a valid SSL certificate for production use. You can either generate this on your own (explained here) or you can purchase one from a commercial certificate authority.

Once you obtain the certificate and certificate key files, you will need to update your server to use them. Follow these steps to activate SSL support:

Use the table below to identify the correct locations for your certificate and configuration files.

NOTE: If you use different names for your certificate and key files, you should reconfigure the SSLCertificateFile and SSLCertificateKeyFile directives in the corresponding Apache configuration file to reflect the correct file names.

If your certificate authority has also provided you with a PEM-encoded Certificate Authority (CA) bundle, you must copy it to the correct location in the previous table. Then, modify the Apache configuration file to include the following line below the SSLCertificateKeyFile directive. Choose the correct directive based on your scenario and Apache version:

Variable

Value

Apache configuration file

/opt/bitnami/apache2/conf/bitnami/bitnami.conf

Directive to include (Apache v2.4.8+)

SSLCACertificateFile "/opt/bitnami/apache2/conf/server-ca.crt"

Directive to include (Apache < v2.4.8)

SSLCertificateChainFile "/opt/bitnami/apache2/conf/server-ca.crt"

NOTE: If you use a different name for your CA certificate bundle, you should reconfigure the SSLCertificateChainFile or SSLCACertificateFile directives in the corresponding Apache configuration file to reflect the correct file name.

Once you have copied all the server certificate files, you may make them readable by the root user only with the following commands:

How to create an SSL certificate?

OpenSSL is required to create an SSL certificate. A certificate request can then be sent to a certificate authority (CA) to get it signed into a certificate, or if you have your own certificate authority, you may sign it yourself, or you can use a self-signed certificate (because you just want a test certificate or because you are setting up your own CA).

Note that if you use this encrypted key in the Apache configuration file, it will be necessary to enter the password manually every time Apache starts. Regenerate the key without password protection from this file as follows:

How to debug Apache errors?

Once Apache starts, it will create two log files at /opt/bitnami/apache2/logs/access_log and /opt/bitnami/apache2/logs/error_log respectively.

The access_log file is used to track client requests. When a client requests a document from the server, Apache records several parameters associated with the request in this file, such as: the IP address of the client, the document requested, the HTTP status code, and the current time.

The error_log file is used to record important events. This file includes error messages, startup messages, and any other significant events in the life cycle of the server. This is the first place to look when you run into a problem when using Apache.

If no error is found, you will see a message similar to:

Syntax OK

How to upload files to the server with SFTP?

Although you can use any SFTP/SCP client to transfer files to your server, the link below explains how to configure FileZilla (Windows, Linux and Mac OS X), WinSCP (Windows) and Cyberduck (Mac OS X). It is required to use your server's private SSH key to configure the SFTP client properly. Choose your preferred application and follow the steps in the link below to connect to the server through SFTP.

How to start with Subversion?

By default, Bitnami provides a Subversion repository and Apache server to access it using a Web browser. The default configuration uses svnserver but other methods (like SSH) can also be used to access the repository.

NOTE: The default Subversion port is 3690 and it is necessary to open this port in the server firewall for remote access. Refer to the FAQ for more information.

Assign your repository to a Redmine project. In Redmine, navigate to the project "Settings -> Repository" menu and add the following value in the "URL" field (username and password are not necessary):

file:///opt/bitnami/repositories/myapp

Check if you have Subversion binaries in the system path even in the non-interactive SSH session. Execute the following command:

$ ssh -l bitnami -i KEYFILE SERVER-IP svn

Remember to replace KEYFILE in the previous commands with the path to your private key file, and SERVER-IP with the public IP address or hostname of your server.

If you receive a "Command not found" error, update the /home/bitnami/.bashrc file and move all Bitnami path configuration from the bottom of this file to the top, above this line

[ -z "$PS1" ] && return

Check out the repository now and start adding and committing new files. The repository should be available remotely via the following URL. The Subversion client should be configured to use the username bitnami and corresponding SSH key:

svn+ssh://xyz.bitnamiapp.com/opt/bitnami/repositories/myapp

Remember to replace xyz.bitnamiapp.com with the public IP address or hostname of your server.

To add a file to your repository, execute the following commands on your local host. Remember to replace bitnami-hosting.pem in the previous commands with the path to your private key file, and xyz.bitnamiapp.com with the public IP address or hostname of your server.

In the same file, verify the endpoint URL and path for your Subversion repository. For example, the directives below will let you view the default repository at /opt/bitnami/repository by browsing to http://SERVER-IP/repository.

You should now be able to checkout the repository using a tool like TortoiseSVN. Simply enter the URL as http://SERVER-IP/repository as the repository checkout URL in the TortoiseSVN interface, as shown below.

Enabling access over HTTPS

You can also access the repository over HTTPS if you have configured the Apache SSL certificate for your server. The following error can occur if the hostname reported by the server does not match the hostname in the SSL certificate. Make sure your server configuration uses the correct ServerName value.

Enabling commits over HTTP(S)

For security reasons, the default configuration does not allow users to commit changes to the repositories over HTTP or HTTPS. To permit this, change the permissions of your repository directory so that the Apache user is able to write to it.

Run the following command, assuming your repository is located at the default location of /opt/bitnami/repository:

$ sudo chown -R daemon:subversion /opt/bitnami/repository

IMPORTANT: Making this change will allow any user to commit changes to your repository. To avoid unauthorized commits and possible data loss, configure basic authentication for your repository as discussed in the next section

You should now be able to commit changes to the repository using a tool like TortoiseSVN, as shown below.

How to configure the repository URL?

If no prefix is set in the Subversion scripts, specify the full path to the repository - for instance, svn://SERVER-IP/home/user/repository. In case this is not possible, add the repository path to the Subversion control script.

Edit the file /opt/bitnami/subversion/scripts/ctl.sh and add the path as follows:

-d --listen-port=3690 --root=/path/to/repository

Restart the Subversion server.

How to configure basic authentication for your repository?

Once your repository is accessible over HTTP(s), it is recommended that you protect it from unauthorized access by configuring authentication for different users. To do this, follow the steps below:

Update the Apache configuration file at /opt/bitnami/apache2/conf/httpd.conf and add the highlighted directives below.

With this configuration, repository access is only available to those users listed in the /opt/bitnami/repository/users file and they will need to authenticate themselves before gaining access. Note that you should update the path to the file based on the actual location of your repository.

Create the /opt/bitnami/repository/users file and add a user account named myuser to it using the following command. You will be prompted to enter a password for the user account. Note that you should update the path to the file based on the actual location of your repository.

Configure the SMTP mail settings in the mailer.conf file. Here is an example for a Gmail account:

[General]
smtp_hostname = smtp.gmail.com:587
smtp_username = your_gmail_account
smtp_password = your_password
smtp_use_ssl = true
...
[defaults]
from_addr = mail@example.com
# The default To: addresses for message. One or more addresses,
# separated by whitespace (no commas).
# NOTE: If you want to use a different character for separating the
# addresses put it in front of the addresses included in square
# brackets '[ ]'.
to_addr = mail@example.com
# If this is set, then a Reply-To: will be inserted into the message.
reply_to = mail@example.com

To use a Gmail account or an SSL connection for SMTP settings, modify the SMTPOutput class in mailer.py with a patch in order to use the added smtp_use_ssl setting. This patch was submitted by Alexey Samodov:

Configure your post-commit hook script to use the mailer.py and mailer.conf files. The location of your post-commit script depends on the location of your repository. Edit the /opt/bitnami/repositories/REPOSITORY-NAME/hooks/post-commit.tmpl file and replace the last line with the following one: