Heroku App Only Working On Local Machine - mongodb

Have something really odd going on with Heroku.
I have an application build in React/JS/Node with Mongo.
If I pull up the link to my app on my local machine: https://obscure-crag-61417.herokuapp.com/, I can see a version of my website, but it is not updating for any changes that I push to Heroku.
Even more strange, is that on a non-local machine, if i visit the aforementioned link, I get the boilerplate 'Express' page.
I've tried clearing the cache, exiting browsers on both PC's but same old story.
I have the MongoDB config set in Heroku.
Not sure what could be going on here.
Any ideas?
PS--here's my code: https://github.com/pythoncreate/twit-stocks

Okay i figured this one out. I'm pretty sure it was how I was setting the ports on the backend. Heroku has some specific rules about this:
Heroku + node.js error (Web process failed to bind to $PORT within 60 seconds of launch)

Related

Postgres, Prisma Working Fine One Day, 'P1001 Error: Can't Reach Database' the next

For this project, I am using a prisma / Postgres database. I have made no changes to my code, and I have pulled a coworkers working version of the code to no avail. I am unable to do anything with the database, I cannot migrate, I cannot run mutations, and I cannot even open the psql console, as every command is met with
P1001: Can't reach database server at localhost:5432
Please make sure your database server is running at localhost:5432
I am not sure what I could have possibly done, I don't know enough about ports or even the contents of app.json well enough to have messed anything up. Now, no mutations can go through.
Interestingly enough, this all happened after I ran npx primsa migrate deploy on the deployed database which is on a EC2 VM from AWS. Since then, the native app associated with the database refuses to work, though it is worth nothing that the webapp connects to the deployed database just fine. This being said, nothing works locally, as the database / Port / Server don't exist anymore according to my machine, which makes no sense. I have no idea how to try to re-spin it, or why every single query / mutation from my Native App now ONLy returns Response not successful: Received status code 400 despite it having the same exact syntax it did when it worked, as well as the WebApp having the same syntax and server (ExpressJS). Does anyone have any ideas what could be causing this?
The error code 400 refers to a bad request coming from the client: too large request, malformed syntax, invalid request message framing, etc.
First step: make sure that your database server is indeed running. Try connecting to it with other SQL Clients or Libraries. Sometimes Prisma is just being difficult.
Second thing: are you hosting the database on the local server? I can assume you are because of the localhost. Make sure no other programs are using this port or maybe waiting for it.
Sorry if this doesn't help. Good luck!

VSCode Remote Server stuck on initializing server

I'm currently trying to access a remote server using VS Code's Remote SSH extension. I haven't had a problem when using it before (that was around a month ago) but today when I tried to access the server I ran into some trouble.
I have the hostname and everything configured in a config file, and so I just click on that option and type in the password. However, VS Code seems to be stuck on "Opening Remote..." for the past hour or so. The dialogue I get in the terminal is as follows:
username#host's password:
Running remote connection script
Acquiring lock on /home/username/.vscode-server/bin/abcdefghijklmnop1234567989/
vscode-remote-lock.abcdefghijklmnop1234567989
Installing to /home/username/.vscode-server/bin/abcdefghijklmnop1234567989...
Downloading with wget
Does anybody know what the problem might be? Is this normal?
EDIT
As soon as I posted this the connection was successfully made. However, I would also like to still know what the problem was and if it normally takes around an hour, and what this process might be doing. I also believe it would be helpful to the community overall.
Thank you.
I've faced the same issue just now and realized that firewall protection has something to do with it.
As soon as I disabled it, the remote connection was established and I managed to see my code again.

gitlab backup restore affects url redirection

