Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/abn/victims-server-openshift


https://github.com/abn/victims-server-openshift

Last synced: 7 days ago
JSON representation

Awesome Lists containing this project

README

        

victims-server-openshift
========================

**NOTE**: This is superceded by https://github.com/victims/victims-server-openshift

This repo allows you to deploy a new instance of the victims-web server on openshift.

## Running on OpenShift
### Prerequisites
1. You have a valid account with OpenShift
2. You have followed the instructions at https://www.openshift.com/get-started
3. You have *rhc* installed and ready

### Creating the app
#### One Shot Deployment
This is pretty straight forward, run the following command. The app should be deployed to ```http://victims-NAMESPACE.rhcloud.com```. See bottom for a sample output.
```sh
rhc app create victims mongodb-2.2 python-2.6 --from-code git://github.com/abn/victims-server-openshift.git
```
#### Alternative Deployment
This can be useful if the *One Shot* option fails or if you want to configure the instance from build 1.
```sh
rhc app create victims mongodb-2.2 python-2.6
cd victims
git remote add upstream -m master git://github.com/abn/victims-server-openshift.git
git pull -s recursive -X theirs upstream master
# Make any configuration changes here and commit them.
git push origin master
```
### Importing data
1. Get the app's SSH address by running ```rhc app show victims```
2. SSH into the server.
3. Download the data file you want to import to ```$OPENSHIFT_DATA_DIR```
4. Run the following command replacing ```$INPUTFILE``` with your file name.

```sh
mongoimport -d $OPENSHIFT_APP_NAME -c hashes --type json --file $OPENSHIFT_DATA_DIR/$INPUTFILE -h $OPENSHIFT_MONGODB_DB_HOST -u admin -p $OPENSHIFT_MONGODB_DB_PASSWORD --port $OPENSHIFT_MONGODB_DB_PORT
```
### Configuring the deploytment
#### Application Configuration
Any application configuration can be pushed by changing the ```configs/victimsweb.cfg``` file in the repo. This will be used instead of the ```application.cfg``` provided by victims-web.
#### Build Hook Configuration
We use ```configs/victimsweb.build.env``` file for doing a few build time tricks. This file is sourced before a the build hook executes.

1. Branches/Tags: You can specify this as ```VICTIMS_GIT_BRANCH=master```. By default the master branch is checked out and used.
2. Specify your fork: This can be done by setting ```VICTIMS_GIT_URL``` to your repository url. This will delete any existing checkout.
3. Clean checkout: You can request this by setting ```VICTIMS_GIT_CLEAN=0``` to ```1```.

### Sample creation output
```sh
$ rhc app create victims mongodb-2.2 python-2.6 --from-code git://github.com/abn/victims-server-openshift.git
Application Options
-------------------
Namespace: abn
Cartridges: mongodb-2.2, python-2.6
Source Code: git://github.com/abn/victims-server-openshift.git
Gear Size: default
Scaling: no

Creating application 'victims' ... done

Waiting for your DNS name to be available ... done

Downloading the application Git repository ...
Cloning into 'victims'...
Warning: Permanently added the RSA host key for IP address '**.***.***.**' to the list of known hosts.

Your application code is now in 'victims'

victims @ http://victims-abn.rhcloud.com/ (uuid: **********************)
--------------------------------------------------------------------------
Created: 7:33 PM
Gears: 1 (defaults to small)
Git URL: ssh://[email protected]/~/git/victims.git/
Initial Git URL: git://github.com/abn/victims-server-openshift.git
SSH: [email protected]

python-2.6 (Python 2.6)
-----------------------
Gears: Located with mongodb-2.2

mongodb-2.2 (MongoDB NoSQL Database 2.2)
----------------------------------------
Gears: Located with python-2.6
Connection URL: mongodb://$OPENSHIFT_MONGODB_DB_HOST:$OPENSHIFT_MONGODB_DB_PORT/
Database Name: victims
Password: ***********
Username: admin

RESULT:
Application victims was created.
MongoDB 2.2 database added. Please make note of these credentials:
Root User: admin
Root Password: ***********
Database Name: victims
Connection URL: mongodb://$OPENSHIFT_MONGODB_DB_HOST:$OPENSHIFT_MONGODB_DB_PORT/

```