> For the complete documentation index, see [llms.txt](https://docs.yemreak.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.yemreak.com/arsiv/web/heroku.md).

# Heroku

## Heroku Önemli Notlar <a href="#heroku-oenemli-notlar" id="heroku-oenemli-notlar"></a>

### Heroku varsayılan atamaları <a href="#heroku-varsayilan-atamalari" id="heroku-varsayilan-atamalari"></a>

```
NPM_CONFIG_LOGLEVEL=errorNODE_ENV=productionNODE_MODULES_CACHE=trueNODE_VERBOSE=false
```

> Bu atamalara kod içerisinden `process.env.<üsttekilerden biri>` şeklinde erişilebilir.
>
> *console.log(process.env.NODE\_ENV) gibi*

### Heroku Script Çalıştırma <a href="#heroku-script-calistirma" id="heroku-script-calistirma"></a>

* Heroku aldığı node.js uygulamasındaki **start scriptini** çalıştırır. Yani `npm run start` komutunu işler
* Bu sebeple **package.json** dosyası olmak zorunda ve **start scriptini** içermek zorundadır
* Artık heroku yükleme işleminin hemen ardından `build` scriptini çalıştırmaya başlayacak
  * Tarihi ve detaylı bilgi için [buraya](https://devcenter.heroku.com/changelog-items/1557) tıklayabilirsin

Örnek package.json dosyası

```
{  "name": "temp",  "version": "1.0.0",  "description": "",  "main": "index.js",  "directories": {    "lib": "lib"  },  "scripts": {    "start": "node index.js",    "test": "echo \"Error: no test specified\" && exit 1"  },  "author": "",  "license": "ISC"}
```

### Heroku port ayarı <a href="#heroku-port-ayari" id="heroku-port-ayari"></a>

```
port = process.env.PORT || 5000
```

> Heroku kendiliğinden port atama işlemi yapmaktadır. Bu sebeple dinlediğimiz portu **process.env.PORT** yapmak zorundayız.

## Heroku Komutları <a href="#heroku-komutlari" id="heroku-komutlari"></a>

### Bu komutların çalışması için heroku-cli'nin yüklü olması lazım <a href="#bu-komutlarin-calismasi-icin-heroku-clinin-yueklue-olmasi-lazim" id="bu-komutlarin-calismasi-icin-heroku-clinin-yueklue-olmasi-lazim"></a>

> Npm üzerinden heroku yükleme işlemi

### Heroku'ya giriş yapma <a href="#herokuya-giris-yapma" id="herokuya-giris-yapma"></a>

> Email ve şifre istenecektir. Siteye kayıt olduğunuz bilgileri girin

### Depo (repository) kopyalama işlemi <a href="#depo-repository-kopyalama-islemi" id="depo-repository-kopyalama-islemi"></a>

```
heroku git:clone -a [herokudaki uygulama adı] [kopyalanacağı dizin yolu]cd [kopyalanacağı dizin yolu]
```

* herokudaki uygulama adı: mytempsite
* kopyalanacağı dizin yolu: C:\Desktop\Temp

> Heroku'da bulunan uygulamayı istediğimiz dizinin içine kopyalıyoruz. Sonrasında kopyalama işleminin olduğu dizine giriyoruz.

### Değişiklikleri karşıya yükleme <a href="#degisiklikleri-karsiya-yuekleme" id="degisiklikleri-karsiya-yuekleme"></a>

```
git add .git commit -am "Mesaj"git push heroku master
```

> Değişkliklikler heroku uygulmamıza eklenecektir.

### Uygulamayı başlatma <a href="#uygulamayi-baslatma" id="uygulamayi-baslatma"></a>

### Hata raporlarını görüntüleme <a href="#hata-raporlarini-goeruentueleme" id="hata-raporlarini-goeruentueleme"></a>

```
heroku logs --tail -a [uygulama adı]
```

* uygulama adı: mytempsite (herokudaki uygulama adımız)

> Uygulmamız çalışırken yapılan işlemleri raporlar

## Heroku Ek Ayarlar <a href="#heroku-ek-ayarlar" id="heroku-ek-ayarlar"></a>

Babel gibi ek uygulamalar kullanıyorsanız bu kısım sizin için oldukça önemlidir.

> **Not**: Tüm es5 olmayan dosyaları *babel* ile es5'e çevirip herokuya yüklemek performans açısından daha sağlıklıdır.

### Heroku üretim modunu kapatma <a href="#heroku-ueretim-modunu-kapatma" id="heroku-ueretim-modunu-kapatma"></a>

```
heroku config:set NPM_CONFIG_PRODUCTION=false
```

> Üretim modunu kapatır. Bu sayede heroku **package.json** dosyasındaki **dev-dependencies** içindekilerini indirir. Ardından tekrar bu mod isteğe bağlı açılabilir

### Heroku Bash Erişimi <a href="#heroku-bash-erisimi" id="heroku-bash-erisimi"></a>

> Bu komut ile terminale erişmiş oluruz. Bu sayede npm komutlarımızı çalıştırabiliriz.

> Yukarıdaki komut ile gerekli olan uygulamaları (dev-dependencies) kendimiz indirebiliriz.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.yemreak.com/arsiv/web/heroku.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
