Skip to content
This repository has been archived by the owner on Oct 30, 2019. It is now read-only.

New install/upgrade scripts for Cloud9. #145

Merged
merged 8 commits into from
Mar 26, 2018
Merged

New install/upgrade scripts for Cloud9. #145

merged 8 commits into from
Mar 26, 2018

Conversation

ludeeus
Copy link
Member

@ludeeus ludeeus commented Mar 23, 2018

Description:

These scripts will install/upgrade Cloud9 IDE to manage home assistant configuration.
I have also included an remove function we can use in the future if we want to.

Checklist:

  • The code change is tested and works locally. install/upgrade/remove
  • Script has validation check of the job. install/upgrade

If pertinent:

  • Created/Updated documentation at /docs

@ludeeus ludeeus added this to the v0.9.0 milestone Mar 23, 2018
docs/cloud9.md Outdated
@@ -0,0 +1,25 @@
## Description
Cloud9 IDE is an online integrated development environment. It supports hundreds of programming languages.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest we change the description since this isn't a "sales forum" 😁
Addition of how it's installed etc should probably be described since there's very little about it.
A link to the location for a local install would be recommended.

If that's not available let's limit this to:

Cloud9 IDE is an online integrated development environment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to "Cloud9 SDK is an webservice IDE that makes it easy to manage you configuration files."

docs/cloud9.md Outdated
Service status: `sudo systemctl status [email protected]`

***
The installation script was originally contributed by [@Ludeeus](https://github.com/ludeeus).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Limit these two to one line.

This script was originally contributed by @Ludeeus

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in next commit.

node=$(which node)
if [ -z "${node}" ]; then #Installing NodeJS if not already installed.
printf "Downloading and installing NodeJS...\\n"
curl -sL https://deb.nodesource.com/setup_8.x | bash -
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8x is a rather old version and will cause problems with newer tools such as the miio tool used by the Xiaomi vacuum.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8 is what we use for homebridge as well, so I need to test that before changing to 9 (the current version).


function cloud9-show-long-info {
printf "Installs Cloud9 IDE onto this system.\\n"
printf "Cloud9 IDE is an online integrated development environment. It supports hundreds of programming languages.\\n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rephrase according to the description changes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in next commit.

@@ -0,0 +1,9 @@
[Unit]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This service should be run after the network is available and most likely not after Home Assistant since a change to the config might cause Home Assistant not to start.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in next commit.

bash /home/homeassistant/c9sdk/scripts/uninstall-c9.sh
rm -R /home/homeassistant/c9sdk
rm -R /home/homeassistant/.c9
rm -R /home/homeassistant/.homeassistant/.c9
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid making changes to the config directory since this might be something the user want's to keep a copy of. If not it's fairly easy to add it to for example .gitignore

printf "Stopping Cloud9 service...\\n"
systemctl stop [email protected]
sudo -u homeassistant -H /bin/bash << EOF
printf "Downloading and installing newest version of Cloud9 SDK...\\n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your mixing IDE and SDK throughout your descriptions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script downloads the SDK which is what enable the IDE so I think it should say both, I have done some rephrasing.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

echo "Changing to the homeassistant user"
sudo -u homeassistant -H /bin/bash << EOF
printf "Downloading and installing Cloud9 SDK...\\n"
git clone git://github.com/c9/core.git /home/homeassistant/c9sdk
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be preferable to have the installation in a proper location instead of in a users home directory?
Example could be AppDaemon.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will look into moving it to something like /etc/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More like /opt

sync
bash /home/homeassistant/c9sdk/scripts/uninstall-c9.sh
rm -R /home/homeassistant/c9sdk
rm -R /home/homeassistant/.c9
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's only configuration files it's generally best practice no to touch these if they are in a users home directory.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the default workspace to /home/homeassistant/ so we do no need to delete in ./homeassistant

@ludeeus
Copy link
Member Author

ludeeus commented Mar 24, 2018

This is still an WIP, there are a lot to be tested, but its an good start and it currently works.
@Landrash Thanks for the review, will tag you again when I have worked some more on this :)

@ludeeus ludeeus changed the title WIP: New install/upgrade scripts for Cloud9 IDE. WIP: New install/upgrade scripts for Cloud9. Mar 24, 2018
echo "Changing to the homeassistant user"
sudo -u homeassistant -H /bin/bash << EOF
printf "Downloading and installing Cloud9 SDK...\\n"
git clone git://github.com/c9/core.git /home/homeassistant/c9sdk
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More like /opt

printf "Stopping Cloud9 service...\\n"
systemctl stop [email protected]
sudo -u homeassistant -H /bin/bash << EOF
printf "Downloading and installing newest version of Cloud9 SDK...\\n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ludeeus ludeeus changed the title WIP: New install/upgrade scripts for Cloud9. New install/upgrade scripts for Cloud9. Mar 25, 2018
@ludeeus
Copy link
Member Author

ludeeus commented Mar 25, 2018

@Landrash I think I have corrected all your review comments and have now removed "WIP", could you do an other review? :)

Copy link
Collaborator

@Landrash Landrash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!
Great job! 🍰

@Landrash Landrash merged commit cf98ec4 into home-assistant:dev Mar 26, 2018
@ludeeus ludeeus deleted the cloud9-IDE branch April 2, 2018 17:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants