Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

156
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda