Home > other >  Cannot connect my AWS EC2 Instance to my GitHub Webhook
Cannot connect my AWS EC2 Instance to my GitHub Webhook

Time:10-03

How I should be able to add two port numbers to my new Inbound Rule for the GitHub webhook I created with the Type being Custom TCP, the Protocol being TCP, the Port Range being 8080, and most importantly, the Source being Anywhere with two custom source ports of 0.0.0.0/0 and ::/0 which is seen below in a screenshot of the specific reference from the course itself: enter image description here

Then when I try and do the same for my EC2 Instance's Inbound Rules, I can only add one source for the port range of 8080 as seen below... enter image description here

As a result, I cannot have both 0.0.0.0/0 and ::/0 connected to port range 8080 simultaneously as seen again below for clarification enter image description here

When I try and do so, I am forced into creating two separate Inbound Rules, both being Custom TCP, Port Range 8080, and the Source of each directing to 0.0.0.0/0 and ::/0 independent of each other, not under one unified Inbound Rule

As a result, I believe this is why I am not capable of creating an established webhook from my GitHub repo to my AWS EC2 instance.

For more clarification, the course itself is walking me through how to properly setup a webhook from GitHub to my newly created AWS EC2 in conjunction with the enter image description here or as code, it is:

[Unit]
Description=Github webhook
After=network.target

[Service]
Environment=PATH=/home/ubuntu/.npm-global/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
Type=simple
User=ubuntu
ExecStart=/usr/bin/nodejs /home/ubuntu/NodeWebHooks/webhook.sj
Restart=on-failure

[Install]
WantedBy=multi-user.target

Then when I save and exit from that file, in order to enable it, I do: sudo systemctl enable webhook.service and receive the appropriate desired response of "Created symlink ... etc..." where it clarifies that a webhook.service has been created. However, then when I run the following:

sudo systemctl start webhook
sudo systemctl status webhook

I get an error which states the following: enter image description here or alternatively, as code it is the following response:

ubuntu@ip-172-31-3-74:~$ sudo systemctl start webhook
ubuntu@ip-172-31-3-74:~$ sudo systemctl status webhook
 webhook.service - Github webhook
   Loaded: loaded (/etc/systemd/system/webhook.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2021-10-02 22:45:47 UTC; 7s ago
  Process: 27129 ExecStart=/usr/bin/nodejs /home/ubuntu/NodeWebHooks/webhook.sj (code=exited, status=1/FAILURE)
 Main PID: 27129 (code=exited, status=1/FAILURE)

Oct 02 22:45:47 ip-172-31-3-74 systemd[1]: webhook.service: Main process exited, code=exited, status=1/FAILURE
Oct 02 22:45:47 ip-172-31-3-74 systemd[1]: webhook.service: Failed with result 'exit-code'.
Oct 02 22:45:47 ip-172-31-3-74 systemd[1]: webhook.service: Service hold-off time over, scheduling restart.
Oct 02 22:45:47 ip-172-31-3-74 systemd[1]: webhook.service: Scheduled restart job, restart counter is at 5.
Oct 02 22:45:47 ip-172-31-3-74 systemd[1]: Stopped Github webhook.
Oct 02 22:45:47 ip-172-31-3-74 systemd[1]: webhook.service: Start request repeated too quickly.
Oct 02 22:45:47 ip-172-31-3-74 systemd[1]: webhook.service: Failed with result 'exit-code'.
Oct 02 22:45:47 ip-172-31-3-74 systemd[1]: Failed to start Github webhook.

CodePudding user response:

The issue is most likely that the webhook.service file references under [Service]: home/ubuntu/NodeWebHooks/webhook.sj, when it is probably named /home/ubuntu/NodeWebHooks/webhook.js. It's the little things that get you!

  • Related