Skip to content

shashkin/omaha-server

 
 

Repository files navigation

omaha-server

Build Status Coverage Status Code Health Scrutinizer Code Quality Apache License, Version 2.0

Google Omaha server implementation + added Sparkle (mac) feed management

Setting up a development server

Requirements:

$ sudo apt-get update
$ sudo apt-get install docker.io
$ sudo apt-get install python-paver python-pip
$ sudo pip install -U docker-compose
$ git clone https://github.com/Crystalnix/omaha-server.git
$ cd omaha-server
$ sudo paver up_local_dev_server

# Stop server
$ sudo docker-compose stop

Open http://{DOCKER_HOST}:9090/admin/

  • username: admin
  • password: admin

Setting up a development environment

Requirements:

$ mkvirtualenv omaha-server
$ pip install -r requirements-dev.txt

Tests

$ paver test

or

$ paver run_test_in_docker

Statistics

Required userid. Including user id into request

Utils

A command for generating fake data such as requests, events and statistics:

# Usage: ./manage.py generate_fake_data [options] <app_id>
# Options:
#     --count=COUNT         Total number of data values (default: 100)
$ ./manage.py generate_fake_data {F07B3878-CD6F-4B96-B52F-95C4D2} --count=20

A command for generating fake statistics:

# Usage: ./manage.py generate_fake_statistics [options]
# Options:
#     --count=COUNT         Total number of data values (default: 100)
$ ./manage.py generate_fake_statistics --count=3000

Deploying Omaha-Server to AWS Elastic Beanstalk

Requirements:

Initializing the Configuration

$ cp ebs.config.example ebs.config

To change Omaha-Server configuration, add the settings that you want to modify to the ebs.config file. For example:

aws:
    access_key: 'AWS Access Key'
    secret_key: 'AWS Secret Key'
    region: 'us-east-1'
    bucket: 'the bucket that beanstalk apps will be stored in'
    bucket_path: 'omaha-server'

app:
    versions_to_keep: 10
    app_name: 'omaha-server'
    description: 'Omaha Server'

    all_environments:
        solution_stack_name: '64bit Amazon Linux 2015.03 v1.4.3 running Docker 1.6.2'
        tier_name: 'WebServer'
        tier_type: 'Standard'
        tier_version: '1.0'

        option_settings:

            'aws:autoscaling:launchconfiguration':
                InstanceType: 't1.micro'
                SecurityGroups: 'omaha_server_dev'
                EC2KeyName: 'Key Name'

            'aws:autoscaling:asg':
                MinSize: 1
                MaxSize: 10

            'aws:autoscaling:trigger':
                BreachDuration: 300
                MeasureName: 'CPUUtilization'
                Unit: 'Percent'
                LowerThreshold: 20
                UpperThreshold: 70
                UpperBreachScaleIncrement: 1

            'aws:elasticbeanstalk:application':
                Application Healthcheck URL: '/admin/login/'

            'aws:elasticbeanstalk:application:environment':
                AWS_ACCESS_KEY_ID: 'AWS Access Key'
                AWS_SECRET_KEY: 'AWS Secret Key'

        archive:
            files:
                - .ebextensions/01_nginx.config:
                    yaml:
                        files:
                            "/etc/nginx/conf.d/proxy.conf":
                                mode: "000755"
                                owner: root
                                group: root
                                content: |
                                    client_max_body_size 275M;

                - .ebextensions/02-commands.config:
                    yaml:
                        container_commands:
                            00001-docker-privileged:
                                command: 'sed -i "s/docker run -d/docker run --privileged -d/" /opt/elasticbeanstalk/hooks/appdeploy/enact/00run.sh'

            includes:
                - 'Dockerrun.aws.json'

    environments:

        # the dev version of the app
        'omaha-server-dev':
            cname_prefix: 'your-domain-prefix'
            option_settings:
                'aws:elasticbeanstalk:application:environment':
                    APP_VERSION: 'DEV'
                    DJANGO_SETTINGS_MODULE: 'omaha_server.settings_prod'
                    SECRET_KEY: 'Django SECRET_KEY'
                    HOST_NAME: 'Eb app host name'
                    DB_HOST: 'db host'
                    DB_USER: 'db user'
                    DB_NAME: 'db name'
                    DB_PASSWORD: 'db password'
                    AWS_ACCESS_KEY_ID: 'AWS Access Key'
                    AWS_SECRET_ACCESS_KEY: 'AWS Secret Key'
                    AWS_STORAGE_BUCKET_NAME: 'S3 storage bucket'
                    RAVEN_DNS: 'Sentry url'
                    REDIS_HOST: '127.0.0.1'

Environment variables

Environment variable name Description Default value
APP_VERSION App version DEV
DJANGO_SETTINGS_MODULE omaha_server.settings_prod
SECRET_KEY Django SECRET_KEY
HOST_NAME Eb app host name
DB_HOST DB Host 127.0.0.1
DB_USER DB User postgres
DB_NAME DB Name postgres
DB_PASSWORD DB Password ''
DB_PORT DB port 5432
AWS_ACCESS_KEY_ID AWS Access Key
AWS_SECRET_ACCESS_KEY AWS Secret Key
AWS_STORAGE_BUCKET_NAME S3 storage bucket
RAVEN_DNS Sentry url
RAVEN_DSN_STACKTRACE Sentry url RAVEN_DNS
REDIS_HOST Redis host 127.0.0.1
REDIS_PORT Redis port 6379
REDIS_DB Redis db 1
REDIS_STAT_PORT For statistics REDIS_PORT
REDIS_STAT_HOST REDIS_HOST
REDIS_STAT_DB 15
UWSGI_PROCESSES
UWSGI_THREADS

Initialize your ElasticBeanstalk application

$ ebs-deploy init

Deploy your application

$ ebs-deploy deploy -e omaha-server-dev

Links

Copyright and license

This software is licensed under the Apache 2 license, quoted below.

Copyright 2014 Crystalnix Limited

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Packages

No packages published

Languages

  • Python 90.4%
  • HTML 4.4%
  • Protocol Buffer 3.8%
  • JavaScript 1.1%
  • Nginx 0.3%