├── .dockerignore ├── .gitignore ├── D17A - 52,63,61 ├── Presentation on Slackbot for Heroku.pdf ├── README.md ├── Report on Slackbot for Heroku.pdf └── code │ ├── HerokuBot │ ├── Procfile │ ├── get_bot_id.py │ ├── herokubot.py │ ├── requirements.txt │ └── runtime.txt │ └── sample-website-app │ ├── Procfile │ ├── composer.json │ ├── css │ ├── bootstrap.min.css │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ └── glyphicons-halflings-regular.woff │ ├── images │ │ ├── favicon.ico │ │ ├── header-bg.jpg │ │ ├── sprite.png │ │ ├── temp │ │ │ ├── about-image-1.png │ │ │ ├── about-image-2.png │ │ │ ├── avatar-1.jpg │ │ │ ├── avatar-2.jpg │ │ │ └── jumbotron-image.png │ │ └── testimonials-bg.jpg │ └── style.css │ ├── drone.json │ ├── footer.php │ ├── fragments │ └── home-inner.php │ ├── header.php │ ├── home-contact.php │ ├── home-subscribe.php │ ├── home.php │ ├── index.php │ ├── js │ ├── bootstrap.min.js │ ├── functions.js │ ├── jquery-1.11.0.min.js │ └── jquery.bxslider.min.js │ └── lib │ └── form-handler.php ├── D17A_48_62 ├── CCMiniProj.docx ├── CCMiniProj.pdf ├── CCMiniProjPPT.pdf ├── CCMiniProjPPT.pptx ├── ClientIaaS │ ├── .gitignore │ ├── .idea │ │ ├── compiler.xml │ │ ├── copyright │ │ │ └── profiles_settings.xml │ │ ├── gradle.xml │ │ ├── misc.xml │ │ ├── modules.xml │ │ └── runConfigurations.xml │ ├── app │ │ ├── .gitignore │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── androidTest │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── sagarpalo │ │ │ │ └── clientiaas │ │ │ │ └── ExampleInstrumentedTest.java │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── ic_launcher-web.png │ │ │ ├── java │ │ │ │ ├── com │ │ │ │ │ └── example │ │ │ │ │ │ └── sagarpalo │ │ │ │ │ │ └── clientiaas │ │ │ │ │ │ ├── AlarmReceiver.java │ │ │ │ │ │ ├── AppCompatPreferenceActivity.java │ │ │ │ │ │ ├── Common.java │ │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ │ ├── SettingsActivity.java │ │ │ │ │ │ └── WorkerService.java │ │ │ │ └── servercloudhandler │ │ │ │ │ └── MatrixOperation.java │ │ │ └── res │ │ │ │ ├── drawable-v21 │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_menu_camera.xml │ │ │ │ ├── ic_menu_gallery.xml │ │ │ │ ├── ic_menu_manage.xml │ │ │ │ ├── ic_menu_send.xml │ │ │ │ ├── ic_menu_share.xml │ │ │ │ └── ic_menu_slideshow.xml │ │ │ │ ├── drawable │ │ │ │ ├── ic_info_black_24dp.xml │ │ │ │ ├── ic_notifications_black_24dp.xml │ │ │ │ ├── ic_sync_black_24dp.xml │ │ │ │ ├── navhead.jpg │ │ │ │ └── side_nav_bar.xml │ │ │ │ ├── layout │ │ │ │ ├── activity_main.xml │ │ │ │ ├── app_bar_main.xml │ │ │ │ ├── content_main.xml │ │ │ │ └── nav_header_main.xml │ │ │ │ ├── menu │ │ │ │ ├── activity_main_drawer.xml │ │ │ │ └── main.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── values-v21 │ │ │ │ └── styles.xml │ │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ │ ├── values │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── drawables.xml │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ │ └── xml │ │ │ │ ├── pref_data_sync.xml │ │ │ │ ├── pref_general.xml │ │ │ │ ├── pref_headers.xml │ │ │ │ └── pref_notification.xml │ │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── sagarpalo │ │ │ └── clientiaas │ │ │ └── ExampleUnitTest.java │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle └── ServerCloudHandler │ ├── build.xml │ ├── build │ ├── built-jar.properties │ └── classes │ │ ├── .netbeans_automatic_build │ │ ├── .netbeans_update_resources │ │ └── servercloudhandler │ │ ├── Client.class │ │ ├── CreateJob.class │ │ ├── MatrixOperation.class │ │ ├── ServerCloudHandler$1.class │ │ ├── ServerCloudHandler.class │ │ ├── Test.class │ │ └── TestClient.class │ ├── dist │ ├── README.TXT │ └── ServerCloudHandler.jar │ ├── manifest.mf │ ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── private │ │ ├── private.properties │ │ └── private.xml │ ├── project.properties │ └── project.xml │ └── src │ └── servercloudhandler │ ├── CreateJob.java │ ├── ServerCloudHandler.java │ ├── Test.java │ └── TestClient.java ├── NetCanvas Documentation.docx ├── NetCanvas Documentation.pdf ├── NetCanvas.pptx ├── README.md ├── ReportCloudComputingMiniProject.pdf ├── Roll no(04,06,14) └── To Host Virtual Machine on Amazon Web Service.pdf ├── Server Monitoring using Prometheus and Grafana ├── README.md ├── SERVER MONITORING USING PROMETHEUS AND GRAFANA PPT.pdf └── SERVER MONITORING USING PROMETHEUS AND GRAFANA REPORT.pdf ├── app ├── .gitignore ├── Dockerfile ├── Gemfile ├── Gemfile.lock ├── README.md ├── Rakefile ├── app │ ├── assets │ │ ├── config │ │ │ └── manifest.js │ │ ├── images │ │ │ └── .keep │ │ ├── javascripts │ │ │ ├── application.js │ │ │ ├── cable.js │ │ │ ├── channels │ │ │ │ └── .keep │ │ │ └── posts.coffee │ │ └── stylesheets │ │ │ ├── application.css │ │ │ ├── posts.scss │ │ │ └── scaffolds.scss │ ├── channels │ │ └── application_cable │ │ │ ├── channel.rb │ │ │ └── connection.rb │ ├── controllers │ │ ├── application_controller.rb │ │ ├── concerns │ │ │ └── .keep │ │ └── posts_controller.rb │ ├── helpers │ │ ├── application_helper.rb │ │ └── posts_helper.rb │ ├── jobs │ │ └── application_job.rb │ ├── mailers │ │ └── application_mailer.rb │ ├── models │ │ ├── application_record.rb │ │ ├── concerns │ │ │ └── .keep │ │ └── post.rb │ └── views │ │ ├── layouts │ │ ├── application.html.erb │ │ ├── mailer.html.erb │ │ └── mailer.text.erb │ │ └── posts │ │ ├── _form.html.erb │ │ ├── _post.json.jbuilder │ │ ├── edit.html.erb │ │ ├── index.html.erb │ │ ├── index.json.jbuilder │ │ ├── new.html.erb │ │ ├── show.html.erb │ │ └── show.json.jbuilder ├── bin │ ├── bundle │ ├── rails │ ├── rake │ ├── setup │ ├── spring │ └── update ├── config.ru ├── config │ ├── application.rb │ ├── boot.rb │ ├── cable.yml │ ├── database.yml │ ├── environment.rb │ ├── environments │ │ ├── development.rb │ │ ├── production.rb │ │ └── test.rb │ ├── initializers │ │ ├── application_controller_renderer.rb │ │ ├── assets.rb │ │ ├── backtrace_silencers.rb │ │ ├── cookies_serializer.rb │ │ ├── filter_parameter_logging.rb │ │ ├── inflections.rb │ │ ├── mime_types.rb │ │ ├── new_framework_defaults.rb │ │ ├── session_store.rb │ │ └── wrap_parameters.rb │ ├── locales │ │ └── en.yml │ ├── puma.rb │ ├── routes.rb │ ├── secrets.yml │ └── spring.rb ├── db │ ├── migrate │ │ └── 20170319105741_create_posts.rb │ └── seeds.rb ├── lib │ ├── assets │ │ └── .keep │ └── tasks │ │ └── .keep ├── log │ └── .keep ├── public │ ├── 404.html │ ├── 422.html │ ├── 500.html │ ├── apple-touch-icon-precomposed.png │ ├── apple-touch-icon.png │ ├── favicon.ico │ └── robots.txt ├── test │ ├── controllers │ │ ├── .keep │ │ └── posts_controller_test.rb │ ├── fixtures │ │ ├── .keep │ │ ├── files │ │ │ └── .keep │ │ └── posts.yml │ ├── helpers │ │ └── .keep │ ├── integration │ │ └── .keep │ ├── mailers │ │ └── .keep │ ├── models │ │ ├── .keep │ │ └── post_test.rb │ └── test_helper.rb ├── tmp │ └── .keep └── vendor │ └── assets │ ├── javascripts │ └── .keep │ └── stylesheets │ └── .keep ├── db └── Dockerfile ├── docker-compose.yml ├── elasticsearch ├── Dockerfile └── config │ └── elasticsearch.yml ├── kibana ├── Dockerfile ├── config │ └── kibana.yml └── entrypoint.sh ├── logstash ├── Dockerfile ├── config │ └── logstash.yml └── pipeline │ └── logstash.conf └── nginx ├── Dockerfile └── config └── nginx.conf /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .dockerignore 3 | Gemfile.lock 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /screenshots 2 | /sample data/ 3 | .app.env 4 | nginx/config/.htpasswd 5 | -------------------------------------------------------------------------------- /D17A - 52,63,61/Presentation on Slackbot for Heroku.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A - 52,63,61/Presentation on Slackbot for Heroku.pdf -------------------------------------------------------------------------------- /D17A - 52,63,61/README.md: -------------------------------------------------------------------------------- 1 | # Slackbot for Heroku 2 | 3 | A chatbot for Slack written in Python that lets a team control a Heroku account. 4 | 5 | ## Authors 6 | 7 | * **R.Harikrishnan (D17A/52)** 8 | * **Abhishek Shetye (D17A/63)** 9 | * **Salil Shahane (D17A/61)** 10 | -------------------------------------------------------------------------------- /D17A - 52,63,61/Report on Slackbot for Heroku.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A - 52,63,61/Report on Slackbot for Heroku.pdf -------------------------------------------------------------------------------- /D17A - 52,63,61/code/HerokuBot/Procfile: -------------------------------------------------------------------------------- 1 | worker: python herokubot.py 2 | -------------------------------------------------------------------------------- /D17A - 52,63,61/code/HerokuBot/get_bot_id.py: -------------------------------------------------------------------------------- 1 | from slackclient import SlackClient 2 | 3 | BOT_NAME = 'XXXX' 4 | bot_token = 'XXXXXXXX-XXXXXXXXX' 5 | 6 | slack_client = SlackClient(bot_token) 7 | 8 | if __name__ == "__main__": 9 | api_call = slack_client.api_call("users.list") 10 | if api_call.get('ok'): 11 | # retrieve all users so we can find our bot 12 | users = api_call.get('members') 13 | for user in users: 14 | if 'name' in user and user.get('name') == BOT_NAME: 15 | print("Bot ID for '" + user['name'] + "' is " + user.get('id')) 16 | else: 17 | print("could not find bot user with the name " + BOT_NAME) -------------------------------------------------------------------------------- /D17A - 52,63,61/code/HerokuBot/herokubot.py: -------------------------------------------------------------------------------- 1 | import time 2 | from slackclient import SlackClient 3 | import heroku3 4 | import requests 5 | 6 | SLACK_BOT_TOKEN = 'XXXX-XXXXXX' 7 | SLACK_BOT_ID = 'XXXXXXXXX' 8 | SLACK_BOT_TAG = "<@" + SLACK_BOT_ID + ">" 9 | HEROKU_API_KEY = 'XXXXXX-XXXXXXXXXXX-XXXXXXX-XXXXXXXX' 10 | 11 | slack_client = SlackClient(SLACK_BOT_TOKEN) 12 | heroku_conn = heroku3.from_key(HEROKU_API_KEY) 13 | 14 | def create_app(app_name): 15 | try: 16 | heroku_conn.create_app(app_name) 17 | return True 18 | except TypeError as te: 19 | return False 20 | 21 | def rename_app(old_app_name, new_app_name): 22 | try: 23 | heroku_conn.app(old_app_name).rename(new_app_name) 24 | return True 25 | except requests.exceptions.HTTPError as he: 26 | return False 27 | 28 | def delete_app(app_name): 29 | try: 30 | heroku_conn.app(app_name).delete() 31 | return True 32 | except requests.exceptions.HTTPError as he: 33 | return False 34 | 35 | def app_exists(app_name): 36 | apps = heroku_conn.apps() 37 | for app in apps: 38 | if app.name == app_name: 39 | return True 40 | return False 41 | 42 | def fork_app(original_app_name, new_app_name): 43 | response = '' 44 | if app_exists(original_app_name) == False: 45 | response = original_app_name + ' does not exist' 46 | return False, response 47 | if app_exists(new_app_name) == False: 48 | response = new_app_name + ' does not exist. Creating...\n' 49 | create_success = create_app(new_app_name) 50 | if create_success: 51 | response += (new_app_name + ' created successfully\n') 52 | else: 53 | response += (new_app_name + ' could not be created') 54 | return False, response 55 | slug_id = get_latest_slug_id(original_app_name) 56 | create_new_release(slug_id, new_app_name) 57 | response += (original_app_name + ' has been forked successfully') 58 | return True, response 59 | 60 | def get_latest_slug_id(app_name): 61 | url = 'https://api.heroku.com/apps/' + app_name + '/releases' 62 | headers = {'Content-Type': 'application/json', 63 | 'Accept': 'application/vnd.heroku+json; version=3', 64 | 'Authorization': 'Bearer ' + HEROKU_API_KEY} 65 | response = requests.get(url=url, headers=headers) 66 | return response.json()[-1]['slug']['id'] 67 | 68 | def create_new_release(slug_id, new_app_name): 69 | url = 'https://api.heroku.com/apps/' + new_app_name + '/releases' 70 | headers = {'Content-Type': 'application/json', 71 | 'Accept': 'application/vnd.heroku+json; version=3', 72 | 'Authorization': 'Bearer ' + HEROKU_API_KEY} 73 | data = '{"slug": "' + slug_id + '"}' 74 | requests.post(url=url, headers=headers, data=data) 75 | 76 | def get_logs(app_name, lines): 77 | if app_exists(app_name) == False: 78 | response = app_name + ' does not exist' 79 | return False, response 80 | log_url = create_log_url(app_name, lines) 81 | return True, requests.get(log_url).text 82 | 83 | def create_log_url(app_name, lines): 84 | url = 'https://api.heroku.com/apps/' + app_name + '/log-sessions' 85 | headers = {'Content-Type': 'application/json', 86 | 'Accept': 'application/vnd.heroku+json; version=3', 87 | 'Authorization': 'Bearer ' + HEROKU_API_KEY} 88 | data = '{"lines": "' + lines + '"}' 89 | r = requests.post(url=url, headers=headers, data=data) 90 | return r.json()["logplex_url"] 91 | 92 | def handle_command(command, channel): 93 | """ 94 | Receives commands directed at the bot and determines if they 95 | are valid commands. If so, then acts on the commands. 96 | """ 97 | 98 | print('Received request : ' + command) 99 | response = '' 100 | # parse command arguments 101 | try: 102 | 103 | if command.startswith("create app"): 104 | app_name = command.split(" ")[2] 105 | success = create_app(app_name) 106 | if success: 107 | response = app_name + ' has been created successfully' 108 | else: 109 | response = app_name + ' could not be created as the name has been taken already' 110 | 111 | elif command.startswith("rename app"): 112 | old_app_name = command.split(" ")[2] 113 | new_app_name = command.split(" ")[4] 114 | success = rename_app(old_app_name, new_app_name) 115 | if success: 116 | response = old_app_name + ' has been renamed successfully' 117 | else: 118 | response = old_app_name + ' could not be renamed as it does not exist, or the name ' + new_app_name + \ 119 | ' has already been taken' 120 | 121 | elif command.startswith("delete app"): 122 | app_name = command.split(" ")[2] 123 | success = delete_app(app_name) 124 | if success: 125 | response = app_name + ' has been deleted successfully' 126 | else: 127 | response = app_name + ' does not exist' 128 | 129 | elif command.startswith("list apps"): 130 | apps = heroku_conn.apps() 131 | response = '' 132 | for app in apps: 133 | response = response + "ID : " + app.id + " Name : " + app.name + "\n" 134 | 135 | elif command.startswith("fork app"): 136 | original_app_name = command.split(" ")[2] 137 | new_app_name = command.split(" ")[4] 138 | success, response = fork_app(original_app_name, new_app_name) 139 | 140 | elif command.startswith("get logs for"): 141 | app_name = command.split(" ")[3] 142 | lines = command.split(" ")[4][6:] 143 | success, response = get_logs(app_name, lines) 144 | 145 | else: 146 | response = "Invalid command." 147 | print("An invalid command was given : " + command) 148 | 149 | except Exception as e: 150 | print("An exception was thrown : " + str(e)) 151 | response = 'An error occurred.' 152 | 153 | slack_client.api_call("chat.postMessage", channel=channel, 154 | text=response, as_user=True) 155 | 156 | 157 | def parse_slack_output(slack_rtm_output): 158 | """ 159 | The Slack Real Time Messaging API is an events firehose. 160 | this parsing function returns None unless a message is 161 | directed at the Bot, based on its ID. 162 | """ 163 | output_list = slack_rtm_output 164 | if output_list and len(output_list) > 0: 165 | for output in output_list: 166 | if output and output['type'] == 'message' and 'text' in output: 167 | message_text = output['text'] 168 | if message_text != '' and message_text.startswith(SLACK_BOT_TAG): 169 | return message_text.split(SLACK_BOT_TAG)[1].strip().lower(), output['channel'] 170 | return None, None 171 | 172 | 173 | if __name__ == "__main__": 174 | READ_WEBSOCKET_DELAY = 1 175 | if slack_client.rtm_connect(): 176 | print("HerokuBot has started successfully.") 177 | while True: 178 | command, channel = parse_slack_output(slack_client.rtm_read()) 179 | if command and channel: 180 | handle_command(command, channel) 181 | time.sleep(READ_WEBSOCKET_DELAY) 182 | else: 183 | print("Connection failed. Invalid Slack token or bot ID ?") -------------------------------------------------------------------------------- /D17A - 52,63,61/code/HerokuBot/requirements.txt: -------------------------------------------------------------------------------- 1 | slackclient==1.0.5 2 | heroku3==3.2.2 3 | -------------------------------------------------------------------------------- /D17A - 52,63,61/code/HerokuBot/runtime.txt: -------------------------------------------------------------------------------- 1 | python-3.6.1 2 | -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/Procfile: -------------------------------------------------------------------------------- 1 | web: vendor/bin/heroku-php-nginx 2 | -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/composer.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/css/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A - 52,63,61/code/sample-website-app/css/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/css/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A - 52,63,61/code/sample-website-app/css/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/css/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A - 52,63,61/code/sample-website-app/css/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/css/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A - 52,63,61/code/sample-website-app/css/images/favicon.ico -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/css/images/header-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A - 52,63,61/code/sample-website-app/css/images/header-bg.jpg -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/css/images/sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A - 52,63,61/code/sample-website-app/css/images/sprite.png -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/css/images/temp/about-image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A - 52,63,61/code/sample-website-app/css/images/temp/about-image-1.png -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/css/images/temp/about-image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A - 52,63,61/code/sample-website-app/css/images/temp/about-image-2.png -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/css/images/temp/avatar-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A - 52,63,61/code/sample-website-app/css/images/temp/avatar-1.jpg -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/css/images/temp/avatar-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A - 52,63,61/code/sample-website-app/css/images/temp/avatar-2.jpg -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/css/images/temp/jumbotron-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A - 52,63,61/code/sample-website-app/css/images/temp/jumbotron-image.png -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/css/images/testimonials-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A - 52,63,61/code/sample-website-app/css/images/testimonials-bg.jpg -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/drone.json: -------------------------------------------------------------------------------- 1 | {"state":"setup","repo":"svn+ssh://workstation/var/svn/html/mark_gadala/lucid","dir":"E:\\Server\\mark_gadala\\lucid\\html","mysql":{"name":"test","prefix":""},"home_url":"http://mmitev.int/mark_gadala/lucid/html"} -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/footer.php: -------------------------------------------------------------------------------- 1 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/header.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Lucid 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 |
26 | 71 | -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/home-contact.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 |
6 |
7 |
8 |
Introducing Lucid Theme
9 | 10 |

