How deploy Nuxt + api backend on EC2 - amazon-web-services

I have developed application which has NuxtJS front-end and Node + Express back-end as component. The front-end running in 3000 & back-end on 5000. I installed Nginx on my EC2 instance and copied all both folder separately. I following this tutorial, im on the step to "Setup Nginx Reverse Proxy".
enter image description here
enter image description here
Here is my /etc/nginx/sites-enabled/ file. I added following part in that file when (create a symbolic link to it in sites-enabled). But its not working.
I got this error :
Sep 13 01:18:01 ip-172-**-**-** systemd[1]: Starting A high performance web ser>
Sep 13 01:18:02 ip-172-**-**-** nginx[290356]: nginx: [emerg] invalid number of>
Sep 13 01:18:02 ip-172-**-**-** nginx[290356]: nginx: configuration file /etc/n>
Sep 13 01:18:02 ip-172-**-**-** systemd[1]: nginx.service: Control process exit>
Sep 13 01:18:02 ip-172-**-**-** systemd[1]: nginx.service: Failed with result '>
Sep 13 01:18:02 ip-172-**-**-** systemd[1]: Failed to start A high performance >

Related

Tomcat Server Loaded errir

I tried to install and start the Tomcat on my AWS EC2 instance.
However, I failed to run tomcat server after installed it.
I followed the following article for that
https://blog.devops4me.com/aws-tutorial-how-to-install-tomcat-in-aws-ec2-install/
And after finished step 6, and reloaded tomcat server, I tried to restart tomcat service like step 7. However, my terminal showed as below:
Feb 14 20:17:07 ip-172-31-54-104.ec2.internal systemd[1]: tomcat.service: control process exited, code=exited status=203
Feb 14 20:17:07 ip-172-31-54-104.ec2.internal systemd[1]: Failed to start Tomcat Server.
Feb 14 20:17:07 ip-172-31-54-104.ec2.internal systemd[1]: Unit tomcat.service entered failed state.
Feb 14 20:17:07 ip-172-31-54-104.ec2.internal systemd[1]: tomcat.service failed.
Feb 14 20:17:10 ip-172-31-54-104.ec2.internal systemd[1]: [/etc/systemd/system/tomcat.service:22] Missing '='.
Feb 14 20:17:22 ip-172-31-54-104.ec2.internal systemd[1]: tomcat.service holdoff time over, scheduling restart.
Feb 14 20:17:22 ip-172-31-54-104.ec2.internal systemd[1]: tomcat.service failed to schedule restart job: Unit is not loaded properly: Bad message.
Feb 14 20:17:22 ip-172-31-54-104.ec2.internal systemd[1]: Unit tomcat.service entered failed state.
Feb 14 20:17:22 ip-172-31-54-104.ec2.internal systemd[1]: tomcat.service failed.
I don't really understand how this work, and tried to search error on internet, but still doesn't have any clue of how to solve this problem, if anyone can give me a hint, that would be great, thank you!

how to get Jenkins to be assessable from aws ec2 instance

