This a silly question, but couldn't find an answer. I'm running a rails app on jruby, and I use sidekiq to proccess background jobs. Do I really have to run sidekiq in another instance of jvm (is that what happens running bundle exec sidekiq) ?
Jruby is too much RAM consuming so this is not possible with my aws t2.micro instance.
Due to high memory consumption your AWS microinstance will choke eventually. There is one way to have both Ruby App and Background process sidekiq running.
Either you can boot another EC2 micro with sidekiq. You app instance and sidekiq server will share the same Redis instance. So, your BG processing wont be disrupted.
Another way is to bootup a Heroku free dyno.
Or you can move to CRuby or MRI.
hope this helps
Related
I have a --user-data file that downloads a few python scripts that runs a docker as soon as the server is launched.
It seems that the EC2 launch processes interferes with the python script / docker I'm running and is destroying the connection to the docker.
How I've dealt with this issue so far is to wait 5 minutes before running the python script with a simple timer.sleep(300) method. But this feels messy. Any way I can check for what launch processes that are interfering? or a clean solution might be to look for the completion of the launch processes, but I don't know what those processes are, or how I would check against it.
In your question, I see Build and run docker, I think its a lot expensive for your EC2 start up,
I suggest you to externalize the build/push the image docker in other part like CodeBuild/CodePipeline/ECR.... and why not using EC2/ECS/Fargate solution to pull the image docker and run it with ECS agent.
But if you want to use EC2, you can generate a custom AMI with your predefined lib and packages, and in your userdata, you can just pull the image and start it
We developed a Flask webapp, and want to deploy it on IIS. During development, we started the app via flask run, which lanches a single instance of our app. On IIS, however, we observed (via the task manager) that our app runs multiple instances concurrently.
The problem is that our app is not designed to run in parallel. For example, our app reads a file from the file system and keeps it in memory for efficiency. This optimization is correct only if it is guaranteed that no other process changes the content of the file.
Is there a way to prevent IIS from starting multiple instances?
In IIS, you can go to FastCGI settings, in there you can see all the applications used by websites on your server. In the column "Max. Instances", the script you are talking about is probably set to 0 (or some value greater than 1), meaning it can be started multiple times. Limiting this to 1 will solve your problem.
you could use below code to run only one instance of a program:
from tendo import singleton
me = singleton.SingleInstance() # will sys.exit(-1) if other instance is running
the command to install:
pip install tendo
Reference link:
Check to see if python script is running
How to make only one instance of the same script running at any time
https://github.com/pycontribs/tendo/blob/master/tendo/singleton.py
I have 3 spring boot application and want to deploy all on single EC2 instance.
When i have tried to deploy war and deploy under tomcat/webapps some applications will not work as embedded tomcat in spring boot uses port 8080 and other web applications which are exists in tomcat stopped working.
Other options i have tried is changing server.port in application.properties file running jar with java -jar app.jar.
This works but for only one app if i want to run one app and if i press cntrl+c or cntrl+z or closing terminal(closing ssh connection) is stopping application.
When found during my search that we can do with AWS Elastic Beanstalk.but i have already created one free tier ec2 instance is there any way to make it work with out changing instance.
can some one help me out?
Thanks
If you want to run your app using java -jar app.jar add & to the end allowing the process to run in the background.
Using the command java -jar app.jar & you can run multiple apps in the background. This will return a pid "Process ID"
You can use this pid to kill the app later with kill -9 <pid>
To check running processes you can use ps aux | grep java (We are searching for anything that contains "java")
For running multiple wars on tomcat explicitly deploying multiple applications to Tomcat
Supervisord cant controll my celery services(workers, flower, django and celerybeat).
When system startup, I can see all processes running successfully, if 1 of processes fail and supervisor does not restart it, when I reload or restart supervisord, everything under supervisord fails and cant be re-launched.
I have tried to move my celery services under monit.
I created celery services in /etc/init.d/ and services run perfectly, I can start/stop them without problems, then I set up monit scripts for all of them.
The problem is that monit is unable to start my celery-workers services, it is able to start/stop "django", "flower" and "celerybeat" without problems, but workers services under init.d are unable to be started by monit.
Could you please sugest me any idea how to fix this?
Why other services can be managed by monit without problems, but workers not?
Thank You in advance.
I'm trying to set up my Meteor apps on AWS EB and I've successfully deployed 2. Weird thing is one of them is using 30% CPU when idle, as opposed to 0.3% on the other one.
Both are running METEOR#1.4.2.3, both are on t2.large EC2 instances. I previously had the apps on Galaxy without any issues (have to make the switch because we got a generous amount of credits from AWS)
The only difference is the app that's idle at 30% has Meteor settings be loaded on startup and the other one doesn't use any Meteor settings since it's just used to connect to the DB and display info (as a microservice)
Are you issuing this
meteor build --server ${ROOT_URL} --verbose --directory ${BUILD_NODEJS_DIR} --mobile-settings build/${SETTINGS_JSON_FILE}
to bundle your code ready for deployment ... then over on your cloud provider are you executing your meteor app by calling
node main.js
This adheres to current meteor standards of deployment ( version 1.4.2.3 ) ... which I am using to deploy a meteor app onto AWS EC2 and see no high CPU usage when its idle
Silly me, was using Node version 6+ that isn't supported by Meteor fully yet, switching to 4.6.1 did the trick.