My application uses the WebSocket protocol, and I want to deploy it to the AWS using AWS Elastic Beanstalk. But the pre-build Windows Server configuration not including this protocol by default.
Manually i can enable it by setting according item in the Server Manager via Add Roles and Features Wizard (Web Server (IIS) -> Web Server -> Application Development -> Web Socket Protocol).
If I want my app to work, i need connect by RDP and manually check in this option. But it is a terrible approach..
I think this task can be accomplished by deploy setting (.ebextensions)? But how can i get it?
I would be very grateful for the answer!
Add .ebextensions to your EB environment and customize your server software
You may want to customize and configure the software that your
application depends on. These files could be either dependencies
required by the application—for example, additional packages or
services that need to be run.
For your needs use commands option:
Use the commands key to execute commands on the EC2 instance. The
commands are processed in alphabetical order by name, and they run
before the application and web server are set up and the application
version file is extracted.
The specified commands run as the Administrator user.
For example this command will install WebSocket protocol feature:
%SystemRoot%\system32\dism.exe /online /enable-feature /featurename:IIS-WebSockets
in .ebextensions config it may look like:
commands:
01_install_websockets_feature:
command: "%SystemRoot%\\System32\\dism.exe /online /enable-feature /featurename:IIS-WebSockets"
ignoreErrors: true
Related
I am working deploying a Laravel application to the AWS ElasticBeanstalk. I configured the CLI and I could deploy the application to an ElasticBeanstalk environment running the command. This is what I have done so far.
I created an ElasticBeanstalk application and an environment in it.
Then I initialised the application for deployment using "eb init" and deployed it using "eb deploy". But I would like to add some additional commands to be run during the deployment. For example, I might run "gulp build" or other commands. Where and how can I figure it? I know that there is an .elasticextension folder but that does not allow us to add custom commands to be run on deployment.
I know that there is an .elasticextension folder but that does not allow us to add custom commands to be run on deployment.
Not sure what do you mean that you can't run commands in .ebextensions during deployment. But the extensions are commonly used for running commands or scripts when you are deploying your app. There are special sections for that:
commands: You can use the commands key to execute commands on the EC2 instance. The commands run before the application and web server are set up and the application version file is extracted.
container_commands: You can use the container_commands key to execute commands that affect your application source code. Container commands run after the application and web server have been set up and the application version archive has been extracted, but before the application version is deployed.
There are also platform hooks on Amazon Linux 2 to further fine tune the deployment of your applications.
Finally, if all of them are not suited, you could create dedicated build step in CodePipleline for you application. The dedicated step could be used to create fully deployment version of your application for EB with minimal amount of work to do at EB instances.
I have multiple standalone servers from where I want to upload/sync directories to Object Storage usign AWS CLI.
Do I have to install AWS CLI in each server? OR is there a common console/platform provided within AWS Object Storage from where I can call the same command over something like say SSH. How can I avoid installing cli to all the servers?
You have to install AWS CLI in all the servers even if you write the script to ssh from a single server that which is installed AWS CLI, SSH protocol will take the configuration from the remote server, not from a server where the script is running. It's better if you use a configuration management tool like ansible to speed up the process.
After Spinnaker deployment on EC2, clouddriver doesn't start. tried the same on local machine and the result is the same. Trying to run 1.6.1 on ubuntu 16.04.
I am using s3 as storage aws as cloudprovider.
After deployment spinnaker UI is accesable, when creating new application the windows hangs and error message appears in browser's console regarding localhost:8084/ credentials and 7002 port.
tried to send curl request to localhost:7002 from the server, but connection refused. 7002 port isn't being listened but all other services ports are. clouddriver start and then enters failed state (for about after 30 seconds).
For deployment I've followed this guide on official website.
Also I can't find logs of services in /var/log/spinnaker/any service/ path, there are logs only in /var/log/spinnaker/halyard/ path.
All policies/roles/users have been made in aws properly as described in official setup guide. double checked. Still facing issue.
Maybe I am missing anything?
Here is the error from browser console when trying to create new application
GET http://localhost:8084/credentials?expand=true 500 () angular.js:14525 Possibly unhandled rejection: {"data":{"error":"Internal Server Error","exception":"com.google.common.util.concurrent.UncheckedExecutionException","message":"retrofit.RetrofitError: Failed to connect to localhost/127.0.0.1:7002","status":500,"timestamp":1523484058259},"status":500,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"http://localhost:8084/credentials","cache":true,"params":{"expand":true},"timeout":65000,"headers":{"X-RateLimit-App":"deck","Accept":"application/json, text/plain, */*"},"withCredentials":true},"statusText":""} undefined
Have done some tests later. Here are results.
1deployed spinnaker without s3 storage and any cloud provider - clouddriver works
2added s3 as persistent storage - clouddriver works again. Opened UI created dummy project and saw that files have been created in the s3 bucket under front50 folder. everything fine.
3added aws configurations - created user in aws, and ran this command with appropriate changes
hal config provider aws edit --access-key-id ${ACCESS_KEY_ID} \ --secret-access-key
and ran this command with appropriate changes
hal config provider aws account add $AWS_ACCOUNT_NAME \ --account-id ${ACCOUNT_ID} \ --assume-role role/spinnakerManaged
after checking aws configs with hal config provider aws the value of defaultAssumeRole=0
and after hal deploy apply again clouddriver doesn't start and I cannot create an application from UI. the window loads infinitely.
This is the option for dev spinnaker. localdebian type never worked for me as it contains extra dependencies.
Please use a Kubernetes cluster for the installation or user Minnaker for quick PoC of OSS. It runs on a K3S cluster.
I'm seeing so many different sources how to to achieve CI with Jenkins and EC2 and strangely none seem to fit my needs.
I have 2 EC2 ubuntu instances. One is empty and the other has Jenkins installed on it.
I want to perform a build on the Jenkins machine and copy the jar to the other ubuntu machine. Once the jar is there i want to run mvn spring-boot:run
That's is - a very simple flow which i can't find a good source to follow that doesn't include slaves, dockers etc..
AWS Code Deploy lets you use a Jenkins and deploy it on your EC2 instances.
Quick google search gave me this very detailed instruction on how to setup code pipeline with AWS Code Deploy.
The pipeline uses GitHub -> Jenkins -> EC2 flow, as you need it.
Set up jenkins to do a build then scp the artifact to the other machine
There's an answer here how to setup ssh keys for jenkins to publish via ssh about setting up the keys for ssh
I have configured my .ebextensions folder to download and install a windows service on the leader ec2 instance.
Problem is that every time i want to update to a new version of the web application (Not the windows service) Those commands execute again and try to re install the service again.
On the other side. Every time i want to update only the widows service, i have to do the work manually through ssh or rdp. Or re-deploy the whole application which triggers the .ebextensions commands.
Is there a more elegant workflow for this i am skipping?
You are encountering Elastic Beanstalk weakest link. You host two different services on the same EB instance, which is unsupported by EB (which is lame I agree).
I resolved the "setup only once" need by appending a test to the setup extentension config file. In my case it's a linux box, but you can do something similar:
commands:
10_setup_win_service:
test: test ! -f /opt/elasticbeanstalk/.post-provisioning-complete
command: <...>
Now to complete this hack I have a file called .ebextensions/99_finalize_setup.config:
commands:
99_write_post_provisioning_complete_file:
command: touch /opt/elasticbeanstalk/.post-provisioning-complete
this approach ensures the win service is installed only once.
Now for your maintenance issue of the win service, you cannot use the EB toolset for that. Your understanding of the options here are correct - either use SSH to automate the work, or do it manually by logging into the server.