so this is the problem I have installed open jdk 8 for jenkins. jenkins is insalled and running given
● jenkins.service - LSB: Start Jenkins at boot time
Loaded: loaded (/etc/init.d/jenkins; generated)
Active: active (exited) since Thu 2021-10-21 19:22:55 UTC; 20min ago
Docs: man:systemd-sysv-generator(8)
Process: 437 ExecStart=/etc/init.d/jenkins start (code=exited, status=0/SUCCESS)
Oct 21 19:22:52 ip-172-31-30-187 systemd[1]: Starting LSB: Start Jenkins at boot time...
Oct 21 19:22:53 ip-172-31-30-187 jenkins[437]: Correct java version found
Oct 21 19:22:53 ip-172-31-30-187 jenkins[437]: * Starting Jenkins Automation Server jenkins
Oct 21 19:22:54 ip-172-31-30-187 su[619]: (to jenkins) root on none
Oct 21 19:22:54 ip-172-31-30-187 su[619]: pam_unix(su-l:session): session opened for user jenkins by (u>
Oct 21 19:22:54 ip-172-31-30-187 su[619]: pam_unix(su-l:session): session closed for user jenkins
Oct 21 19:22:55 ip-172-31-30-187 jenkins[437]: ...done.
Oct 21 19:22:55 ip-172-31-30-187 systemd[1]: Started LSB: Start Jenkins at boot time.
however, using serverip:8080 brings up nothing
used this tutorial https://www.youtube.com/watch?v=B6K1IF-489M&t=36s
port 8080 is also added to security group
this problem was not solved but making a fresh ec2 instance and installing Jenkins by following that tutorial did the trick

Problem installing RStudio onto a GCP cluster

I'm trying to follow this tutorial but keep getting an error when I try to install RStudio on the main cluster. (see section Installing RStudio Server..., item 3).
When I run the line
$ sudo gdebi rstudio-server-1.2.1335-amd64.deb
The installation starts but then fails with
Jun 03 03:10:16 cluster-c141-m systemd[1]: Starting RStudio Server...
Jun 03 03:10:16 cluster-c141-m rserver[20313]: /usr/lib/rstudio-server/bin/rserver: error while loading shar…ectory
Jun 03 03:10:16 cluster-c141-m systemd[1]: rstudio-server.service: Control process exited, code=exited status=127
Jun 03 03:10:16 cluster-c141-m systemd[1]: Failed to start RStudio Server.
Jun 03 03:10:16 cluster-c141-m systemd[1]: rstudio-server.service: Unit entered failed state.
Jun 03 03:10:16 cluster-c141-m systemd[1]: rstudio-server.service: Failed with result 'exit-code'.
Thanks for any suggestions.
You are installing the rstudio-server for Debian 8. Install the Debian 9 version.
The tutorial could use an update.
There is an initialization action to take care of installation of rstudio (in case you want to create another cluster later): https://github.com/GoogleCloudPlatform/dataproc-initialization-actions/tree/master/rstudio

Issue with awslogs service and CloudWatch Logs Agent on Ubuntu 16.04

On one of my AWS ec2 instances running Ubuntu 16.04, I'm getting the following errors filled up in my /var/syslog.
Jul 17 18:11:21 Mysql-Slave systemd[1]: Stopped The CloudWatch Logs agent.
Jul 17 18:11:21 Mysql-Slave systemd[1]: Started The CloudWatch Logs agent.
Jul 17 18:11:26 Mysql-Slave systemd[1]: awslogs.service: Main process exited, code=exited, status=255/n/a
Jul 17 18:11:26 Mysql-Slave systemd[1]: awslogs.service: Unit entered failed state.
Jul 17 18:11:26 Mysql-Slave systemd[1]: awslogs.service: Failed with result 'exit-code'.
Jul 17 18:11:26 Mysql-Slave systemd[1]: awslogs.service: Service hold-off time over, scheduling restart.
Jul 17 18:11:26 Mysql-Slave systemd[1]: Stopped The CloudWatch Logs agent.
Jul 17 18:11:26 Mysql-Slave systemd[1]: Started The CloudWatch Logs agent.
Jul 17 18:11:32 Mysql-Slave systemd[1]: awslogs.service: Main process exited, code=exited, status=255/n/a
Jul 17 18:11:32 Mysql-Slave systemd[1]: awslogs.service: Unit entered failed state.
Jul 17 18:11:32 Mysql-Slave systemd[1]: awslogs.service: Failed with result 'exit-code'.
Jul 17 18:11:32 Mysql-Slave systemd[1]: awslogs.service: Service hold-off time over, scheduling restart.
Jul 17 18:11:32 Mysql-Slave systemd[1]: Stopped The CloudWatch Logs agent.
Jul 17 18:11:32 Mysql-Slave systemd[1]: Started The CloudWatch Logs agent.
The /var/log/awslogs.log contains these messages:
database is locked
2018-07-17 20:59:01,055 - cwlogs.push - INFO - 27074 - MainThread - Missing or invalid value for use_gzip_http_content_encoding config. Defaulting to using gzip encoding.
2018-07-17 20:59:01,055 - cwlogs.push - INFO - 27074 - MainThread - Using default logging configuration.
database is locked
2018-07-17 20:59:06,549 - cwlogs.push - INFO - 27104 - MainThread - Missing or invalid value for use_gzip_http_content_encoding config. Defaulting to using gzip encoding.
2018-07-17 20:59:06,549 - cwlogs.push - INFO - 27104 - MainThread - Using default logging configuration.
database is locked
2018-07-17 20:59:12,054 - cwlogs.push - INFO - 27110 - MainThread - Missing or invalid value for use_gzip_http_content_encoding config. Defaulting to using gzip encoding.
2018-07-17 20:59:12,054 - cwlogs.push - INFO - 27110 - MainThread - Using default logging configuration.
Any pointers in troubleshooting this will be of great help.
A similar issue was posted in the following link - https://forums.aws.amazon.com/thread.jspa?threadID=165134
I did the following:
a) Stopped the awslogs service
$ service awslogs stop ## Amazon Linux
OR
$ service awslogsd stop ## Amazon Linux 2
b) Deleted the agent-state file in /var/awslogs/state/ (I renamed it in my case)
$ mv agent-state agent-state.old ## Amazon Linux
OR
$ cd /var/lib/awslogs; mv agent-stat agent-stat.old ## Amazon Linux 2
c) Restarted the awslogs service
$ service awslogs start ## Amazon Linux
OR
$ sudo systemctl start awslogsd ## Amazon Linux 2
A new agent-state file was created as a result and the errors mentioned my post disappeared after this.
Please try the following commands based on your Linux version
sudo service awslogs start
If you are running Amazon Linux 2, try the below command
sudo systemctl start awslogsd
took me 2 hours to figure this out
In my case, I found duplicate entries for some properties in /etc/awslogs/awslogs.conf file.
(Not all were duplicates, as some of the properties were commented, and I uncommented them to set values.)
It didn't work. Then I scrolled till the bottom of the file.
I found following entries. Set the values to these properties and it worked.
[/var/log/messages]
datetime_format = %b %d %H:%M:%S
file = /home/ec2-user/application.log
buffer_duration = 5000
log_stream_name = {instance_id}
initial_position = start_of_file
log_group_name = MyProject

nginx cannot start on redhat server

I am trying to install nginx on a rhel 7 and it says process doesn't start. Following is the log.
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal systemd[1]: Starting nginx -
high performance web server...**
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal nginx[30974]: nginx: the
configuration file /etc/nginx/nginx.conf syntax is ok
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal nginx[30974]: nginx: [emerg]
open() "/mnt/nginx_logs/pubstore/access.log" failed (13: Permission
denied)
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal nginx[30974]: nginx:
configuration file /etc/nginx/nginx.conf test failed
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal systemd[1]: nginx.service:
control process exited, code=exited status=1
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal systemd[1]: Failed to start
nginx - high performance web server.
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal systemd[1]: Unit
nginx.service entered failed state.**
The permission of the file access log is as follows. I have given permission but still it doesn't start.
-rwxrwxrwx. 1 nginx nginx 0 Nov 13 02:07 access.log
-rwxrwxrwx. 1 nginx nginx 0 Nov 13 02:07 error.log
The installation is done on a puppet agent on amazon ec2 instance
This line:
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal nginx[30974]: nginx: [emerg] open() "/mnt/nginx_logs/pubstore/access.log" failed (13: Permission denied)
Tells you that the user you are running nginx as, does not have access to write to the log file its configured to write to.
Since the logs are being stored in a non-standard location, you will likely have to ensure that the directory you want to store logs in, is writable by the same user that nginx is running as.