I got a production server (ip:172.24.4.10) where GitLab 8.15.3 is installed.
Then I made a GitLab backup and I transferred the file to a test server(ip:172.24.4.50).
When I'm using a browser, I go to http://www.mygitlab.com which aims to ip 172.24.4.10.
The test server has same GitLab version and I executed the restore from backup file and it worked.
Even though, when I use the browser I go to http://172.24.4.50, it redirects to http://www.mygitlab.com.
It wasn't happening before restoration on test server.
I was checking gitlab, gitlab-nginx config files and I'm not finding something related to http://www.mygitlab.com.
What can I do?
P.D.
I put http://www.mygitlab.com as example.
My PC was restarted becasuse there is a job in charged to restart PCs. After that, I used the browser going to http://172.24.4.50 and it started to work. So I think it was a cache browser issue and I didn't make any changes to gitlab config files.
If you haven't transfered/copied over your NGiNX settings, then it is a GitLab configuration issue.
Said configuration (for example in /etc/gitlab/gitlab.rb) does include:
external_url "http://gitlab.example.com"
Do check if the redirection comes from there.

Trouble connecting to Realm Server on AWS EC2

I am having trouble connecting to my online Realm on EC2. I've got an EC2 instance running. I've run start-object-server.command. I've pasted the code for my setupRealm() method.
let address = "XX.YYY.ZZZ.AA:9080" // "IPv4 PublicIP" from my EC2 dashboard
var httpURL: URL! { return URL(string: "http://" + address)! }
var realmURL: URL! { return URL(string: "realm://" + address)! }
func setupRealm() {
// My credentials when setting up the Realm admin dashboard after launching realm object server.
let username = "XXXXX#gmail.com"
let password = "XXXX"
let credentials = SyncCredentials.usernamePassword(username: username, password: password)
SyncUser.logIn(with: credentials, server: httpURL) { user, error in
guard let user = user else {
print(String(describing: error!))
return
}
...
}
}
SyncUser.logIn produces this error:
Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server."
UserInfo={NSUnderlyingError=0x600000059680 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)"
UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}},
NSErrorFailingURLStringKey=http://XX.YYY.ZZZ.AA:9080/auth,
NSErrorFailingURLKey=http://XX.YYY.ZZZ.AA:9080/auth, _kCFStreamErrorDomainKey=1, _kCFStreamErrorCodeKey=61,
NSLocalizedDescription=Could not connect to the server.}
I also can't log in to my synced realm using the Realm Browser, though I am able to open local (non-synced) realms from the iOS simulator. And I am running the latest version of Realm Browser.
What's strange is that a week or so ago I was able to connect to the EC2 realm using both my app and the browser, as well as another app that syncs with the realm. I've compared the code and they're basically the same –- any differences I've spotted I am very confident that they don't matter (and I've tried changing some things back, to no avail.)
Since the time it was working, I've installed the recent macOS updates, as well as the Realm 2.5 update. I had some trouble with the realm updates and wound up installing and reinstalling them a few times, but I believe it's working normally, with, again, the latest version of everything. I don't think I changed anything else, I don't remember.
Unfortunately, I actually don't remember my process for setting up the EC2 server -- that is:
I don't think I did anything with AMI's. I don't remember installing any, or anything like that. Although my EC2 instance does have an AMI ID: realm-object-server-hvm-20170309 (ami-d518b9c3). So maybe I did.
I have my keypair in a safe place on my HD, and I think I used it for something at some point...but I don't remember.
I think I used my Public DNS for something at some point...but I don't remember.
What I do remember is:
I didn't use CocoaPods for anything. I dragged in the Realm frameworks and did import RealmSwift (though I have since installed and used CocoaPods for other things and would be fine converting these projects to use CocoaPods)
In the instructions to install Realm Object Server the only thing I did was install the macOS bundle and run start-object-server.command to start the server. I didn't do anything past that. No configuration or security groups or anything. I didn't do any of these because I'm a relative beginner and I don't understand most, if any of it (doing very well with swift but all this terminal code and server stuff is generally over my head). For instance, I don't really understand any of the "Mandatory settings" section, like how to specify settings in the config file, or how to give them as command line arguments.
Similarly, I'm unclear when it's necessary to have the server running in the terminal. I only just realized today that the reason that localhost:9080 sometimes doesn't work is because I'm not running the server.
I'm sure I've done a great many things wrong, but what's strange is that this all used to work, even with all the things I've probably done wrong or left out. I hope someone can help. Thanks a lot.
PS. Here's how the Realm Browser behaves when I try to access my realm in various ways:
(you can see by the number of options I'm trying that I don't really know which is which/which one I'm supposed to use. Again, one of these worked in the past, but I don't remember which)
Open Sync URL, realm://XX.YYY.ZZZ.AA:9080/~/ gives the "Please provide valid credentials to access this Realm" dialog. And I am pretty damn sure I'm entering the correct credentials.
Open Sync URL, http://XX.YYY.ZZZ.AA:9080/~/ leaves the "Connect" button disabled
Connect to Object Server, realm://XX.YYY.ZZZ.AA:9080/ gives "Could not connect to the server."
Connect to Object Server, http://XX.YYY.ZZZ.AA:9080/ leaves the "Connect" button disabled
I've got an EC2 instance running. I've run
start-object-server.command.
start-object-server.command is for running local instances of the Realm Object Server; the ones accessible via http://localhost:9080. You might need to be careful since if you're running a local instance of ROS locally, as well as trying to connect to one remotely on AWS, there might be some confusion as to which server you ended up talking to. :)
I've pasted the code for my setupRealm() method.
That code looks correct. Just remember that if you ran start-object-server.command, you would have been presented with the localhost instance of ROS automatically, so those credentials wouldn't exist on your EC2 instance at present.
I also can't log in to my synced realm using the Realm Browser, though I am able to open local (non-synced) realms from the iOS simulator. And I am running the latest version of Realm Browser.
That's normal behavior. You can open local Realm files in the Browser, but for ones created with the Realm Mobile Platform, you'll need to connect to them; you cannot open them directly. If you can't connect to a Realm, that either means the Realm Mobile Platform isn't running, or isn't configured for the right URLs properly.
I had a play with setting up my own EC2 instance, and I got it working as intended. You can tell if it's working because you should be able to navigate to your public DNS URL with port 9080 and see the Realm Mobile Platform dashboard login page. (eg 'http://ec2-00-000-000-00.compute-1.amazonaws.com:9080').
It's possible that while you set up an EC2 instance, the Realm Mobile Platform itself wasn't installed too. If that's the case, you can easily manually install RMP by connecting to your instance via SSH and running the Ubuntu installation script:
# Setup Realm's PackageCloud repository
curl -s https://packagecloud.io/install/repositories/realm/realm/script.deb.sh | sudo bash
# Update the repositories
sudo apt-get update
# Install the Realm Object Server
sudo apt-get install realm-object-server-developer
# Enable and start the service
sudo systemctl enable realm-object-server
sudo systemctl start realm-object-server
But the crux of the matter is that you need to confirm you can access your Realm Mobile Platform dashboard on your EC2 in order to confirm that the Object Server is indeed running, and you've set the proper credentials. Good luck!

phpPgAdmin on OpenShift is not accessible from application URL

Installed this (https://github.com/BanzaiMan/openshift-origin-cartridge-phppgadmin) to my Tiny Tiny RSS application on OpenShift to manage my database.* However, after the installation and a few restarts, .../phppgadmin/ URL gives me 404 error. Any ideas? Could it be the github cartridge is using old environmental variables? Thanks!
*The reason I want to install phppgadmin in the first place is to vacuum my ever-expanding database on Tiny Tiny RSS application. vacuumdb and vacuumdb -f -a only claim ~50mb and app-tidy does ~100mb, as opposed to ~600mb previously. So, I need to find another solution, like phppgadmin, to address my quota limitations.
Instead of using phppgadmin, it would be a much better idea to download pgadmin onto your computer and then use the rhc port-forward command to connect to your database and do your maintenance. That cartridge is pretty old and likely will not get updated anytime soon (or ever).