I have node + express backend which is called by my angular frontend (two separate domains).
In my backend, I am doing an API call to some other Third Party API.
My backend is working fine when I deploy it locally, but on deploying it to aws, the request times out (CORS Issue?). I checked issues with my deployment, and it successfully deployed, and I am able to make calls to endpoints where I am not calling the third party - API.
I also checked the API, it works when I call it manually or directly from my frontend.
Any idea what could be the issue?
Yes, this is a CORS issue.
The most common way to handle this is to add a Reverse Proxy (Nginx for example) to have a single domain that both servers the application (static files) and exposes the Backend (API).
+----------+
| |
| Client |
| |
+----+-----+
|
| myDomain.com
|
[INTERNET]
|
|
v :80
+--------+-------+
/* | | /api
+----------+ Revese Proxy +---------+
| | | |
| +----------------+ |
| |
| |
| :8080 | :3000
| |
+----+----------+ +---------+-----+
| | | |
| Angular | | Backend |
| (webserver) | | (API server) |
| | | |
+---------------+ +---------------+
Any request to myDomain.com will be checked. If the path contains /api the request will be passed to the Backend. any other request will be passed to the webserver that contains the SPA static file.
This means that you will need to add the /api prefix to your client API calls (see https://angular.io/guide/build#proxying-to-a-backend-server)
Note: You can achieve the same using sub-domains instead of paths (myDomain.com/api will become api.myDomain.com/). You just need to be able to support it in your deployment.
Related
I am trying to get the status of few EC2 instance using AWS CLI
aws ec2 describe-instance-status --instance-ids xxxxxx yyyyyyyy zzzzzzzz
But in the output It only lists the instances which are running and not which are stopped.
How can i view the instances state even they are running or stopped
There are different ways to check the instance-state.
Use:
describe-instance-status.
You can use describe-instance-status: The describe-instance-status command of the AWS Command Line Interface (CLI) is used to retrieve the status of one or more Amazon Elastic Compute Cloud (EC2) instances. By default, it returns the status of running instances. To include stopped instances in the returned status information, you can use the --include-all-instances option.
Here is an example of how you can use this option:
$ aws ec2 describe-instance-status --include-all-instances
the above command will return the status information for both running and stopped instances.
Note that you can also filter the returned results using the --filters option. For example, you can use the following command to only retrieve the status of stopped instances:
$aws ec2 describe-instance-status --filters "Name=instance-state-code,Values=80"
Note: here 80 is the code for stopped instances and 16 for running ones. Below one will give you the info about stopped instance .
$ aws ec2 describe-instance-status --include-all-instances --filters Name=instance-state-name,Values='stopped'
You can get both the running as well as stooped instance-state while including the option --include-all-instances as used in the below given example...
$ aws ec2 describe-instance-status --include-all-instances --filters Name=instance-state-name,Values='*' --query 'InstanceStatuses[*].{InstanceId: InstanceId, State: InstanceState.Name}' --profile lab--output table
------------------------------------
| DescribeInstanceStatus |
+----------------------+-----------+
| InstanceId | State |
+----------------------+-----------+
| i-0a4209dkc6549a2ea | running |
| i-09379cj420ed015f2 | running |
| i-0c9e1100de0105ed6 | stopped |
| i-0f57b147ea9124344 | running |
| i-02e4cbcbe10cb5e79 | stopped |
+----------------------+-----------+
describe-instances.
You can check the instance-state-name regardless of the state of the instance (pending | running | shutting-down | terminated | stopping | stopped ) while using with describe-instances.
$ aws ec2 describe-instances --query 'Reservations[].Instances[*].{InstanceType: InstanceType, InstanceId: InstanceId, State: State.Name}' --profile lab --output table
----------------------------------------------------
| DescribeInstances |
+----------------------+----------------+----------+
| InstanceId | InstanceType | State |
+----------------------+----------------+----------+
| i-0a4209dkc6549a2ea | t3.xlarge | running |
| i-09379cj420ed015f2 | t2.small | running |
| i-0c9e1100de0105ed6 | m5.xlarge | stopped |
| i-0f57b147ea9124344 | c6i.xlarge | running |
| i-02e4cbcbe10cb5e79 | t1.micro | stopped |
+----------------------+----------------+----------+
However, you can get a specific state of an instance using --filers and --query, for example, if you are looking for only a stopped instance then you can use like below...
$ aws ec2 describe-instances --filters Name=instance-state-name,Values=stopped --query 'Reservations[].Instances[*].{InstanceType: InstanceType, InstanceId: InstanceId, State: State.Name}' --profile lab --output table
----------------------------------------------------
| DescribeInstances |
+----------------------+----------------+----------+
| InstanceId | InstanceType | State |
+----------------------+----------------+----------+
| i-0c9e1100de0105ed6 | m5.xlarge | stopped |
| i-02e4cbcbe10cb5e79 | t1.micro | stopped |
+----------------------+----------------+----------+
In a similar fashion, you can check only the running instance …
$ aws ec2 describe-instances --filters Name=instance-state-name,Values=running --query 'Reservations[].Instances[*].{InstanceType: InstanceType, InstanceId: InstanceId, State: State.Name}' --profile lab --output table
----------------------------------------------------
| DescribeInstances |
+----------------------+----------------+----------+
| InstanceId | InstanceType | State |
+----------------------+----------------+----------+
| i-0a4209dkc6549a2ea | t3.xlarge | running |
| i-09379cj420ed015f2 | t2.small | running |
+----------------------+----------------+----------+
Note:
Further, I personally like to dictionary format along with tabular output(--output table) while using AWS CLI to get the values in nice tabular form which is easy for readability, hence the same here to get the values of the instance-state in a hash form (i.e., a dictionary or associative array), you I have combined that with the --query to get a nicer readable output.
Yes, if you pass the --include-all-instances option to the command it will also show stopped instances
From AWS documentation about the describe-instance-status command:
--include-all-instances | --no-include-all-instances (boolean)
When true , includes the health status for all instances. When false, includes the health status for running instances only.
Default: false
My organization has two GitLab CI runners spun up on DigitalOcean. These runners have the exact same system configuration, Docker servers on Ubuntu.
The only difference between these two servers is how they are assigned to the GitLab (gitlab.com) projects:
Runner 1 is assigned on a project-by-project basis
Runner 2 is assigned to the top-level group owning all projects
Visual for clarity:
+ Group
|
+--- Runner 2
|
|--+ Sub-Group 1
| |
| +--+ Project 1.1
| | |
| | +--- Runner 1
| |
| +--+ Project 1.2
| |
| +--- Runner 1
|
+--+ Sub-Group 2
|
+--+ Project 2.1
| |
| +--- Runner 1
|
+--+ Project 2.2
|
+--- Runner 1
The only runner actually picking up jobs is Runner 1. Runner 2 appears as an "Available Group Runner" in the CI/CD settings for all projects, but not their second-level subgroups.
Is there a better way to do this? We'd rather avoid having to assign the runners on a per-project basis, but the group runner functionality is not working for us with the current configuration.
Our ideal configuration:
+ Group
|
+--- Runner 2
|
|--+ Sub-Group 1
| |
| +--- Runner 1
| |
| +--+ Project 1.1
| |
| +--+ Project 1.2
|
+--+ Sub-Group 2
|
+--+ Project 2.1
|
+--+ Project 2.2
To the best of my knowledge and research, GitLab does not support this functionality. GitLab Group Runners appear to only be available to projects directly within the scope of the group in question and not to any subgroups.
Hopefully this functionality is addressed in the future. Until then, I will continue to add Runners on a per-repo basis.
This morning I got emails for each of my Gitlab Pages that are hosted on custom domains, saying that the domain verification failed.
That's fine, because I don't think I ever verified them in the first place - good on Gitlab for getting this going.
When I head on over the the Settings>Pages>Domain_Details on each repo, I see the instructions to create the following record:
_gitlab-pages-verification-code.blog.ollyfg.com TXT gitlab-pages-verification-code={32_digit_long_code}
On creating this record, and clicking the "Verify Ownership" button, I get the message "Failed to verify domain ownership".
I have ensured that the record is set, and calling
dig -t txt +short _gitlab-pages-verification-code.blog.ollyfg.com
Returns:
"gitlab-pages-verification-code={same_32_digit_long_code}"
Is this a bug in Gitlab? Am I doing something wrong?
Thanks!
The docs (and the verification page) were a little confusing for me. Here's what worked for me, on GoDaddy:
A Record:
Name: #
Value: 35.185.44.232
CNAME:
Name: example.com
Value: username.gitlab.io
TXT Record:
Name: #
Value: gitlab-pages-verification-code=00112233445566778899aabbccddeeff
Verified with Gitlab, and also:
dig -t txt +short example.com
Here is how to get a subdomain.domain.com point to namespace.gitlab.io/project-name with Gandi.
The CNAME and TXT records generated by GitLab when adding a new subdomain to a project via Settings > Pages > New Domain did not work in my case. The exact non-working records were mysubdomain.mydomain.com CNAME mynamespace.gitlab.io. and _gitlab-pages-verification-code.mysubdomain.mydomain.com TXT gitlab-pages-verification-code=00112233445566778899aabbccddeeff.
Modifications like mysubdomain CNAME mynamespace.gitlab.io. (with and without a dot at the end) did not work, either (ping mysubdomain.mydomain.com said unknown host).
Using an A record and a TXT record with only the subdomain in the record's name field does work in my case. Here are the exact working records:
mysubdomain 1800 IN A 35.185.44.232
mysubdomain 1800 IN TXT "gitlab-pages-verification-code=00112233445566778899aabbccddeeff"
Note that the namespace.gitlab.io IP address has changed from 52.167.214.135 to 35.185.44.232 in 2018.
Wait as least 30 minutes to get the records propagate.
In my case GitLab also verified the domain automatically, I did not need to click the Verify button.
Wait for sometime, it worked for me. Initially, having the same problem as you mentioned.
Also, you may find this page useful: https://gitlab.com/help/user/project/pages/getting_started_part_three.md#dns-txt-record
It might be worthwhile, trying with:
blog.ollyfg.com
instead of: _gitlab-pages-verification-code.blog.ollyfg.com
I really get a hard time to make it work. But in the end below settings worked for me.
GoDaddy
domain.com
A record
+-----------+---------------------+
| Host | # |
+-----------+---------------------+
| Points To | 35.185.44.232 |
+-----------+---------------------+
To Verify your domain Add TXT record
TXT record
+-----------+-----------------------------------------------------------------+
| Host | # |
+-----------+-----------------------------------------------------------------+
| TXT Value | gitlab-pages-verification-code=00112233445566778899aabbccddeeff |
+-----------+-----------------------------------------------------------------+
subdomain.domain.com
CNAME record
+-----------+---------------------+
| Host | subdomain |
+-----------+---------------------+
| Points To | namespace.gitlab.io |
+-----------+---------------------+
To Verify your domain Add TXT record
TXT record
+-----------+-----------------------------------------------------------------+
| Host | _gitlab-pages-verification-code.subdomain |
+-----------+-----------------------------------------------------------------+
| TXT Value | gitlab-pages-verification-code=00112233445566778899aabbccddeeff |
+-----------+-----------------------------------------------------------------+
Note subdomain and verification code will be found under settings>page (create/details)
GitLab Pages IP on GitLab.com has been changed
from 52.167.214.135 to 35.185.44.232 in 2018
For GoDaddy (April 2020), I had to do the following:
|Type |Name |Value |
-----------------------------------------------------------------------------------
|A |example.com (or #) |35.185.44.232 |
|TXT |_gitlab-pages-verification-code|gitlab-pages-verification-code=blahblahblah|
|A |www |35.185.44.232 |
|CNAME|www.example.com |example.gitlab.io |
|TXT |_gitlab-pages-verification-code|gitlab-pages-verification-code=blahblahblah|
| |(or _gitlab-pages.verification-| |
| |code.www) | |
While the documentation said to use _gitlab-pages-verification-code.example.com and _gitlab-pages-verification-code.www.example.com, those did not work for me, and I could see within seconds after changing and re-checking my verification status that it changed from unverified to verified, and vice versa.
It's 2021, and this issue still happens. Can't verify domain with gitlab's suggested CNAME and TXT. Had to use on godaddy:
subdomain A 35.185.44.232
subdomain TXT gitlab-pages-verification-code=####
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
For example, I have two remote machines. Let's say, A, B.
Usually I can do vim scp://A/path/file to remote edit A's files locally.
So, is there a way to edit machine B, which can only be accessed from A, from host machine using vim directly? Thank you very much.
The topology:
+---------------------------------------------------------------+
| |
| |
| +--------------+ +-----------+ +-----------+ |
| | | | | | | |
| | HOST | +----> | A |+--->| B | |
| | | | | | | |
| +--------------+ +-----------+ +-----------+ |
| |
+---------------------------------------------------------------+
I agree with #Conner that this is a ssh-tunneling question but here is a possible answer anyway..
Install netcat on host 'A'
Add this to your $HOME/.ssh/config:
Host RemoteHost
Hostname B
User UsernameOnB
Port 22
ProxyCommand ssh UsernameOnA#A 'nc %h %p'
You would have to replace 'A', 'B', 'UsernameOnA' and 'UsernameOnB' with the matching hostnames or IP addresses for A and B (and check if netcat is installad as 'nc' or 'netcat' I've seen both..)
After that you should be able to:
$ vim scp://RemoteHost/path/to/file
This setup works best if you have public-key access to both systems, otherwise you will be prompted for passwords.
i'm trying to run the Red5 Media Server on my Live Server (Win Server 2008 R2).
installation worked, i've entered localhost with port 5080, but when trying to start the Red5 service i'm getting this error:
Windows could not start the Red5 service on Local Computer.
Error 1067: The process terminated unexpectedly.
things i already tried (without success):
run red5 setup as administrator
run red5 service as administrator
open port 5080 in firewall
turn off iis before trying to start the service
any ideas what could be wrong? thanks
UPDATE:
i've checked the logs:
(i already set the JAVA_HOME user environment variable and rebooted) .. no success yet
STATUS | wrapper | 2012/10/09 13:36:42 | --> Wrapper Started as Service
STATUS | wrapper | 2012/10/09 13:36:42 | Java Service Wrapper Community Edition 32-bit 3.3.6
STATUS | wrapper | 2012/10/09 13:36:42 | Copyright (C) 1999-2009 Tanuki Software, Ltd. All Rights Reserved.
STATUS | wrapper | 2012/10/09 13:36:42 | http://wrapper.tanukisoftware.org
STATUS | wrapper | 2012/10/09 13:36:42 |
STATUS | wrapper | 2012/10/09 13:36:43 | Launching a JVM...
FATAL | wrapper | 2012/10/09 13:36:43 | Unable to execute Java command. The system cannot find the file specified. (0x2)
FATAL | wrapper | 2012/10/09 13:36:43 | "java" -Xrs -XX:+AggressiveOpts -XX:+DisableExplicitGC -Djava.net.preferIPv4Stack=true -Dlogback.ContextSelector=org.red5.logging.LoggingContextSelector -Dcatalina.useNaming=true -Dpython.home=lib -Xverify:none -Xms256m -Xmx768m -Djava.library.path="lib" -classpath "lib/wrapper.jar;conf;boot.jar" -Dwrapper.key="35GMYkROEBTyRT4O" -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.pid=2420 -Dwrapper.version="3.3.6" -Dwrapper.native_library="wrapper" -Dwrapper.service="TRUE" -Dwrapper.cpu.timeout="10" -Dwrapper.jvmid=1 org.tanukisoftware.wrapper.WrapperSimpleApp org.red5.server.Bootstrap
ADVICE | wrapper | 2012/10/09 13:36:43 |
ADVICE | wrapper | 2012/10/09 13:36:43 | ------------------------------------------------------------------------
ADVICE | wrapper | 2012/10/09 13:36:43 | Advice:
ADVICE | wrapper | 2012/10/09 13:36:43 | Usually when the Wrapper fails to start the JVM process, it is because
ADVICE | wrapper | 2012/10/09 13:36:43 | of a problem with the value of the configured Java command. Currently:
ADVICE | wrapper | 2012/10/09 13:36:43 | wrapper.java.command=java
ADVICE | wrapper | 2012/10/09 13:36:43 | Please make sure that the PATH or any other referenced environment
ADVICE | wrapper | 2012/10/09 13:36:43 | variables are correctly defined for the current environment.
ADVICE | wrapper | 2012/10/09 13:36:43 | ------------------------------------------------------------------------
ADVICE | wrapper | 2012/10/09 13:36:43 |
FATAL | wrapper | 2012/10/09 13:36:43 | Critical error: wait for JVM process failed
Try to run the red5.bat to get more details about the error.
I was running into the same problem as you and managed to resolve it I thought I'd share:
In my case I needed to add a reference to the bin-folder of the Java Runtime Environment under the PATH environment variable. (Start --> Computer; Properties --> Advanced System Settings --> tab "advanced"; Environment Variables --> system variabeles; PATH variable.
Click edit and add the path to the bin folder of your Java installation.