Carefully crafted and beautiful landing page.

11 | 12 |

Etiam ullamcorper et turpis eget hendrerit. Praesent varius risus mi, at elementum magna ultricies acum magna ultricies accumsan. Cras venenatis lacus sed dolor placerat tempus. Morbi blandit at neque ut imperdiet.

13 | 14 |
15 | Download Now 16 | 17 | View Features 18 |
19 |
20 |
21 | 22 |
23 |
24 | sent): ?> 25 |

Thanks for contacting us! We will get in touch with you shortly.

26 | 27 |
28 |
29 |

Get in touch

30 | 31 |

Please complete the form

32 |
33 | 34 |
35 |
36 | 37 | 38 |
39 | 40 |
41 |
42 | 43 |
44 | 45 | 46 |
47 | 48 |
49 |
50 | 51 |
52 | 53 | 54 |
55 | 56 |
57 |
58 | 59 |
60 | 61 | 62 |
63 | 64 |
65 |
66 |
67 | 68 |
69 | 70 |
71 |
72 | 73 |
74 |
75 |
76 |
77 |
78 |
79 | 80 | 81 | -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/home-subscribe.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 |
6 |
7 |
8 |
Introducing Lucid Theme
9 | 10 |

Carefully crafted and beautiful landing page.

11 | 12 |

Etiam ullamcorper et turpis eget hendrerit. Praesent varius risus mi, at elementum magna ultricies acum magna ultricies accumsan. Cras venenatis lacus sed dolor placerat tempus. Morbi blandit at neque ut imperdiet.

13 | 14 | 23 |
24 |
25 |
26 |
27 |
28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/home.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 |
6 |
7 |
8 |
Introducing Lucid Theme
9 | 10 |

Carefully crafted and beautiful landing page.

11 | 12 |

Etiam ullamcorper et turpis eget hendrerit. Praesent varius risus mi, at elementum magna ultricies acum magna ultricies accumsan. Cras venenatis lacus sed dolor placerat tempus. Morbi blandit at neque ut imperdiet.

13 | 14 |
15 | Download Now 16 | 17 | View Features 18 |
19 |
20 |
21 | 22 |
23 |
24 | 25 |
26 |
27 |
28 |
29 |
30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/index.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/js/functions.js: -------------------------------------------------------------------------------- 1 | ;(function($, window, document, undefined) { 2 | var $win = $(window); 3 | var $doc = $(document); 4 | 5 | $doc.ready(function() { 6 | 7 | // Testimonial Slider 8 | $('.slider-testimoinals .slides').bxSlider({ 9 | controls: false, 10 | auto: true, 11 | pause: 5000 12 | }); 13 | 14 | 15 | // Navigation Scroll Animation 16 | $('.nav a').on('click', function(event) { 17 | event.preventDefault(); 18 | var href = $(this).attr('href'); 19 | var offsetTop = $(href).offset().top; 20 | 21 | $('html, body').animate({ scrollTop : offsetTop }, { 22 | queue: false, 23 | duration: 800 24 | }); 25 | }); 26 | 27 | 28 | // Map 29 | var geocoder; 30 | var map; 31 | var latlng; 32 | var address = $('#map').data('address'); 33 | 34 | function initialize() { 35 | geocoder = new google.maps.Geocoder(); 36 | latlng = new google.maps.LatLng(25.763665, -80.189397); 37 | var mapOptions = { 38 | zoom: 17, 39 | center: latlng, 40 | scrollwheel: false, 41 | disableDefaultUI: true 42 | }; 43 | 44 | geocoder.geocode( { 'address': address}, function(results, status) { 45 | if (status == google.maps.GeocoderStatus.OK) { 46 | map.setCenter(results[0].geometry.location); 47 | var marker = new google.maps.Marker({ 48 | map: map, 49 | position: results[0].geometry.location 50 | }); 51 | latlng = new google.maps.LatLng(results[0].geometry.location.k, results[0].geometry.location.D); 52 | } 53 | }); 54 | 55 | map = new google.maps.Map(document.getElementById('map'), 56 | mapOptions); 57 | } 58 | 59 | google.maps.event.addDomListener(window, 'load', initialize); 60 | 61 | window.addEventListener('resize', function() { 62 | map.setCenter(latlng); 63 | }, false); 64 | 65 | window.addEventListener('orientationchange', function() { 66 | map.setCenter(latlng); 67 | }, false); 68 | 69 | }); 70 | })(jQuery, window, document); 71 | -------------------------------------------------------------------------------- /D17A - 52,63,61/code/sample-website-app/lib/form-handler.php: -------------------------------------------------------------------------------- 1 | receiver = $receiver; 16 | 17 | $this->fields = array( 18 | 'contact-name' => array( 19 | 'value' => '', 20 | 'label' => 'Name', 21 | 'type' => 'text', 22 | 'required' => true, 23 | ), 24 | 'contact-email' => array( 25 | 'value' => '', 26 | 'label' => 'Email', 27 | 'type' => 'email', 28 | 'required' => true, 29 | ), 30 | 'contact-subject' => array( 31 | 'value' => '', 32 | 'label' => 'Subject', 33 | 'type' => 'text', 34 | 'required' => true, 35 | ), 36 | 'contact-message' => array( 37 | 'value' => '', 38 | 'label' => 'Message', 39 | 'type' => 'textarea', 40 | 'required' => true, 41 | ), 42 | ); 43 | 44 | if (!isset($_POST['contact-form'])) { 45 | return; 46 | } 47 | 48 | foreach ($this->fields as $name => &$data) { 49 | if (!empty($_POST[$name])) { 50 | $data['value'] = htmlspecialchars($_POST[$name]); 51 | } 52 | 53 | if ($data['required']) { 54 | $error = false; 55 | 56 | switch ($data['type']) { 57 | case 'email': 58 | $error = !filter_var($data['value'], FILTER_VALIDATE_EMAIL); 59 | break; 60 | 61 | default: 62 | $error = $data['value'] === ''; 63 | break; 64 | } 65 | 66 | if ($error) { 67 | $this->errors[] = $name; 68 | } 69 | } 70 | } 71 | 72 | if (!$this->errors) { 73 | $from = $this->fields['contact-email']['value']; 74 | $subject = 'Lucid - Contact Form'; 75 | 76 | //email body 77 | $message = ''; 78 | foreach ($this->fields as $field) { 79 | $message .= '' . $field['label'] . ': ' . ($field['type'] == 'textarea' ? '

' : '') . nl2br($field['value']) . '

'; 80 | } 81 | 82 | //email headers 83 | $headers = 'From: ' . $from .'' . "\r\n"; 84 | $headers .= 'Reply-To: ' . $from . '' . "\r\n"; 85 | $headers .= 'MIME-Version: 1.0' . "\r\n" . "Content-type: text/html; charset='utf-8'" . "\r\n"; 86 | $headers .= 'X-Mailer: PHP/' . phpversion(); 87 | 88 | $this->sent = mail($this->receiver, $subject, $message, $headers); 89 | } 90 | } 91 | 92 | function is_valid($name) { 93 | if (in_array($name, $this->errors)) { 94 | return false; 95 | } 96 | 97 | return true; 98 | } 99 | 100 | function get_value($name) { 101 | $value = ''; 102 | 103 | if (isset($this->fields[$name])) { 104 | $value = $this->fields[$name]['value']; 105 | } 106 | 107 | return $value; 108 | } 109 | } 110 | 111 | -------------------------------------------------------------------------------- /D17A_48_62/CCMiniProj.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A_48_62/CCMiniProj.docx -------------------------------------------------------------------------------- /D17A_48_62/CCMiniProj.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A_48_62/CCMiniProj.pdf -------------------------------------------------------------------------------- /D17A_48_62/CCMiniProjPPT.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A_48_62/CCMiniProjPPT.pdf -------------------------------------------------------------------------------- /D17A_48_62/CCMiniProjPPT.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A_48_62/CCMiniProjPPT.pptx -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.2" 6 | defaultConfig { 7 | applicationId "com.example.sagarpalo.clientiaas" 8 | minSdkVersion 15 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | vectorDrawables.useSupportLibrary = true 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | } 22 | 23 | dependencies { 24 | compile fileTree(dir: 'libs', include: ['*.jar']) 25 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 26 | exclude group: 'com.android.support', module: 'support-annotations' 27 | }) 28 | compile 'com.android.support:appcompat-v7:25.1.0' 29 | compile 'com.android.support:design:25.1.0' 30 | compile 'com.android.support:support-v4:25.1.0' 31 | compile 'com.android.support:support-vector-drawable:25.1.0' 32 | testCompile 'junit:junit:4.12' 33 | } 34 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in F:\SAGAR\Android\android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/androidTest/java/com/example/sagarpalo/clientiaas/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.example.sagarpalo.clientiaas; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.example.sagarpalo.clientiaas", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 15 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 31 | 32 | 35 | 36 | 37 | 38 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A_48_62/ClientIaaS/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/java/com/example/sagarpalo/clientiaas/AlarmReceiver.java: -------------------------------------------------------------------------------- 1 | package com.example.sagarpalo.clientiaas; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | 7 | /** 8 | * Created by Sagar Palo on 2017-03-28. 9 | */ 10 | 11 | public class AlarmReceiver extends BroadcastReceiver { 12 | public static final int REQUEST_CODE = 12345; 13 | public static final String ACTION = "com.example.sagarpalo.cliantiaas.alarm"; 14 | 15 | @Override 16 | public void onReceive(Context context, Intent intent) { 17 | 18 | context.startService(new Intent(context, WorkerService.class)); 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/java/com/example/sagarpalo/clientiaas/AppCompatPreferenceActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.sagarpalo.clientiaas; 2 | 3 | import android.content.res.Configuration; 4 | import android.os.Bundle; 5 | import android.preference.PreferenceActivity; 6 | import android.support.annotation.LayoutRes; 7 | import android.support.annotation.Nullable; 8 | import android.support.v7.app.ActionBar; 9 | import android.support.v7.app.AppCompatDelegate; 10 | import android.support.v7.widget.Toolbar; 11 | import android.view.MenuInflater; 12 | import android.view.View; 13 | import android.view.ViewGroup; 14 | 15 | /** 16 | * A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls 17 | * to be used with AppCompat. 18 | */ 19 | public abstract class AppCompatPreferenceActivity extends PreferenceActivity { 20 | 21 | private AppCompatDelegate mDelegate; 22 | 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | getDelegate().installViewFactory(); 26 | getDelegate().onCreate(savedInstanceState); 27 | super.onCreate(savedInstanceState); 28 | } 29 | 30 | @Override 31 | protected void onPostCreate(Bundle savedInstanceState) { 32 | super.onPostCreate(savedInstanceState); 33 | getDelegate().onPostCreate(savedInstanceState); 34 | } 35 | 36 | public ActionBar getSupportActionBar() { 37 | return getDelegate().getSupportActionBar(); 38 | } 39 | 40 | public void setSupportActionBar(@Nullable Toolbar toolbar) { 41 | getDelegate().setSupportActionBar(toolbar); 42 | } 43 | 44 | @Override 45 | public MenuInflater getMenuInflater() { 46 | return getDelegate().getMenuInflater(); 47 | } 48 | 49 | @Override 50 | public void setContentView(@LayoutRes int layoutResID) { 51 | getDelegate().setContentView(layoutResID); 52 | } 53 | 54 | @Override 55 | public void setContentView(View view) { 56 | getDelegate().setContentView(view); 57 | } 58 | 59 | @Override 60 | public void setContentView(View view, ViewGroup.LayoutParams params) { 61 | getDelegate().setContentView(view, params); 62 | } 63 | 64 | @Override 65 | public void addContentView(View view, ViewGroup.LayoutParams params) { 66 | getDelegate().addContentView(view, params); 67 | } 68 | 69 | @Override 70 | protected void onPostResume() { 71 | super.onPostResume(); 72 | getDelegate().onPostResume(); 73 | } 74 | 75 | @Override 76 | protected void onTitleChanged(CharSequence title, int color) { 77 | super.onTitleChanged(title, color); 78 | getDelegate().setTitle(title); 79 | } 80 | 81 | @Override 82 | public void onConfigurationChanged(Configuration newConfig) { 83 | super.onConfigurationChanged(newConfig); 84 | getDelegate().onConfigurationChanged(newConfig); 85 | } 86 | 87 | @Override 88 | protected void onStop() { 89 | super.onStop(); 90 | getDelegate().onStop(); 91 | } 92 | 93 | @Override 94 | protected void onDestroy() { 95 | super.onDestroy(); 96 | getDelegate().onDestroy(); 97 | } 98 | 99 | public void invalidateOptionsMenu() { 100 | getDelegate().invalidateOptionsMenu(); 101 | } 102 | 103 | private AppCompatDelegate getDelegate() { 104 | if (mDelegate == null) { 105 | mDelegate = AppCompatDelegate.create(this, null); 106 | } 107 | return mDelegate; 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/java/com/example/sagarpalo/clientiaas/Common.java: -------------------------------------------------------------------------------- 1 | package com.example.sagarpalo.clientiaas; 2 | 3 | /** 4 | * Created by Sagar Palo on 2017-03-26. 5 | */ 6 | 7 | public class Common extends android.app.Application { 8 | 9 | public static String IP="192.168.1.103"; 10 | @Override 11 | public void onCreate() { 12 | super.onCreate(); 13 | 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/java/com/example/sagarpalo/clientiaas/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.sagarpalo.clientiaas; 2 | 3 | import android.app.AlarmManager; 4 | import android.app.PendingIntent; 5 | import android.content.BroadcastReceiver; 6 | import android.content.Context; 7 | import android.content.Intent; 8 | import android.content.IntentFilter; 9 | import android.os.Bundle; 10 | import android.support.design.widget.FloatingActionButton; 11 | import android.support.design.widget.Snackbar; 12 | import android.support.v4.content.LocalBroadcastManager; 13 | import android.util.Log; 14 | import android.view.View; 15 | import android.support.design.widget.NavigationView; 16 | import android.support.v4.view.GravityCompat; 17 | import android.support.v4.widget.DrawerLayout; 18 | import android.support.v7.app.ActionBarDrawerToggle; 19 | import android.support.v7.app.AppCompatActivity; 20 | import android.support.v7.widget.Toolbar; 21 | import android.view.Menu; 22 | import android.view.MenuItem; 23 | import android.widget.EditText; 24 | import android.widget.TextView; 25 | 26 | import java.io.BufferedReader; 27 | import java.io.IOException; 28 | import java.io.InputStreamReader; 29 | 30 | 31 | public class MainActivity extends AppCompatActivity 32 | implements NavigationView.OnNavigationItemSelectedListener { 33 | 34 | TextView txtstatus,txtcpu,txtip; 35 | String status; 36 | int[] cpuusage; 37 | android.content.SharedPreferences pref; 38 | 39 | @Override 40 | protected void onCreate(Bundle savedInstanceState) { 41 | 42 | 43 | super.onCreate(savedInstanceState); 44 | setContentView(R.layout.activity_main); 45 | 46 | pref = android.preference.PreferenceManager.getDefaultSharedPreferences(this); 47 | String value = pref.getString("ip_text", "192.168.1.103"); 48 | Common.IP=value; 49 | Log.d("IP", Common.IP); 50 | 51 | txtstatus = (TextView) findViewById(R.id.txtstatus); 52 | txtip = (TextView) findViewById(R.id.txtip); 53 | txtcpu = (TextView) findViewById(R.id.txtcpu); 54 | 55 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 56 | setSupportActionBar(toolbar); 57 | 58 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); 59 | ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( 60 | this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); 61 | drawer.setDrawerListener(toggle); 62 | toggle.syncState(); 63 | 64 | NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); 65 | navigationView.setNavigationItemSelectedListener(this); 66 | 67 | IntentFilter statusIntentFilter = new IntentFilter(Constants.BROADCAST_ACTION); 68 | DownloadStateReceiver mDownloadStateReceiver = new DownloadStateReceiver(); 69 | LocalBroadcastManager.getInstance(this).registerReceiver(mDownloadStateReceiver,statusIntentFilter); 70 | 71 | startService(new Intent(this, WorkerService.class)); 72 | scheduleAlarm(); 73 | 74 | cpuusage = getCpuUsageStatistic(); 75 | show("Initiating as mini cloud...",cpuusage); 76 | 77 | } 78 | 79 | // Setup a recurring alarm every half hour 80 | public void scheduleAlarm() { 81 | Intent intent = new Intent(getApplicationContext(), AlarmReceiver.class); 82 | final PendingIntent pIntent = PendingIntent.getBroadcast(this, AlarmReceiver.REQUEST_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT); 83 | long firstMillis = System.currentTimeMillis(); 84 | AlarmManager alarm = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE); 85 | alarm.setInexactRepeating(AlarmManager.RTC_WAKEUP, firstMillis, 10 * 1000, pIntent); 86 | } 87 | 88 | @Override 89 | protected void onResume() { 90 | startService(new Intent(this, WorkerService.class)); 91 | super.onResume(); 92 | } 93 | 94 | @Override 95 | public void onBackPressed() { 96 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); 97 | if (drawer.isDrawerOpen(GravityCompat.START)) { 98 | drawer.closeDrawer(GravityCompat.START); 99 | } else { 100 | super.onBackPressed(); 101 | } 102 | } 103 | 104 | @Override 105 | public boolean onCreateOptionsMenu(Menu menu) { 106 | // Inflate the menu; this adds items to the action bar if it is present. 107 | getMenuInflater().inflate(R.menu.main, menu); 108 | return true; 109 | } 110 | 111 | @Override 112 | public boolean onOptionsItemSelected(MenuItem item) { 113 | // Handle action bar item clicks here. The action bar will 114 | // automatically handle clicks on the Home/Up button, so long 115 | // as you specify a parent activity in AndroidManifest.xml. 116 | int id = item.getItemId(); 117 | 118 | //noinspection SimplifiableIfStatement 119 | if (id == R.id.action_settings) { 120 | Intent intent = new Intent(this, SettingsActivity.class); 121 | startActivity(intent); 122 | return true; 123 | } 124 | 125 | return super.onOptionsItemSelected(item); 126 | } 127 | 128 | @SuppressWarnings("StatementWithEmptyBody") 129 | @Override 130 | public boolean onNavigationItemSelected(MenuItem item) { 131 | // Handle navigation view item clicks here. 132 | return true; 133 | } 134 | 135 | void show(String message,int[] cpuUsage){ 136 | android.util.Log.i("Message3",message); 137 | txtstatus.setText(message); 138 | txtcpu.setText("User: " + cpuUsage[0] + " %" + " | System: " + cpuUsage[1] + " %"); 139 | txtip.setText(Common.IP); 140 | } 141 | 142 | private int[] getCpuUsageStatistic() { 143 | 144 | String tempString = executeTop(); 145 | 146 | tempString = tempString.replaceAll(",", ""); 147 | tempString = tempString.replaceAll("User", ""); 148 | tempString = tempString.replaceAll("System", ""); 149 | tempString = tempString.replaceAll("IOW", ""); 150 | tempString = tempString.replaceAll("IRQ", ""); 151 | tempString = tempString.replaceAll("%", ""); 152 | for (int i = 0; i < 10; i++) { 153 | tempString = tempString.replaceAll(" ", " "); 154 | } 155 | tempString = tempString.trim(); 156 | String[] myString = tempString.split(" "); 157 | int[] cpuUsageAsInt = new int[myString.length]; 158 | for (int i = 0; i < myString.length; i++) { 159 | myString[i] = myString[i].trim(); 160 | cpuUsageAsInt[i] = Integer.parseInt(myString[i]); 161 | } 162 | return cpuUsageAsInt; 163 | } 164 | 165 | private String executeTop() { 166 | java.lang.Process p = null; 167 | BufferedReader in = null; 168 | String returnString = null; 169 | try { 170 | p = Runtime.getRuntime().exec("top -n 1"); 171 | in = new BufferedReader(new InputStreamReader(p.getInputStream())); 172 | while (returnString == null || returnString.contentEquals("")) { 173 | returnString = in.readLine(); 174 | } 175 | } catch (IOException e) { 176 | Log.e("executeTop", "error in getting first line of top"); 177 | e.printStackTrace(); 178 | } finally { 179 | try { 180 | in.close(); 181 | p.destroy(); 182 | } catch (IOException e) { 183 | Log.e("executeTop", 184 | "error in closing and destroying top process"); 185 | e.printStackTrace(); 186 | } 187 | } 188 | return returnString; 189 | } 190 | 191 | public final class Constants { 192 | 193 | // Defines a custom Intent action 194 | public static final String BROADCAST_ACTION = "com.example.sagarpalo.clientiaas.BROADCAST"; 195 | 196 | // Defines the key for the status "extra" in an Intent 197 | public static final String EXTENDED_DATA_STATUS = "com.example.sagarpalo.clientiaas.STATUS"; 198 | public static final String EXTENDED_DATA_STATUS2 = "com.example.sagarpalo.clientiaas.STATUS2"; 199 | 200 | } 201 | 202 | private class DownloadStateReceiver extends BroadcastReceiver 203 | { 204 | private DownloadStateReceiver() { 205 | 206 | } 207 | @Override 208 | public void onReceive(Context context, Intent intent) { 209 | status = intent.getStringExtra(Constants.EXTENDED_DATA_STATUS); 210 | cpuusage = intent.getIntArrayExtra(Constants.EXTENDED_DATA_STATUS2); 211 | android.util.Log.i("Message2",status); 212 | show(status,cpuusage); 213 | } 214 | } 215 | } 216 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/java/com/example/sagarpalo/clientiaas/SettingsActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.sagarpalo.clientiaas; 2 | 3 | 4 | import android.annotation.TargetApi; 5 | import android.content.Context; 6 | import android.content.Intent; 7 | import android.content.res.Configuration; 8 | import android.media.Ringtone; 9 | import android.media.RingtoneManager; 10 | import android.net.Uri; 11 | import android.os.Build; 12 | import android.os.Bundle; 13 | import android.preference.ListPreference; 14 | import android.preference.Preference; 15 | import android.preference.PreferenceActivity; 16 | import android.support.v7.app.ActionBar; 17 | import android.preference.PreferenceFragment; 18 | import android.preference.PreferenceManager; 19 | import android.preference.RingtonePreference; 20 | import android.text.TextUtils; 21 | import android.view.MenuItem; 22 | 23 | import java.util.List; 24 | 25 | /** 26 | * A {@link PreferenceActivity} that presents a set of application settings. On 27 | * handset devices, settings are presented as a single list. On tablets, 28 | * settings are split by category, with category headers shown to the left of 29 | * the list of settings. 30 | *

31 | * See 32 | * Android Design: Settings for design guidelines and the Settings 34 | * API Guide for more information on developing a Settings UI. 35 | */ 36 | public class SettingsActivity extends AppCompatPreferenceActivity { 37 | /** 38 | * A preference value change listener that updates the preference's summary 39 | * to reflect its new value. 40 | */ 41 | @Override 42 | protected void onCreate(Bundle savedInstanceState) { 43 | super.onCreate(savedInstanceState); 44 | //setContentView(R.layout.activity_user_settings); 45 | 46 | android.support.v7.app.ActionBar actionBar = getSupportActionBar(); 47 | actionBar.setDisplayHomeAsUpEnabled(true); 48 | 49 | // Display the fragment as the main content 50 | getFragmentManager().beginTransaction() 51 | .replace(android.R.id.content, new SettingsFragment()) 52 | .commit(); 53 | 54 | } 55 | 56 | public static class SettingsFragment extends PreferenceFragment implements android.content.SharedPreferences.OnSharedPreferenceChangeListener { 57 | @Override 58 | public void onCreate(Bundle savedInstanceState) { 59 | super.onCreate(savedInstanceState); 60 | 61 | addPreferencesFromResource(com.example.sagarpalo.clientiaas.R.xml.pref_notification); 62 | } 63 | 64 | public void onSharedPreferenceChanged(android.content.SharedPreferences sharedPreferences, String key) { 65 | 66 | if(key.equals("ip_text")){ 67 | Common.IP=sharedPreferences.getString("ip_text",""); 68 | } 69 | } 70 | 71 | android.content.SharedPreferences.OnSharedPreferenceChangeListener mListener = new android.content.SharedPreferences.OnSharedPreferenceChangeListener() { 72 | public void onSharedPreferenceChanged(android.content.SharedPreferences prefs, String key) { 73 | // listener implementation 74 | 75 | } 76 | }; 77 | 78 | @Override 79 | public void onResume() { 80 | super.onResume(); 81 | getPreferenceScreen() 82 | .getSharedPreferences() 83 | .registerOnSharedPreferenceChangeListener(this); 84 | 85 | //prefs.registerOnSharedPreferenceChangeListener(mListener); 86 | } 87 | 88 | @Override 89 | public void onPause() { 90 | super.onPause(); 91 | getPreferenceScreen() 92 | .getSharedPreferences() 93 | .unregisterOnSharedPreferenceChangeListener(this); 94 | } 95 | 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/java/com/example/sagarpalo/clientiaas/WorkerService.java: -------------------------------------------------------------------------------- 1 | package com.example.sagarpalo.clientiaas; 2 | 3 | import android.app.AlarmManager; 4 | import android.app.IntentService; 5 | import android.app.PendingIntent; 6 | import android.app.Service; 7 | import android.content.Context; 8 | import android.content.Intent; 9 | import android.os.IBinder; 10 | import android.support.annotation.Nullable; 11 | import android.support.v4.content.LocalBroadcastManager; 12 | import android.util.Log; 13 | 14 | import java.io.BufferedReader; 15 | import java.io.IOException; 16 | import java.io.InputStream; 17 | import java.io.InputStreamReader; 18 | import java.io.ObjectInputStream; 19 | import java.io.ObjectOutputStream; 20 | import java.net.InetAddress; 21 | import java.net.Socket; 22 | import servercloudhandler.*; 23 | import static android.app.AlarmManager.ELAPSED_REALTIME; 24 | import static android.os.SystemClock.elapsedRealtime; 25 | 26 | public class WorkerService extends Service { 27 | 28 | @Override 29 | public int onStartCommand(final Intent intent, final int flags, 30 | final int startId) { 31 | android.util.Log.d("Echo","Sterted"); 32 | doAction(intent); 33 | return START_STICKY; 34 | } 35 | 36 | @Nullable 37 | @Override 38 | public IBinder onBind(Intent intent) { 39 | return null; 40 | } 41 | 42 | String status = "Initiating as mini cloud..."; 43 | int x[]; 44 | 45 | public final class Constants { 46 | 47 | // Defines a custom Intent action 48 | public static final String BROADCAST_ACTION = "com.example.sagarpalo.clientiaas.BROADCAST"; 49 | 50 | // Defines the key for the status "extra" in an Intent 51 | public static final String EXTENDED_DATA_STATUS = "com.example.sagarpalo.clientiaas.STATUS"; 52 | public static final String EXTENDED_DATA_STATUS2 = "com.example.sagarpalo.clientiaas.STATUS2"; 53 | 54 | } 55 | 56 | protected void doAction(Intent intent) { 57 | android.util.Log.d("Echo","Sterted2"); 58 | if (intent != null) { 59 | final String action = intent.getAction(); 60 | Thread worker = new Thread(new Runnable(){ 61 | 62 | private int[] getCpuUsageStatistic() { 63 | 64 | String tempString = executeTop(); 65 | 66 | tempString = tempString.replaceAll(",", ""); 67 | tempString = tempString.replaceAll("User", ""); 68 | tempString = tempString.replaceAll("System", ""); 69 | tempString = tempString.replaceAll("IOW", ""); 70 | tempString = tempString.replaceAll("IRQ", ""); 71 | tempString = tempString.replaceAll("%", ""); 72 | for (int i = 0; i < 10; i++) { 73 | tempString = tempString.replaceAll(" ", " "); 74 | } 75 | tempString = tempString.trim(); 76 | String[] myString = tempString.split(" "); 77 | int[] cpuUsageAsInt = new int[myString.length]; 78 | for (int i = 0; i < myString.length; i++) { 79 | myString[i] = myString[i].trim(); 80 | cpuUsageAsInt[i] = Integer.parseInt(myString[i]); 81 | } 82 | return cpuUsageAsInt; 83 | } 84 | 85 | private String executeTop() { 86 | java.lang.Process p = null; 87 | BufferedReader in = null; 88 | String returnString = null; 89 | try { 90 | p = Runtime.getRuntime().exec("top -n 1"); 91 | in = new BufferedReader(new InputStreamReader(p.getInputStream())); 92 | while (returnString == null || returnString.contentEquals("")) { 93 | returnString = in.readLine(); 94 | } 95 | } catch (IOException e) { 96 | Log.e("executeTop", "error in getting first line of top"); 97 | e.printStackTrace(); 98 | } finally { 99 | try { 100 | in.close(); 101 | p.destroy(); 102 | } catch (IOException e) { 103 | Log.e("executeTop", 104 | "error in closing and destroying top process"); 105 | e.printStackTrace(); 106 | } 107 | } 108 | return returnString; 109 | } 110 | 111 | @Override 112 | public void run() 113 | { 114 | Socket socket = new Socket(); 115 | try { 116 | String host = Common.IP; 117 | int port = 5001; 118 | InetAddress address = InetAddress.getByName(host); 119 | socket = new Socket(address, port); 120 | 121 | InputStream is = socket.getInputStream(); 122 | InputStreamReader isr = new InputStreamReader(is); 123 | BufferedReader br = new BufferedReader(isr); 124 | String message = br.readLine(); 125 | System.out.println("Message received from the server : " + message); 126 | 127 | port = Integer.parseInt(message); 128 | socket.close(); 129 | 130 | socket = new Socket(address, port); 131 | is = socket.getInputStream(); 132 | isr = new InputStreamReader(is); 133 | br = new BufferedReader(isr); 134 | message = br.readLine(); 135 | System.out.println("Message received from the server : " + message); 136 | android.util.Log.i("Message", "Message received from the server : " + message); 137 | 138 | if (message.equals("sending job")) { 139 | System.out.println("compute he"); 140 | status = "Computing Job"; 141 | } 142 | if (message.equals("done")) { 143 | System.out.println("done he"); 144 | status = "Job Completed"; 145 | } 146 | 147 | ObjectInputStream inStream = new ObjectInputStream(socket.getInputStream()); 148 | MatrixOperation mat = (MatrixOperation) inStream.readObject(); 149 | 150 | mat.multiply(); 151 | 152 | x = getCpuUsageStatistic(); 153 | 154 | Intent localIntent = new Intent(Constants.BROADCAST_ACTION); 155 | localIntent.putExtra(Constants.EXTENDED_DATA_STATUS, status); 156 | localIntent.putExtra(Constants.EXTENDED_DATA_STATUS2,x); 157 | LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(localIntent); 158 | 159 | ObjectOutputStream outputStream = new ObjectOutputStream(socket.getOutputStream()); 160 | outputStream.writeObject(mat); 161 | outputStream.flush(); 162 | 163 | } 164 | catch (Exception exception) 165 | { 166 | x = getCpuUsageStatistic(); 167 | android.util.Log.i("MessageE", exception.toString()); 168 | Intent localIntent = new Intent(Constants.BROADCAST_ACTION); 169 | localIntent.putExtra(Constants.EXTENDED_DATA_STATUS, status); 170 | localIntent.putExtra(Constants.EXTENDED_DATA_STATUS2,x); 171 | LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(localIntent); 172 | } 173 | finally { 174 | try { 175 | socket.close(); 176 | } catch (Exception e) { 177 | e.printStackTrace(); 178 | } 179 | } 180 | 181 | } 182 | 183 | }); 184 | worker.start(); 185 | 186 | } 187 | } 188 | 189 | @Override 190 | public void onTaskRemoved(Intent rootIntent){ 191 | Intent restartServiceIntent = new Intent(getApplicationContext(), this.getClass()); 192 | 193 | PendingIntent restartServicePendingIntent = PendingIntent.getService( 194 | getApplicationContext(), 1, restartServiceIntent, PendingIntent.FLAG_ONE_SHOT); 195 | AlarmManager alarmService = (AlarmManager) getSystemService(Context.ALARM_SERVICE); 196 | alarmService.set(ELAPSED_REALTIME, elapsedRealtime() + 1000, 197 | restartServicePendingIntent); 198 | 199 | super.onTaskRemoved(rootIntent); 200 | } 201 | 202 | 203 | 204 | } 205 | 206 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/java/servercloudhandler/MatrixOperation.java: -------------------------------------------------------------------------------- 1 | package servercloudhandler; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by Sagar Palo on 2017-03-26. 7 | */ 8 | public class MatrixOperation implements Serializable{ 9 | public double mat1[][]; 10 | public double mat2[][]; 11 | public double mat3[][]; 12 | static final long serialVersionUID =0L; 13 | 14 | public MatrixOperation(double mat1[][],double mat2[][]){ 15 | this.mat1 = mat1; 16 | this.mat2 = mat2; 17 | this.mat3 = new double[100][100]; 18 | } 19 | 20 | public void multiply(){ 21 | int i,j,k; 22 | int n = mat1.length; 23 | android.util.Log.d("Message",String.valueOf(n)); 24 | for (i = 0; i < n; i++) 25 | { 26 | for (j = 0; j < n; j++) 27 | { 28 | for (k = 0; k < n; k++) 29 | { 30 | mat3[i][j] = mat3[i][j] + mat1[i][k] * mat2[k][j]; 31 | } 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/drawable-v21/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A_48_62/ClientIaaS/app/src/main/res/drawable-v21/ic_launcher.png -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/drawable-v21/ic_menu_camera.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/drawable-v21/ic_menu_gallery.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/drawable-v21/ic_menu_manage.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/drawable-v21/ic_menu_send.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/drawable-v21/ic_menu_share.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/drawable-v21/ic_menu_slideshow.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/drawable/ic_info_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/drawable/ic_notifications_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/drawable/ic_sync_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/drawable/navhead.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A_48_62/ClientIaaS/app/src/main/res/drawable/navhead.jpg -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/drawable/side_nav_bar.xml: -------------------------------------------------------------------------------- 1 | 3 | 9 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 15 | 16 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/layout/app_bar_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/layout/content_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 22 | 23 | 31 | 32 | 43 | 44 | 53 | 54 | 65 | 66 | 75 | 76 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/layout/nav_header_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 21 | 22 | 28 | 29 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/menu/activity_main_drawer.xml: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A_48_62/ClientIaaS/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A_48_62/ClientIaaS/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A_48_62/ClientIaaS/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A_48_62/ClientIaaS/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/D17A_48_62/ClientIaaS/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 160dp 5 | 6 | 16dp 7 | 16dp 8 | 16dp 9 | 10 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/values/drawables.xml: -------------------------------------------------------------------------------- 1 | 2 | @android:drawable/ic_menu_camera 3 | @android:drawable/ic_menu_gallery 4 | @android:drawable/ic_menu_slideshow 5 | @android:drawable/ic_menu_manage 6 | @android:drawable/ic_menu_share 7 | @android:drawable/ic_menu_send 8 | 9 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ClientIaaS 3 | 4 | Open navigation drawer 5 | Close navigation drawer 6 | 7 | Settings 8 | Settings 9 | 10 | 11 | 12 | 13 | General 14 | 15 | Enable social recommendations 16 | Recommendations for people to contact 17 | based on your message history 18 | 19 | 20 | Display name 21 | John Smith 22 | 23 | Add friends to messages 24 | 25 | Always 26 | When possible 27 | Never 28 | 29 | 30 | 1 31 | 0 32 | -1 33 | 34 | 35 | 36 | Data & sync 37 | 38 | Sync frequency 39 | 40 | 15 minutes 41 | 30 minutes 42 | 1 hour 43 | 3 hours 44 | 6 hours 45 | Never 46 | 47 | 48 | 15 49 | 30 50 | 60 51 | 180 52 | 360 53 | -1 54 | 55 | 56 | 57 | Entry 1 58 | Entry 2 59 | Entry 3 60 | 61 | 62 | 63 | 1 64 | 2 65 | 3 66 | 67 | 68 | 69 | 70 | System sync settings 71 | 72 | 73 | Notifications 74 | 75 | New message notifications 76 | 77 | Ringtone 78 | Silent 79 | 80 | Vibrate 81 | 82 | -------------------------------------------------------------------------------- /D17A_48_62/ClientIaaS/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 16 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /app/app/views/posts/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(post) do |f| %> 2 | <% if post.errors.any? %> 3 |
4 |

<%= pluralize(post.errors.count, "error") %> prohibited this post from being saved:

5 | 6 |
    7 | <% post.errors.full_messages.each do |message| %> 8 |
  • <%= message %>
  • 9 | <% end %> 10 |
11 |
12 | <% end %> 13 | 14 |
15 | <%= f.label :name %> 16 | <%= f.text_field :name %> 17 |
18 | 19 |
20 | <%= f.label :title %> 21 | <%= f.text_field :title %> 22 |
23 | 24 |
25 | <%= f.label :content %> 26 | <%= f.text_area :content %> 27 |
28 | 29 |
30 | <%= f.submit %> 31 |
32 | <% end %> 33 | -------------------------------------------------------------------------------- /app/app/views/posts/_post.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.extract! post, :id, :name, :title, :content, :created_at, :updated_at 2 | json.url post_url(post, format: :json) 3 | -------------------------------------------------------------------------------- /app/app/views/posts/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Editing Post

2 | 3 | <%= render 'form', post: @post %> 4 | 5 | <%= link_to 'Show', @post %> | 6 | <%= link_to 'Back', posts_path %> 7 | -------------------------------------------------------------------------------- /app/app/views/posts/index.html.erb: -------------------------------------------------------------------------------- 1 |

<%= notice %>

2 | 3 |

Posts

4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | <% @posts.each do |post| %> 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | <% end %> 26 | 27 |
NameTitleContent
<%= post.name %><%= post.title %><%= post.content %><%= link_to 'Show', post %><%= link_to 'Edit', edit_post_path(post) %><%= link_to 'Destroy', post, method: :delete, data: { confirm: 'Are you sure?' } %>
28 | 29 |
30 | 31 | <%= link_to 'New Post', new_post_path %> 32 | -------------------------------------------------------------------------------- /app/app/views/posts/index.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.array! @posts, partial: 'posts/post', as: :post 2 | -------------------------------------------------------------------------------- /app/app/views/posts/new.html.erb: -------------------------------------------------------------------------------- 1 |

New Post

2 | 3 | <%= render 'form', post: @post %> 4 | 5 | <%= link_to 'Back', posts_path %> 6 | -------------------------------------------------------------------------------- /app/app/views/posts/show.html.erb: -------------------------------------------------------------------------------- 1 |

<%= notice %>

2 | 3 |

4 | Name: 5 | <%= @post.name %> 6 |

7 | 8 |

9 | Title: 10 | <%= @post.title %> 11 |

12 | 13 |

14 | Content: 15 | <%= @post.content %> 16 |

17 | 18 | <%= link_to 'Edit', edit_post_path(@post) %> | 19 | <%= link_to 'Back', posts_path %> 20 | -------------------------------------------------------------------------------- /app/app/views/posts/show.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.partial! "posts/post", post: @post 2 | -------------------------------------------------------------------------------- /app/bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /app/bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | APP_PATH = File.expand_path('../config/application', __dir__) 8 | require_relative '../config/boot' 9 | require 'rails/commands' 10 | -------------------------------------------------------------------------------- /app/bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | require_relative '../config/boot' 8 | require 'rake' 9 | Rake.application.run 10 | -------------------------------------------------------------------------------- /app/bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | require 'fileutils' 4 | include FileUtils 5 | 6 | # path to your application root. 7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 8 | 9 | def system!(*args) 10 | system(*args) || abort("\n== Command #{args} failed ==") 11 | end 12 | 13 | chdir APP_ROOT do 14 | # This script is a starting point to setup your application. 15 | # Add necessary setup steps to this file. 16 | 17 | puts '== Installing dependencies ==' 18 | system! 'gem install bundler --conservative' 19 | system('bundle check') || system!('bundle install') 20 | 21 | # puts "\n== Copying sample files ==" 22 | # unless File.exist?('config/database.yml') 23 | # cp 'config/database.yml.sample', 'config/database.yml' 24 | # end 25 | 26 | puts "\n== Preparing database ==" 27 | system! 'bin/rails db:setup' 28 | 29 | puts "\n== Removing old logs and tempfiles ==" 30 | system! 'bin/rails log:clear tmp:clear' 31 | 32 | puts "\n== Restarting application server ==" 33 | system! 'bin/rails restart' 34 | end 35 | -------------------------------------------------------------------------------- /app/bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This file loads spring without using Bundler, in order to be fast. 4 | # It gets overwritten when you run the `spring binstub` command. 5 | 6 | unless defined?(Spring) 7 | require 'rubygems' 8 | require 'bundler' 9 | 10 | lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) 11 | spring = lockfile.specs.detect { |spec| spec.name == "spring" } 12 | if spring 13 | Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path 14 | gem 'spring', spring.version 15 | require 'spring/binstub' 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /app/bin/update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | require 'fileutils' 4 | include FileUtils 5 | 6 | # path to your application root. 7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 8 | 9 | def system!(*args) 10 | system(*args) || abort("\n== Command #{args} failed ==") 11 | end 12 | 13 | chdir APP_ROOT do 14 | # This script is a way to update your development environment automatically. 15 | # Add necessary update steps to this file. 16 | 17 | puts '== Installing dependencies ==' 18 | system! 'gem install bundler --conservative' 19 | system('bundle check') || system!('bundle install') 20 | 21 | puts "\n== Updating database ==" 22 | system! 'bin/rails db:migrate' 23 | 24 | puts "\n== Removing old logs and tempfiles ==" 25 | system! 'bin/rails log:clear tmp:clear' 26 | 27 | puts "\n== Restarting application server ==" 28 | system! 'bin/rails restart' 29 | end 30 | -------------------------------------------------------------------------------- /app/config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative 'config/environment' 4 | 5 | run Rails.application 6 | -------------------------------------------------------------------------------- /app/config/application.rb: -------------------------------------------------------------------------------- 1 | require_relative 'boot' 2 | 3 | require 'rails/all' 4 | 5 | # Require the gems listed in Gemfile, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(*Rails.groups) 8 | 9 | module App 10 | class Application < Rails::Application 11 | # Settings in config/environments/* take precedence over those specified here. 12 | # Application configuration should go into files in config/initializers 13 | # -- all .rb files in that directory are automatically loaded. 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /app/config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: async 6 | 7 | production: 8 | adapter: redis 9 | url: redis://localhost:6379/1 10 | -------------------------------------------------------------------------------- /app/config/database.yml: -------------------------------------------------------------------------------- 1 | # PostgreSQL. Versions 9.1 and up are supported. 2 | # 3 | # Install the pg driver: 4 | # gem install pg 5 | # On OS X with Homebrew: 6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config 7 | # On OS X with MacPorts: 8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config 9 | # On Windows: 10 | # gem install pg 11 | # Choose the win32 build. 12 | # Install PostgreSQL and put its /bin directory on your path. 13 | # 14 | # Configure Using Gemfile 15 | # gem 'pg' 16 | # 17 | default: &default 18 | adapter: postgresql 19 | encoding: unicode 20 | username: postgres 21 | password: 22 | host: db 23 | # For details on connection pooling, see rails configuration guide 24 | # http://guides.rubyonrails.org/configuring.html#database-pooling 25 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 26 | 27 | development: 28 | <<: *default 29 | database: app_development 30 | 31 | # The specified database role being used to connect to postgres. 32 | # To create additional roles in postgres see `$ createuser --help`. 33 | # When left blank, postgres will use the default role. This is 34 | # the same name as the operating system user that initialized the database. 35 | #username: app 36 | 37 | # The password associated with the postgres role (username). 38 | #password: 39 | 40 | # Connect on a TCP socket. Omitted by default since the client uses a 41 | # domain socket that doesn't need configuration. Windows does not have 42 | # domain sockets, so uncomment these lines. 43 | #host: localhost 44 | 45 | # The TCP port the server listens on. Defaults to 5432. 46 | # If your server runs on a different port number, change accordingly. 47 | #port: 5432 48 | 49 | # Schema search path. The server defaults to $user,public 50 | #schema_search_path: myapp,sharedapp,public 51 | 52 | # Minimum log levels, in increasing order: 53 | # debug5, debug4, debug3, debug2, debug1, 54 | # log, notice, warning, error, fatal, and panic 55 | # Defaults to warning. 56 | #min_messages: notice 57 | 58 | # Warning: The database defined as "test" will be erased and 59 | # re-generated from your development database when you run "rake". 60 | # Do not set this db to the same as development or production. 61 | test: 62 | <<: *default 63 | database: app_test 64 | 65 | # As with config/secrets.yml, you never want to store sensitive information, 66 | # like your database password, in your source code. If your source code is 67 | # ever seen by anyone, they now have access to your database. 68 | # 69 | # Instead, provide the password as a unix environment variable when you boot 70 | # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database 71 | # for a full rundown on how to provide these environment variables in a 72 | # production deployment. 73 | # 74 | # On Heroku and other platform providers, you may have a full connection URL 75 | # available as an environment variable. For example: 76 | # 77 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" 78 | # 79 | # You can use this database configuration with: 80 | # 81 | # production: 82 | # url: <%= ENV['DATABASE_URL'] %> 83 | # 84 | production: 85 | <<: *default 86 | database: app_production 87 | -------------------------------------------------------------------------------- /app/config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative 'application' 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /app/config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | config.lograge.enabled = true 13 | config.lograge.formatter = Lograge::Formatters::Logstash.new 14 | config.lograge.logger = ActiveSupport::Logger.new(STDOUT) 15 | config.lograge.custom_options = lambda do |event| 16 | { 17 | request_ip: event.payload[:request_ip] 18 | } 19 | end 20 | 21 | # Show full error reports. 22 | config.consider_all_requests_local = true 23 | 24 | # Enable/disable caching. By default caching is disabled. 25 | if Rails.root.join('tmp/caching-dev.txt').exist? 26 | config.action_controller.perform_caching = true 27 | 28 | config.cache_store = :memory_store 29 | config.public_file_server.headers = { 30 | 'Cache-Control' => 'public, max-age=172800' 31 | } 32 | else 33 | config.action_controller.perform_caching = false 34 | 35 | config.cache_store = :null_store 36 | end 37 | 38 | # Don't care if the mailer can't send. 39 | config.action_mailer.raise_delivery_errors = false 40 | 41 | config.action_mailer.perform_caching = false 42 | 43 | # Print deprecation notices to the Rails logger. 44 | config.active_support.deprecation = :log 45 | 46 | # Raise an error on page load if there are pending migrations. 47 | config.active_record.migration_error = :page_load 48 | 49 | # Debug mode disables concatenation and preprocessing of assets. 50 | # This option may cause significant delays in view rendering with a large 51 | # number of complex assets. 52 | config.assets.debug = true 53 | 54 | # Suppress logger output for asset requests. 55 | config.assets.quiet = true 56 | 57 | # Raises error for missing translations 58 | # config.action_view.raise_on_missing_translations = true 59 | 60 | # Use an evented file watcher to asynchronously detect changes in source code, 61 | # routes, locales, etc. This feature depends on the listen gem. 62 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker 63 | end 64 | -------------------------------------------------------------------------------- /app/config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both threaded web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Disable serving static files from the `/public` folder by default since 18 | # Apache or NGINX already handles this. 19 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 20 | 21 | # Compress JavaScripts and CSS. 22 | config.assets.js_compressor = :uglifier 23 | # config.assets.css_compressor = :sass 24 | 25 | # Do not fallback to assets pipeline if a precompiled asset is missed. 26 | config.assets.compile = false 27 | 28 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 29 | 30 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 31 | # config.action_controller.asset_host = 'http://assets.example.com' 32 | 33 | # Specifies the header that your server uses for sending files. 34 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 35 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 36 | 37 | # Mount Action Cable outside main process or domain 38 | # config.action_cable.mount_path = nil 39 | # config.action_cable.url = 'wss://example.com/cable' 40 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] 41 | 42 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 43 | # config.force_ssl = true 44 | 45 | # Use the lowest log level to ensure availability of diagnostic information 46 | # when problems arise. 47 | config.log_level = :debug 48 | 49 | # Prepend all log lines with the following tags. 50 | config.log_tags = [ :request_id ] 51 | 52 | # Use a different cache store in production. 53 | # config.cache_store = :mem_cache_store 54 | 55 | # Use a real queuing backend for Active Job (and separate queues per environment) 56 | # config.active_job.queue_adapter = :resque 57 | # config.active_job.queue_name_prefix = "app_#{Rails.env}" 58 | config.action_mailer.perform_caching = false 59 | 60 | # Ignore bad email addresses and do not raise email delivery errors. 61 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 62 | # config.action_mailer.raise_delivery_errors = false 63 | 64 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 65 | # the I18n.default_locale when a translation cannot be found). 66 | config.i18n.fallbacks = true 67 | 68 | # Send deprecation notices to registered listeners. 69 | config.active_support.deprecation = :notify 70 | 71 | # Use default logging formatter so that PID and timestamp are not suppressed. 72 | # config.logger = GELF::Logger.new("localhost", 12201, "WAN", { :facility => "RAILS_APP" }) 73 | 74 | config.lograge.enabled = true 75 | config.lograge.formatter = Lograge::Formatters::Logstash.new 76 | config.lograge.logger = ActiveSupport::Logger.new(STDOUT) 77 | config.lograge.custom_options = lambda do |event| 78 | { 79 | request_ip: event.payload[:request_ip] 80 | } 81 | end 82 | #config.log_formatter = ::Logger::Formatter.new 83 | 84 | # Use a different logger for distributed setups. 85 | # require 'syslog/logger' 86 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') 87 | 88 | #if ENV["RAILS_LOG_TO_STDOUT"].present? 89 | # logger = ActiveSupport::Logger.new(STDOUT) 90 | # logger.formatter = config.log_formatter 91 | # config.logger = ActiveSupport::TaggedLogging.new(logger) 92 | #end 93 | 94 | # Do not dump schema after migrations. 95 | config.active_record.dump_schema_after_migration = false 96 | end 97 | -------------------------------------------------------------------------------- /app/config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure public file server for tests with Cache-Control for performance. 16 | config.public_file_server.enabled = true 17 | config.public_file_server.headers = { 18 | 'Cache-Control' => 'public, max-age=3600' 19 | } 20 | 21 | # Show full error reports and disable caching. 22 | config.consider_all_requests_local = true 23 | config.action_controller.perform_caching = false 24 | 25 | # Raise exceptions instead of rendering exception templates. 26 | config.action_dispatch.show_exceptions = false 27 | 28 | # Disable request forgery protection in test environment. 29 | config.action_controller.allow_forgery_protection = false 30 | config.action_mailer.perform_caching = false 31 | 32 | # Tell Action Mailer not to deliver emails to the real world. 33 | # The :test delivery method accumulates sent emails in the 34 | # ActionMailer::Base.deliveries array. 35 | config.action_mailer.delivery_method = :test 36 | 37 | # Print deprecation notices to the stderr. 38 | config.active_support.deprecation = :stderr 39 | 40 | # Raises error for missing translations 41 | # config.action_view.raise_on_missing_translations = true 42 | end 43 | -------------------------------------------------------------------------------- /app/config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # ApplicationController.renderer.defaults.merge!( 4 | # http_host: 'example.org', 5 | # https: false 6 | # ) 7 | -------------------------------------------------------------------------------- /app/config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | 9 | # Precompile additional assets. 10 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 11 | # Rails.application.config.assets.precompile += %w( search.js ) 12 | -------------------------------------------------------------------------------- /app/config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /app/config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Specify a serializer for the signed and encrypted cookie jars. 4 | # Valid options are :json, :marshal, and :hybrid. 5 | Rails.application.config.action_dispatch.cookies_serializer = :json 6 | -------------------------------------------------------------------------------- /app/config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /app/config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /app/config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /app/config/initializers/new_framework_defaults.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # 3 | # This file contains migration options to ease your Rails 5.0 upgrade. 4 | # 5 | # Read the Guide for Upgrading Ruby on Rails for more info on each option. 6 | 7 | # Enable per-form CSRF tokens. Previous versions had false. 8 | Rails.application.config.action_controller.per_form_csrf_tokens = true 9 | 10 | # Enable origin-checking CSRF mitigation. Previous versions had false. 11 | Rails.application.config.action_controller.forgery_protection_origin_check = true 12 | 13 | # Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`. 14 | # Previous versions had false. 15 | ActiveSupport.to_time_preserves_timezone = true 16 | 17 | # Require `belongs_to` associations by default. Previous versions had false. 18 | Rails.application.config.active_record.belongs_to_required_by_default = true 19 | 20 | # Do not halt callback chains when a callback returns false. Previous versions had true. 21 | ActiveSupport.halt_callback_chains_on_return_false = false 22 | 23 | # Configure SSL options to enable HSTS with subdomains. Previous versions had false. 24 | Rails.application.config.ssl_options = { hsts: { subdomains: true } } 25 | -------------------------------------------------------------------------------- /app/config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_app_session' 4 | -------------------------------------------------------------------------------- /app/config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /app/config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # To learn more, please read the Rails Internationalization guide 20 | # available at http://guides.rubyonrails.org/i18n.html. 21 | 22 | en: 23 | hello: "Hello world" 24 | -------------------------------------------------------------------------------- /app/config/puma.rb: -------------------------------------------------------------------------------- 1 | # Puma can serve each request in a thread from an internal thread pool. 2 | # The `threads` method setting takes two numbers a minimum and maximum. 3 | # Any libraries that use thread pools should be configured to match 4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 5 | # and maximum, this matches the default thread size of Active Record. 6 | # 7 | threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i 8 | threads threads_count, threads_count 9 | 10 | # Specifies the `port` that Puma will listen on to receive requests, default is 3000. 11 | # 12 | port ENV.fetch("PORT") { 3000 } 13 | 14 | # Specifies the `environment` that Puma will run in. 15 | # 16 | environment ENV.fetch("RAILS_ENV") { "development" } 17 | 18 | # Specifies the number of `workers` to boot in clustered mode. 19 | # Workers are forked webserver processes. If using threads and workers together 20 | # the concurrency of the application would be max `threads` * `workers`. 21 | # Workers do not work on JRuby or Windows (both of which do not support 22 | # processes). 23 | # 24 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 25 | 26 | # Use the `preload_app!` method when specifying a `workers` number. 27 | # This directive tells Puma to first boot the application and load code 28 | # before forking the application. This takes advantage of Copy On Write 29 | # process behavior so workers use less memory. If you use this option 30 | # you need to make sure to reconnect any threads in the `on_worker_boot` 31 | # block. 32 | # 33 | # preload_app! 34 | 35 | # The code in the `on_worker_boot` will be called if you are using 36 | # clustered mode by specifying a number of `workers`. After each worker 37 | # process is booted this block will be run, if you are using `preload_app!` 38 | # option you will want to use this block to reconnect to any threads 39 | # or connections that may have been created at application boot, Ruby 40 | # cannot share connections between processes. 41 | # 42 | # on_worker_boot do 43 | # ActiveRecord::Base.establish_connection if defined?(ActiveRecord) 44 | # end 45 | 46 | # Allow puma to be restarted by `rails restart` command. 47 | plugin :tmp_restart 48 | -------------------------------------------------------------------------------- /app/config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | scope '/railsapp' do 3 | resources :posts 4 | end 5 | # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html 6 | end 7 | -------------------------------------------------------------------------------- /app/config/secrets.yml: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rails secret` to generate a secure secret key. 9 | 10 | # Make sure the secrets in this file are kept private 11 | # if you're sharing your code publicly. 12 | 13 | development: 14 | secret_key_base: d30882f01bcb1935cacb8f8ef2ffebbe5efc878996701c5c08447a586922f13ca3145603ee021822335fac4a1fb5e3d57c4c1764a7e17d53ac5651100b37b4a0 15 | 16 | test: 17 | secret_key_base: e03963de3d60be4c6273929753634f1c30475dd6615971d4748ac91e6edf44340d4053e6ad56eb0b86ccb1e62e3037974bf9413f94bca67b097c22924d68a58c 18 | 19 | # Do not keep production secrets in the repository, 20 | # instead read values from the environment. 21 | production: 22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> 23 | -------------------------------------------------------------------------------- /app/config/spring.rb: -------------------------------------------------------------------------------- 1 | %w( 2 | .ruby-version 3 | .rbenv-vars 4 | tmp/restart.txt 5 | tmp/caching-dev.txt 6 | ).each { |path| Spring.watch(path) } 7 | -------------------------------------------------------------------------------- /app/db/migrate/20170319105741_create_posts.rb: -------------------------------------------------------------------------------- 1 | class CreatePosts < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :posts do |t| 4 | t.string :name 5 | t.string :title 6 | t.text :content 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) 7 | # Character.create(name: 'Luke', movie: movies.first) 8 | -------------------------------------------------------------------------------- /app/lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/app/lib/assets/.keep -------------------------------------------------------------------------------- /app/lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/app/lib/tasks/.keep -------------------------------------------------------------------------------- /app/log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/app/log/.keep -------------------------------------------------------------------------------- /app/public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

You may have mistyped the address or the page may have moved.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /app/public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /app/public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /app/public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/app/public/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /app/public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/app/public/apple-touch-icon.png -------------------------------------------------------------------------------- /app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/app/public/favicon.ico -------------------------------------------------------------------------------- /app/public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /app/test/controllers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/app/test/controllers/.keep -------------------------------------------------------------------------------- /app/test/controllers/posts_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class PostsControllerTest < ActionDispatch::IntegrationTest 4 | setup do 5 | @post = posts(:one) 6 | end 7 | 8 | test "should get index" do 9 | get posts_url 10 | assert_response :success 11 | end 12 | 13 | test "should get new" do 14 | get new_post_url 15 | assert_response :success 16 | end 17 | 18 | test "should create post" do 19 | assert_difference('Post.count') do 20 | post posts_url, params: { post: { content: @post.content, name: @post.name, title: @post.title } } 21 | end 22 | 23 | assert_redirected_to post_url(Post.last) 24 | end 25 | 26 | test "should show post" do 27 | get post_url(@post) 28 | assert_response :success 29 | end 30 | 31 | test "should get edit" do 32 | get edit_post_url(@post) 33 | assert_response :success 34 | end 35 | 36 | test "should update post" do 37 | patch post_url(@post), params: { post: { content: @post.content, name: @post.name, title: @post.title } } 38 | assert_redirected_to post_url(@post) 39 | end 40 | 41 | test "should destroy post" do 42 | assert_difference('Post.count', -1) do 43 | delete post_url(@post) 44 | end 45 | 46 | assert_redirected_to posts_url 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /app/test/fixtures/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/app/test/fixtures/.keep -------------------------------------------------------------------------------- /app/test/fixtures/files/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/app/test/fixtures/files/.keep -------------------------------------------------------------------------------- /app/test/fixtures/posts.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | name: MyString 5 | title: MyString 6 | content: MyText 7 | 8 | two: 9 | name: MyString 10 | title: MyString 11 | content: MyText 12 | -------------------------------------------------------------------------------- /app/test/helpers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/app/test/helpers/.keep -------------------------------------------------------------------------------- /app/test/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/app/test/integration/.keep -------------------------------------------------------------------------------- /app/test/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/app/test/mailers/.keep -------------------------------------------------------------------------------- /app/test/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/app/test/models/.keep -------------------------------------------------------------------------------- /app/test/models/post_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class PostTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /app/test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV['RAILS_ENV'] ||= 'test' 2 | require File.expand_path('../../config/environment', __FILE__) 3 | require 'rails/test_help' 4 | 5 | class ActiveSupport::TestCase 6 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 7 | fixtures :all 8 | 9 | # Add more helper methods to be used by all tests here... 10 | end 11 | -------------------------------------------------------------------------------- /app/tmp/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/app/tmp/.keep -------------------------------------------------------------------------------- /app/vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/app/vendor/assets/javascripts/.keep -------------------------------------------------------------------------------- /app/vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohan08p/CloudComputing/752df2de6b321159120ff2910ee02cd7ac725942/app/vendor/assets/stylesheets/.keep -------------------------------------------------------------------------------- /db/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM postgres 2 | 3 | ENV POSTGRES_USER 'postgres' 4 | ENV POSTGRES_DB 'app_production' 5 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | web: 5 | container_name: nginx-proxy 6 | build: 7 | context: ./nginx 8 | dockerfile: Dockerfile 9 | links: 10 | - app 11 | - kibana 12 | ports: 13 | - '80:80' 14 | depends_on: 15 | - app 16 | - kibana 17 | - logstash 18 | - elasticsearch 19 | networks: 20 | - elk 21 | 22 | db: 23 | container_name: db_postgres 24 | build: 25 | context: ./db 26 | dockerfile: Dockerfile 27 | networks: 28 | - elk 29 | 30 | app: 31 | container_name: app_rails 32 | build: 33 | context: ./app 34 | dockerfile: Dockerfile 35 | environment: 36 | RAILS_ENV: production 37 | command: bundle exec rails s -p 3000 -b "0.0.0.0" 38 | ports: 39 | - '3000:3000' 40 | depends_on: 41 | - db 42 | - logstash 43 | logging: 44 | driver: gelf 45 | options: 46 | gelf-address: 'udp://localhost:12201' 47 | networks: 48 | - elk 49 | env_file: 50 | - .app.env 51 | 52 | 53 | elasticsearch: 54 | container_name: elasticsearch 55 | build: elasticsearch/ 56 | command: elasticsearch -Enetwork.host=0.0.0.0 57 | ports: 58 | - "9200:9200" 59 | - "9300:9300" 60 | environment: 61 | ES_JAVA_OPTS: "-Xmx256m -Xms256m" 62 | # disable X-Pack 63 | # see https://www.elastic.co/guide/en/x-pack/current/xpack-settings.html 64 | # https://www.elastic.co/guide/en/x-pack/current/installing-xpack.html#xpack-enabling 65 | xpack.security.enabled: "false" 66 | xpack.monitoring.enabled: "false" 67 | xpack.graph.enabled: "false" 68 | xpack.watcher.enabled: "false" 69 | networks: 70 | - elk 71 | 72 | logstash: 73 | container_name: logstash 74 | build: logstash/ 75 | volumes: 76 | - ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml 77 | - ./logstash/pipeline:/usr/share/logstash/pipeline 78 | command: logstash -f /etc/logstash/conf.d/logstash.conf 79 | ports: 80 | - "12201:12201/udp" 81 | environment: 82 | LS_JAVA_OPTS: "-Xmx256m -Xms256m" 83 | networks: 84 | - elk 85 | depends_on: 86 | - elasticsearch 87 | 88 | kibana: 89 | container_name: kibana 90 | build: kibana/ 91 | volumes: 92 | - ./kibana/config/:/usr/share/kibana/config 93 | ports: 94 | - "5601:5601" 95 | networks: 96 | - elk 97 | depends_on: 98 | - elasticsearch 99 | 100 | networks: 101 | elk: 102 | driver: bridge 103 | -------------------------------------------------------------------------------- /elasticsearch/Dockerfile: -------------------------------------------------------------------------------- 1 | # https://github.com/elastic/elasticsearch-docker 2 | FROM docker.elastic.co/elasticsearch/elasticsearch:5.2.1 3 | 4 | ADD config/elasticsearch.yml /usr/share/elasticsearch/config/ 5 | 6 | # Add your elasticsearch plugins setup here 7 | # Example: RUN elasticsearch-plugin install analysis-icu 8 | -------------------------------------------------------------------------------- /elasticsearch/config/elasticsearch.yml: -------------------------------------------------------------------------------- 1 | xpack.security.enabled: false 2 | xpack.monitoring.enabled: false 3 | xpack.graph.enabled: false 4 | -------------------------------------------------------------------------------- /kibana/Dockerfile: -------------------------------------------------------------------------------- 1 | # https://github.com/elastic/kibana-docker 2 | FROM docker.elastic.co/kibana/kibana:5.2.1 3 | 4 | # Add your kibana plugins setup here 5 | # Example: RUN kibana-plugin install 6 | USER root 7 | RUN apt-get update && apt-get install -y netcat 8 | 9 | COPY entrypoint.sh /tmp/entrypoint.sh 10 | RUN chmod +x /tmp/entrypoint.sh 11 | 12 | ADD ./config/kibana.yml /opt/kibana/config/ 13 | 14 | CMD ["/tmp/entrypoint.sh"] 15 | -------------------------------------------------------------------------------- /kibana/config/kibana.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ## Default Kibana configuration from kibana-docker. 3 | ## from https://github.com/elastic/kibana-docker/blob/master/build/kibana/config/kibana.yml 4 | # 5 | server.port: 5601 6 | server.name: kibana 7 | server.host: "0.0.0.0" 8 | elasticsearch.url: http://elasticsearch:9200 9 | elasticsearch.preserveHost: true 10 | #elasticsearch.password: changeme 11 | kibana.index: ".kibana" 12 | kibana.defaultAppId: "discover" 13 | elasticsearch.requestTimeout: 300000 14 | elasticsearch.shardTimeout: 0 15 | elasticsearch.ssl.verify: true 16 | 17 | ## Disable X-Pack 18 | ## see https://www.elastic.co/guide/en/x-pack/current/xpack-settings.html 19 | ## https://www.elastic.co/guide/en/x-pack/current/installing-xpack.html#xpack-enabling 20 | # 21 | xpack.security.enabled: false 22 | xpack.monitoring.enabled: false 23 | xpack.graph.enabled: false 24 | xpack.reporting.enabled: false 25 | 26 | bundled_plugin_ids: 27 | - plugins/dashboard/index 28 | - plugins/discover/index 29 | - plugins/doc/index 30 | - plugins/kibana/index 31 | - plugins/markdown_vis/index 32 | - plugins/metric_vis/index 33 | - plugins/settings/index 34 | - plugins/table_vis/index 35 | - plugins/vis_types/index 36 | - plugins/visualize/index 37 | -------------------------------------------------------------------------------- /kibana/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | while true; do 4 | nc -q 1 elasticsearch 9200 2>/dev/null && break 5 | done 6 | 7 | exec kibana 8 | -------------------------------------------------------------------------------- /logstash/Dockerfile: -------------------------------------------------------------------------------- 1 | # https://github.com/elastic/logstash-docker 2 | FROM docker.elastic.co/logstash/logstash:5.2.1 3 | 4 | # Add your logstash plugins setup here 5 | # Example: RUN logstash-plugin install logstash-filter-json 6 | 7 | ADD ./pipeline/logstash.conf /etc/logstash/conf.d/ 8 | -------------------------------------------------------------------------------- /logstash/config/logstash.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ## Default Logstash configuration from logstash-docker. 3 | ## from https://github.com/elastic/logstash-docker/blob/master/build/logstash/config/logstash.yml 4 | # 5 | http.host: "0.0.0.0" 6 | 7 | ## Disable X-Pack 8 | ## see https://www.elastic.co/guide/en/x-pack/current/xpack-settings.html 9 | ## https://www.elastic.co/guide/en/x-pack/current/installing-xpack.html#xpack-enabling 10 | # 11 | xpack.monitoring.enabled: false 12 | -------------------------------------------------------------------------------- /logstash/pipeline/logstash.conf: -------------------------------------------------------------------------------- 1 | input { 2 | gelf {} 3 | } 4 | 5 | filter { 6 | json { 7 | source => "message" 8 | remove_field => "message" 9 | } 10 | } 11 | 12 | output { 13 | elasticsearch { 14 | hosts => "elasticsearch:9200" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | # Base image: 2 | FROM nginx 3 | 4 | # Install dependencies 5 | RUN apt-get update -qq && apt-get -y install apache2-utils 6 | 7 | # establish where Nginx should look for files 8 | ENV PROJECT_ROOT /home/ubuntu/Docker-ELK-Rails 9 | 10 | # Set our working directory inside the image 11 | WORKDIR $PROJECT_ROOT 12 | 13 | # Remove the default Nginx configuration file 14 | # RUN rm -v /etc/nginx/nginx.conf 15 | 16 | # create log directory 17 | RUN mkdir log 18 | RUN touch log/nginx.access.log 19 | RUN touch log/nginx.error.log 20 | 21 | # copy over static assets 22 | # COPY public public/ 23 | 24 | # Copy Nginx config template 25 | COPY config/nginx.conf /tmp/docker_example.nginx 26 | COPY config/.htpasswd /etc/nginx/.htpasswd 27 | 28 | # substitute variable references in the Nginx config template for real values from the environment 29 | # put the final config in its place 30 | RUN envsubst '$PROJECT_ROOT' < /tmp/docker_example.nginx > /etc/nginx/conf.d/default.conf 31 | RUN rm -rf /etc/nginx/sites-available/default 32 | ADD config/nginx.conf /etc/nginx/sites-enabled/nginx.conf 33 | 34 | EXPOSE 80 35 | 36 | # Use the "exec" form of CMD so Nginx shuts down gracefully on SIGTERM (i.e. `docker stop`) 37 | CMD [ "nginx", "-g", "daemon off;" ] 38 | -------------------------------------------------------------------------------- /nginx/config/nginx.conf: -------------------------------------------------------------------------------- 1 | upstream app { 2 | server app_rails:3000; 3 | } 4 | 5 | upstream kibana { 6 | server kibana:5601; 7 | } 8 | 9 | server { 10 | listen 80; 11 | #server_name localhost; 12 | 13 | location / { 14 | auth_basic "Restricted"; 15 | auth_basic_user_file /etc/nginx/.htpasswd; 16 | #rewrite ^/kibanalogs/(.*)$ /$1 break; 17 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 18 | proxy_set_header Host $http_host; 19 | 20 | proxy_pass http://kibana; 21 | proxy_redirect off; 22 | } 23 | 24 | location /railsapp/ { 25 | #rewrite ^/railsapp/(.*)$ /$1 break; 26 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 27 | proxy_set_header Host $http_host; 28 | 29 | proxy_pass http://app; 30 | proxy_redirect off; 31 | } 32 | 33 | location ^~ /railsapp/assets/ { 34 | gzip_static on; 35 | expires max; 36 | add_header Cache-Control public; 37 | } 38 | 39 | error_page 500 502 503 504 /500.html; 40 | client_max_body_size 4G; 41 | keepalive_timeout 10; 42 | } 43 | --------------------------------------------------------------------------------