# Possible to specify stack/project name in file?

**URL:** <https://forums.suse.com/t/possible-to-specify-stack-project-name-in-file/933>\
**Category:** Rancher 1.x\
**Created:** [November 11, 2015, 6:03pm UTC](https://forums.suse.com/t/possible-to-specify-stack-project-name-in-file/933 "2015-11-11T18:03:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![andyshinn](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/andyshinn/32/442_2.png) [@andyshinn](https://forums.suse.com/u/andyshinn)\
**Post date:** [November 11, 2015, 6:03pm UTC](https://forums.suse.com/t/possible-to-specify-stack-project-name-in-file/933/1 "2015-11-11T18:03:22Z")

</div>

Is it possible to specify the stack name in a file (rancher-compose.yml) or as a label in docker-compose.yml? When working with another user I noticed their root folder had a different name which presents a different stack name by default. I know I can just have people add -p to rancher-compose. But it would be nice to just stick it somewhere by default.

---

<div class="post-metadata">

**Author:** ![ebishop](https://avatars.discourse-cdn.com/v4/letter/e/9dc877/32.png) [@ebishop](https://forums.suse.com/u/ebishop)\
**Post date:** [November 11, 2015, 11:20pm UTC](https://forums.suse.com/t/possible-to-specify-stack-project-name-in-file/933/2 "2015-11-11T23:20:39Z")

</div>

the rancher-compose -p option will set the stack name

---

<div class="post-metadata">

**Author:** ![andyshinn](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/andyshinn/32/442_2.png) [@andyshinn](https://forums.suse.com/u/andyshinn)\
**Post date:** [November 12, 2015, 2:29am UTC](https://forums.suse.com/t/possible-to-specify-stack-project-name-in-file/933/3 "2015-11-12T02:29:50Z")

</div>

Sure, I am ware of `-p`. But I’d love to be able to specify stack name via label or other option in `rancher-compose.yml`. If not possible now, then consider a feature request so I don’t have to specify `-p`.

---

<div class="post-metadata">

**Author:** ![mishak](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/mishak/32/412_2.png) [@mishak](https://forums.suse.com/u/mishak)\
**Post date:** [November 12, 2015, 2:42pm UTC](https://forums.suse.com/t/possible-to-specify-stack-project-name-in-file/933/4 "2015-11-12T14:42:46Z")

</div>

Not only `-p` option but env `COMPOSE_PROJECT_NAME` too.

---

<div class="post-metadata">

**Author:** ![tbossert](https://avatars.discourse-cdn.com/v4/letter/t/ac91a4/32.png) [@tbossert](https://forums.suse.com/u/tbossert)\
**Post date:** [November 12, 2015, 9:40pm UTC](https://forums.suse.com/t/possible-to-specify-stack-project-name-in-file/933/5 "2015-11-12T21:40:57Z")

</div>

I have a different use case for this request. I have our architecture spanned over several projects using the same compose file. While this works fine, I do have to be careful to specify the stack when running compose commands otherwise it creates some stacks that I only want in one project. I know the docker-compose file needs to remain native to docker but the rancher-compose could allow for you to specify a project for a stack. Default could be to deploy in any project specified if the projects line didn’t exist. If the projects line exists it would only deploy if the project specified on the command line matched.

---

<div class="post-metadata">

**Author:** ![mishak](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/mishak/32/412_2.png) [@mishak](https://forums.suse.com/u/mishak)\
**Post date:** [November 13, 2015, 2:36pm UTC](https://forums.suse.com/t/possible-to-specify-stack-project-name-in-file/933/6 "2015-11-13T14:36:21Z")

</div>

I was thinking about that and chose to have git repository with submodules in it referencing stacks repos.  
That way I have single source of truth in repository managing the project/environment while simple way to upgrade and commit latest definitions of stacks.

Directory layout looks like this:

```auto
 # [root repo]
production:
    app: [stack-x@v0.1.0]
    monitoring: [service-monitoring@v0.5.6]
    storage: [service-storage@v0.3.0]

```

Note: I was very lucky beginning on a greenfield so I was able to utilize features like external\_links and services etc. So this might not work well with apps that were not designed for Rancher from start.

---

<div class="post-metadata">

**Author:** ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)\
**Post date:** [November 17, 2015, 4:17am UTC](https://forums.suse.com/t/possible-to-specify-stack-project-name-in-file/933/7 "2015-11-17T04:17:30Z")

</div>

There is this issue open in Github, which would let you use a stack name label and have that pick the stack.

> <https://github.com/rancher/rancher/issues/2120>
>
> @fentas wrote in the rancher-compose repository:
> I am wondering. I have a compose file with a few services depending on each other....

I believe that @mishak’s use case would be different request.

---

<div class="post-metadata">

**Author:** ![andyshinn](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/andyshinn/32/442_2.png) [@andyshinn](https://forums.suse.com/u/andyshinn)\
**Post date:** [November 17, 2015, 4:39am UTC](https://forums.suse.com/t/possible-to-specify-stack-project-name-in-file/933/8 "2015-11-17T04:39:17Z")

</div>

Ah, I didn’t find that issue in searching. That would indeed help my case. Even if I have to explicitly set the label per service would be fine. Following that issue, thanks @denise!

---

<div class="post-metadata">

**Author:** ![mishak](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/mishak/32/412_2.png) [@mishak](https://forums.suse.com/u/mishak)\
**Post date:** [November 18, 2015, 11:06am UTC](https://forums.suse.com/t/possible-to-specify-stack-project-name-in-file/933/9 "2015-11-18T11:06:57Z")

</div>

@denise Yes I understood it wrong.
