def ubuntu_gisppa(): apt.add_rep('ppa:developmentseed/mapbox') apt.add_rep('ppa:sharpie/for-science') apt.add_rep('ppa:sharpie/postgis-stable') apt.add_rep('ppa:ubuntugis/ubuntugis-unstable') apt.update() apt.upgrade()
def ubuntu_basic(): apt.update() apt.upgrade() apt.install( 'btrfs-tools subversion git python-dev curl unzip htop dstat screen \ sysstat iotop powertop latencytop screen chkconfig python-software-properties vim mercurial curl \ git-core subversion wget make multitail sysbench')
def install(): if not os.geteuid() == 0: print("\033[31;1mMust be run as root\033[0m") return 2 try: print("\033[32mInstalling packages...\033[0m") apt.update() apt.upgrade() apt.install(PACKAGES) print("\033[32mAdding users and groups ...\033[0m") user.add_groups(GROUPS) user.add_users(USERS) print("\033[32mInstalling directories...\033[0m") files.install_dirs(DIRS) print("\033[32mInstalling files...\033[0m") files.install_files(FILES) print("\033[32mSucceed!\033[0m") except KeyboardInterrupt: pass except Exception: print("\033[31;1mError:\033[0m") raise
def start(): dirname = "/home/uchida" apt.upgrade() install.AptLibrary() install.LLVM(dirname) install.Nodejs(dirname) install.Emscripten(dirname) install.C2js(dirname,dirname)
def install(): if not os.geteuid() == 0: print_red("Must be run as root") return 2 try: print_green("Installing packages...") apt.update() apt.upgrade() apt.install(PACKAGES) print_green("Adding users and groups...") user.add_groups(GROUPS) user.add_users(USERS) print_green("Installing directories...") files.install_dirs(DIRS) print_green("Installing files...") files.install_files(FILES) print_green("Updating grub configs...") command.run('update-grub') print_green("Setting up MySQL...") command.run_sudo_script(""" mysql -e "CREATE USER 'appbooster'@'localhost' IDENTIFIED BY 'appbooster'; CREATE DATABASE appdb; GRANT ALL PRIVILEGES ON appdb.* TO 'appbooster'@'localhost';" """, check=False) print_green("Setting up Git server...") command.run_sudo_script(""" set -e if [ ! -f ~/.ssh/appbooster ]; then ssh-keygen -q -f /home/appbooster/.ssh/appbooster -N "" fi git config --global user.name "appbooster" git config --global user.email "appbooster@localhost" """, user='******') command.run_sudo_script(""" set -e if [ ! -d /home/git/repositories/gitolite-admin.git ]; then cd ~ gitolite setup -pk /home/appbooster/.ssh/appbooster.pub fi """, user='******') print_green("Setting up appbooster host...") command.run_sudo_script(""" set -e cd /home/appbooster/host virtualenv --no-site-packages ENV source ENV/bin/activate pip install -r requirements.txt export ENVIRONMENT=prod ./manage.py migrate deactivate """, user='******') command.run_sudo_script(""" mkdir -p ~/local/VREF ln -sf /home/appbooster/host/scripts/update ~/local/VREF/deploy """, user='******') print_green("Setting up appbooster stats...") command.run_sudo_script(""" set -e cd /home/appbooster/stats virtualenv --no-site-packages ENV source ENV/bin/activate pip install -r requirements.txt deactivate """, user='******') print_green("Installing elasticsearch and logstash...") command.run_script(""" ES_DEB_REPO="deb http://packages.elasticsearch.org/elasticsearch/1.4/debian stable main" LS_DEB_REPO="deb http://packages.elasticsearch.org/logstash/1.4/debian stable main" wget -O - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add - if ! grep -Fxq "$ES_DEB_REPO" /etc/apt/sources.list; then echo "$ES_DEB_REPO" >> /etc/apt/sources.list fi if ! grep -Fxq "$LS_DEB_REPO" /etc/apt/sources.list; then echo "$LS_DEB_REPO" >> /etc/apt/sources.list fi apt-get update apt-get -y install logstash elasticsearch """) print_green("Installing kibana...") command.run_script(""" KI_NAME="kibana-4.0.0-BETA2" if [[ ! -d /opt/$KI_NAME ]]; then wget -O - https://download.elasticsearch.org/kibana/kibana/$KI_NAME.tar.gz | tar -C /opt -xzf - fi cat << EOF > /usr/local/lib/systemd/system/kibana.service [Unit] Description=$KI_NAME After=elasticsearch.service [Service] Type=simple ExecStart=/opt/$KI_NAME/bin/kibana [Install] WantedBy=multi-user.target EOF """) print_green("Enabling systemd services...") command.run_script(""" systemctl daemon-reload systemctl enable docker-autostart.service systemctl enable logstash systemctl enable elasticsearch systemctl enable kibana systemctl stop logstash systemctl stop elasticsearch systemctl start logstash systemctl start elasticsearch systemctl stop kibana systemctl start kibana """) print_green("Restarting services...") command.run_sudo_script(""" sudo rm -f /etc/nginx/site-enabled/default """) command.run_script(""" systemctl reload uwsgi systemctl reload nginx """) print_green("Succeed!") except KeyboardInterrupt: pass except Exception: print_red("Error:") raise