Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iron mup dev --init throws " A Project Already Exists" #206

Closed
sherif84 opened this issue Sep 4, 2015 · 10 comments
Closed

iron mup dev --init throws " A Project Already Exists" #206

sherif84 opened this issue Sep 4, 2015 · 10 comments

Comments

@sherif84
Copy link

sherif84 commented Sep 4, 2015

I'm trying to deploy using mup however following the instruction 👍

  1. added the following to .iron/config.json:
    "mup": {
    "version": "mup",
    "development": "/config/development",
    "production": "/config/production"}
  2. called iron mup development --init throws the error :
    Deploying with mup... -Error: Command failed: /bin/sh -c mup init
    A Project Already Exists

Any Idea ?

@dustinws
Copy link

Ah, yes. I suspect you created your project with the scaffolding tool. When you do this, it creates your config directories, for dev and production. This automatically creates a 'settings.json' file for you to put meteor settings in to. However, iron mup xxx --init also creates a 'settings.json' file.

So mup is reading your current settings.json file as a mup project, simply copy it's contents and delete it. re run the init command, this time you should get a success. now paste in your settings in to the new settings.json file and you are all set :)

EDIT: I just tried this with a fresh iron project and was successful in creating a mup project. For good measure, make sure mup and mupx are both installed globally with npm. Looks like you do, from your error log.

$ sudo npm install -g mup mupx
Cheers!

This bit is purely personal preference-
I prefer to use the mup tool by itself, not combined with iron. this requires you to cd in to the appropriate config DIR, but I've had greater success with more consistency going this route. Also, someone correct me if i'm wrong, but I think this bypasses the env.sh file that iron creates. My structure is as follows.

config/development/
-settings.json
-env.sh

config/production/
-mup.json
-settings.json

iron run (local) will automagically run the config/development files. For production, my env variables are stored in the mup.json instead of the env.sh in dev. When i want to deploy, i simply run

$ cd /PATH-TO-APP/config/production && mup setup && mup deploy
If i'm simply updating an existing deployment, i replace setup with reconfig

$ cd /PATH-TO-APP/config/production && mup reconfig && mup deploy

Like I mentioned earlier, you can access mup however you wish. This is simply my preference and to my experience, offers the most consistent results.

@aarlaud
Copy link

aarlaud commented Sep 17, 2015

hi,
I have a problem using mup with iron. Typing iron mup development --init (or any mup command for that matter) gives me the same result/screen as if I was typing iron help, where it list the various iron commands. Any ideas what I am missing?
And if I were to use mup on its own, where should I run it from? From the app folder inside the iron-cli folder structure, or from the folder containing all the iron elements? (build, config, bin, app, etc...)?

thanks for your help !
Antoine

@dustinws
Copy link

Sounds like you didn't include mup in your .iron/config.json, so iron doesn't know what packages to use for mup. The OP has his setup in the opening post, it should work for you. Just replace the dev/prod paths with your own. Also make sure mup is installed globally through npm. Cheers!

@aarlaud
Copy link

aarlaud commented Sep 17, 2015

This is actually the part that confuses me, i did add that part. See my .iron/config.json file below
{
"engines": {
"html": "html",
"js": "js",
"css": "css"
},

"template": {
"html": true,
"js": true,
"css": true
},

"route": {
"controller": true,
"template": true
},

"mup": {
"version": "mup|mupx",
"development": "/config/development",
"staging": "/config/staging",
"production": "/config/production"
}
}

@dustinws
Copy link

Hmm, and you're sure you've installed mup & mupx via npm?
Try $ sudo npm install -g mup mupx
see if it grabs anything. if so, that's most likely your problem. I prefer mup by itself,
without the iron cli. Although if the iron-cli version is your poison, they both need to be installed globally.

@aarlaud
Copy link

aarlaud commented Sep 17, 2015

I had put in this global install command. just did it again with the same result.
I am fine using mup by itself (mup init works for ex) but I am not clear where I should run this with the iron-cli folder structure.
If I have a config/production folder, do I need to cd in it and run mup from there?

@dustinws
Copy link

If you run mup by itself you need to be in the directory of the mup.json that you want to use. Dev/Prod/Staging. You need to cd into it.
iron mup, on the other hand, is smart enough to know you're in an iron project. you can run it from the project root, but i believe it's smart enough to be run anywhere in the project. I know you can run iron run from any directory in the project. As long as mup is configured in the config.json, I don't think it's any different.
To be sure, run it in the root DIR, where you have app, build, config, etc.

@aarlaud
Copy link

aarlaud commented Sep 17, 2015

thanks for your help, I am going to try that.
Thanks again !
AA

@aarlaud
Copy link

aarlaud commented Sep 18, 2015

Ok, I got it to work but the env.sh for my given environment got lost in the process. I ended up adding the required environment variables manually in the env.sh used by mup on my server, post deployment, and restarted my app for the variable values to get picked up.
Now that the setup is done on all sides, pushing code updates is a pleasure :)
I'd like to get it to work via iron-cli though so managing environments gets better so I will monitor this thread and see how it goes.

thanks so much for your help !

Antoine

chrisbutler pushed a commit that referenced this issue Oct 20, 2015
big improvements to mup integration to fix #206
@chrisbutler
Copy link
Contributor

@sherif84 @dustinws @aarlaud the latest release has fixes for this issue. i'd like to handle env.sh integration at some point in the near future, but for now, initializing with mup should work properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants