{"_id":"588f722bbcace50f0052ba07","parentDoc":null,"project":"565f5fa26bafd40d0030a064","__v":0,"user":"565f3941ea46251700972783","version":{"_id":"588f722bbcace50f0052b9e1","project":"565f5fa26bafd40d0030a064","__v":1,"createdAt":"2017-01-30T17:04:43.410Z","releaseDate":"2017-01-30T17:04:43.410Z","categories":["588f722bbcace50f0052b9e2","588f722bbcace50f0052b9e3","588f722bbcace50f0052b9e4","588f722bbcace50f0052b9e5","588f722bbcace50f0052b9e6","588f722bbcace50f0052b9e7"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"5.3.0","version":"5.3.0"},"category":{"_id":"588f722bbcace50f0052b9e7","version":"588f722bbcace50f0052b9e1","project":"565f5fa26bafd40d0030a064","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-12-17T21:29:23.551Z","from_sync":false,"order":5,"slug":"server-installation-configuration","title":"Self Hosting"},"updates":["57e545ef7ee1b50e00b7df49","57eaee2243d2780e008e7a7a"],"next":{"pages":[],"description":""},"createdAt":"2015-12-22T20:54:27.647Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":11,"body":"If you are using existing nanoscale.io instance or image, skip step 3.  \nIf you are using fresh EC2 instance, skip steps 1 and 2.\n \n1. Log into AWS and under ‘Images’ click AMIs.  Under services aws account.\n\n2. Select the latest nanoscale.io image and click ‘Launch’.\n\n3. Log into AWS and create a new Ubuntu EC2 instance. \n\n4. Select the Instance Type.  For most installations the t2.micro is adequate.  Production deployments may want to move to an m3 deployment.\n\n5. In ‘Configure Instance Details’, choose the number of instances you want to deploy.  Leave all other settings as the default values. \n\n6. Choose storage settings.\n\n7. Tag your instance if desired.\n\n8. Create a new security group and add a new rule in addition to the default SSH rule: \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Type – HTTP, Protocol – TCP, Port Range – 80, Source – Anywhere 0.0.0.0/0\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n9. Launch instance. \n\n10. Select an existing key pair or create a new key pair. Do not lose the pem file.\n\n11. On the ‘Instances’ page, you will see that your new instance is initializing.  Once it is initialized, under ‘Network & Security’, select Elastic IPs. \n\n12. Click ‘Allocate New Address’ and select VPC from the drop-down.\n\n13. Associate this new address by clicking ‘Associate Address’ and select the instance you just created in the first input field from the drop-down.\n\n14. Connect to your instance via ssh using “ubuntu” user or the default “ec2-user” user and upload the nanoscale.io binary, key, and .conf file if you are using a fresh EC2 instance.  Launching from a nanoscale.io instance or image will already include the necessary files.  \n\n15. Execute the following to get nanoscale.io online with an output file called “gateway.log”:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"sudo ./gateway >> gateway.log 2>&1 &\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n16. If using a new installation of nanoscale.io, configure the .conf file.  For default access use these settings: \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"server = true\\nconnectionString = (your DB creds) \\nhost = '0.0.0.0'\\nport = 80\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n17. Your new instance is now publicly accessible via the ‘Public DNS’ provided for that instance.  By going to <a target=\"_blank\" href=\"http://{insert-public-dns-here}/admin/\">http://{insert-public-dns-here}/admin/</a>, you will be able to access the newly created installation of nanoscale.io. \n\n18. Add a new user through curl.\n\n## Nginx (SSL)\n<br>\n19. Download and install nginx.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"sudo apt-get install nginx\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n20. Create the necessary directories.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"sudo mkdir –p /var/www\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n21. Set permissions.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"sudo chown –R $USER:$USER /var/www\\nsudo chmod –R 755 /var/www\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n22. Create a directory to store the ssl cert/key.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"sudo mkdir /etc/nginx/ssl\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n23. Upload your local SSL certs to the /ssl folder via scp.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"scp -i citi.pem /location/of/server.key ubuntu:::at:::elastic-ip-address:/home/ubuntu\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n24. Create a server configuration file in the following location.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"cd /etc/nginx/sites-available\\nsudo nano default\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n25. Add the following server configuration and specify your SSL keys shown below in italics.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"server {\\n       listen 443;\\n \\n       root index;\\n       server_name localhost;\\n \\n \\n       ssl on;\\n       ssl_certificate /etc/nginx/ssl/server.pem;\\n       ssl_certificate_key /etc/nginx/ssl/server.key;\\n \\n       ssl_session_timeout 5m;\\n \\n       ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;\\n       ssl_ciphers \\\"HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES\\\";\\n       ssl_prefer_server_ciphers on;\\n \\n       location / {\\n    proxy_set_header X-Real-IP $remote_addr;\\n    proxy_set_header X-Forwarded-For $remote_addr;\\n    proxy_set_header Host $host;\\n    proxy_pass http://127.0.0.1:80;\\n  }\\n}  \",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n26. Specify the default_server to listen on port 8080, on both of the following lines.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"listen 8080 default_server;\\nlisten [::]:8080 default_server ipv6only=on;  \",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n27. Save the file and start or restart the server.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"sudo service nginx start\",\n      \"language\": \"shell\",\n      \"name\": \"Start the server\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"sudo service nginx restart\",\n      \"language\": \"shell\",\n      \"name\": \"Restart the server\"\n    }\n  ]\n}\n[/block]\n## SumoLogic\n\n<br>\n\n28. In your SSH session, download Sumo Logic.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"wget https://collectors.sumologic.com/rest/download/linux/64\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n29. Modify the downloaded file’s permissions (64 is the name of the file if no previous file named 64 exists).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"chmod +x 64\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n30. Open sumo.conf configuration file in edit mode.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"cd /etc/sumo.conf\\nsudo nano sumo.conf\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n31.  Log into Sumo Logic and create a new access key pair and save the credentials. \n \n32. In your SSH session, change accessid and accesskey to the newly created pair.\n\n33. Change ‘name’ to a new name that uniquely identifies your ec2 instance’s purpose. This is the name that will show up in Sumo Logic describing the project.\n\n34. Save the sumo.conf configuration file.\n\n35. In the directory that you downloaded your Sumo collector binary, run it with the following command.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"sudo bash 64\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n36. Follow the installation directions and when the step asking to update or install in a new directory shows up, select update.\n\n37. Sumo should now be running! Check your collector status to ensure that data is coming through in Sumo Logic.\n\n38. (Optional) Using MongoDB Step 1 - Go to compose.io and provision a new DB for the instance. Then create credentials, objects, and data. \n\n39. (Optional) Using MongoDB Step 2 - In nanoscale.io create remote endpoints that match your new Mongo DB.\n\n40. Build out API calls through proxy calls and remote endpoints. \n\n41. Enable CORS in the API settings.  Don't forget to add “accept, access-control-allow-origin, content-type, Authorization” to CORS Allowed Headers.\n\nYour nanoscale.io are now working!","excerpt":"","slug":"install-on-aws-in-prod-mode","type":"basic","title":"Install on AWS in Prod Mode"}

Install on AWS in Prod Mode


If you are using existing nanoscale.io instance or image, skip step 3. If you are using fresh EC2 instance, skip steps 1 and 2. 1. Log into AWS and under ‘Images’ click AMIs. Under services aws account. 2. Select the latest nanoscale.io image and click ‘Launch’. 3. Log into AWS and create a new Ubuntu EC2 instance. 4. Select the Instance Type. For most installations the t2.micro is adequate. Production deployments may want to move to an m3 deployment. 5. In ‘Configure Instance Details’, choose the number of instances you want to deploy. Leave all other settings as the default values. 6. Choose storage settings. 7. Tag your instance if desired. 8. Create a new security group and add a new rule in addition to the default SSH rule: [block:code] { "codes": [ { "code": "Type – HTTP, Protocol – TCP, Port Range – 80, Source – Anywhere 0.0.0.0/0", "language": "text" } ] } [/block] 9. Launch instance. 10. Select an existing key pair or create a new key pair. Do not lose the pem file. 11. On the ‘Instances’ page, you will see that your new instance is initializing. Once it is initialized, under ‘Network & Security’, select Elastic IPs. 12. Click ‘Allocate New Address’ and select VPC from the drop-down. 13. Associate this new address by clicking ‘Associate Address’ and select the instance you just created in the first input field from the drop-down. 14. Connect to your instance via ssh using “ubuntu” user or the default “ec2-user” user and upload the nanoscale.io binary, key, and .conf file if you are using a fresh EC2 instance. Launching from a nanoscale.io instance or image will already include the necessary files. 15. Execute the following to get nanoscale.io online with an output file called “gateway.log”: [block:code] { "codes": [ { "code": "sudo ./gateway >> gateway.log 2>&1 &", "language": "shell" } ] } [/block] 16. If using a new installation of nanoscale.io, configure the .conf file. For default access use these settings: [block:code] { "codes": [ { "code": "server = true\nconnectionString = (your DB creds) \nhost = '0.0.0.0'\nport = 80", "language": "text" } ] } [/block] 17. Your new instance is now publicly accessible via the ‘Public DNS’ provided for that instance. By going to <a target="_blank" href="http://{insert-public-dns-here}/admin/">http://{insert-public-dns-here}/admin/</a>, you will be able to access the newly created installation of nanoscale.io. 18. Add a new user through curl. ## Nginx (SSL) <br> 19. Download and install nginx. [block:code] { "codes": [ { "code": "sudo apt-get install nginx", "language": "shell" } ] } [/block] 20. Create the necessary directories. [block:code] { "codes": [ { "code": "sudo mkdir –p /var/www", "language": "shell" } ] } [/block] 21. Set permissions. [block:code] { "codes": [ { "code": "sudo chown –R $USER:$USER /var/www\nsudo chmod –R 755 /var/www", "language": "shell" } ] } [/block] 22. Create a directory to store the ssl cert/key. [block:code] { "codes": [ { "code": "sudo mkdir /etc/nginx/ssl", "language": "shell" } ] } [/block] 23. Upload your local SSL certs to the /ssl folder via scp. [block:code] { "codes": [ { "code": "scp -i citi.pem /location/of/server.key ubuntu@elastic-ip-address:/home/ubuntu", "language": "shell" } ] } [/block] 24. Create a server configuration file in the following location. [block:code] { "codes": [ { "code": "cd /etc/nginx/sites-available\nsudo nano default", "language": "shell" } ] } [/block] 25. Add the following server configuration and specify your SSL keys shown below in italics. [block:code] { "codes": [ { "code": "server {\n listen 443;\n \n root index;\n server_name localhost;\n \n \n ssl on;\n ssl_certificate /etc/nginx/ssl/server.pem;\n ssl_certificate_key /etc/nginx/ssl/server.key;\n \n ssl_session_timeout 5m;\n \n ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;\n ssl_ciphers \"HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES\";\n ssl_prefer_server_ciphers on;\n \n location / {\n proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header X-Forwarded-For $remote_addr;\n proxy_set_header Host $host;\n proxy_pass http://127.0.0.1:80;\n }\n} ", "language": "text" } ] } [/block] 26. Specify the default_server to listen on port 8080, on both of the following lines. [block:code] { "codes": [ { "code": "listen 8080 default_server;\nlisten [::]:8080 default_server ipv6only=on; ", "language": "text" } ] } [/block] 27. Save the file and start or restart the server. [block:code] { "codes": [ { "code": "sudo service nginx start", "language": "shell", "name": "Start the server" } ] } [/block] [block:code] { "codes": [ { "code": "sudo service nginx restart", "language": "shell", "name": "Restart the server" } ] } [/block] ## SumoLogic <br> 28. In your SSH session, download Sumo Logic. [block:code] { "codes": [ { "code": "wget https://collectors.sumologic.com/rest/download/linux/64", "language": "shell" } ] } [/block] 29. Modify the downloaded file’s permissions (64 is the name of the file if no previous file named 64 exists). [block:code] { "codes": [ { "code": "chmod +x 64", "language": "shell" } ] } [/block] 30. Open sumo.conf configuration file in edit mode. [block:code] { "codes": [ { "code": "cd /etc/sumo.conf\nsudo nano sumo.conf", "language": "shell" } ] } [/block] 31. Log into Sumo Logic and create a new access key pair and save the credentials. 32. In your SSH session, change accessid and accesskey to the newly created pair. 33. Change ‘name’ to a new name that uniquely identifies your ec2 instance’s purpose. This is the name that will show up in Sumo Logic describing the project. 34. Save the sumo.conf configuration file. 35. In the directory that you downloaded your Sumo collector binary, run it with the following command. [block:code] { "codes": [ { "code": "sudo bash 64", "language": "shell" } ] } [/block] 36. Follow the installation directions and when the step asking to update or install in a new directory shows up, select update. 37. Sumo should now be running! Check your collector status to ensure that data is coming through in Sumo Logic. 38. (Optional) Using MongoDB Step 1 - Go to compose.io and provision a new DB for the instance. Then create credentials, objects, and data. 39. (Optional) Using MongoDB Step 2 - In nanoscale.io create remote endpoints that match your new Mongo DB. 40. Build out API calls through proxy calls and remote endpoints. 41. Enable CORS in the API settings. Don't forget to add “accept, access-control-allow-origin, content-type, Authorization” to CORS Allowed Headers. Your nanoscale.io are now working!