Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
Setting up Vapor and MongoKitten

After successfully deploying on localhost (0.0.0.0:8080) While I pushed the code to git for heroku, I am getting error on heroku.

Cannot connect to MongoDB
Process exited with status 0

Inside package file I added

dependencies: [
        .Package(url: "https://github.com/vapor/vapor.git", majorVersion: 1, minor: 1),
        .Package(url: "https://github.com/OpenKitten/MongoKitten.git", majorVersion: 3)
    ],

Inside main.swift the program exists on this line

let mongoDatabase = try Database(mongoURL: "mongodb://localhost/mydatabase")

Additional info: I believe that on commit there is something which is left out by the SourceTree. As the same code is also not working after checkout on a different machine. And the code is compiling perfect.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

here is an info how to get the DATABASE_URL for postgres but it shold be the same for mongo DB:

heroku addons:create heroku-postgresql:hobby-dev

after some minits preparation:

heroku config

there shold be the url

in your Procfile (you created with vapor init) you can add the db url:

our text editor and update it so that looks like the below.

web: App --env=production --workdir="./"
web: App --env=production --workdir=./ --config:servers.default.port=$PORT --config:postgresql.url=$DATABASE_URL

this is the db url we add --config:postgresql.url=$DATABASE_URL

Save Procfile and type git push heroku master

after some time it should working.

you should change the name postgresql.url to your mongo db confog name (depending which mongo addon you use)

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!