-
Notifications
You must be signed in to change notification settings - Fork 602
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
add setup scripts. Fixes #1467 #1627
add setup scripts. Fixes #1467 #1627
Conversation
Add setup directory having the setup files for the corresponding operating system
Why is the main script in python? |
@ragesoss I tried to create a single script which could detect the operating system of the user and run the appropriate script/batch file. I thought python was decent option for that as it is widely used. I am not sure if it is the right way but I thought it could work. |
setup.py
Outdated
shell=True, check=True) | ||
|
||
if platform.platform().lower().find('ubuntu') != -1 \ | ||
or platform.platform.lower().find('debian') != -1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be platform()
setup/deb-setup.sh
Outdated
echo 'Setting up your developmental environment. This may take a while.' | ||
|
||
echo '[*] Adding keys...' | ||
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curl
may be absent. If so, it should exit at this point with instructions to install curl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it exit the script or try to install curl also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either way would be okay.
setup/deb-setup.sh
Outdated
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && echo '[*] Installing rvm...' && \curl -sSL https://get.rvm.io | bash -s stable | ||
|
||
echo '[*] Installing Ruby-2.5.0...' | ||
sudo rvm install ruby-2.5.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ruby 2.5.0 will not yet be active on a fresh install. When RVM installer exits, it provides a necessary step in its output, along the lines of source /home/sage/.rvm/scripts/rvm
.
Only once you do that (or log out and log in again) will rvm be active, and then you can install the required ruby version.
setup/deb-setup.sh
Outdated
echo '[*] Installing GNUpg...' | ||
sudo apt-get install gnupg | ||
|
||
echo '[*] Adding Keys for rvm...' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This command both gets keys and installs RVM.
It also overwrites any previous installation and reinstalls it if already present. It should skip installation if rvm is already installed.
setup/deb-setup.sh
Outdated
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && echo '[*] Installing rvm...' && \curl -sSL https://get.rvm.io | bash -s stable | ||
|
||
echo '[*] Installing Ruby-2.5.0...' | ||
sudo rvm install ruby-2.5.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RVM is not installed with sudo, so this command should not be sudo
either.
setup/deb-setup.sh
Outdated
cp config/database.example.yml config/database.yml | ||
|
||
echo '[*] Installing Mysql-server...' | ||
sudo apt-get install mysql-server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On recent debian, at least, this needs to be mariadb-server
or default-mysql-server
.
setup/deb-setup.sh
Outdated
gem install bundler | ||
|
||
echo '[*] Installing Gems and dependencies...' | ||
sudo apt-get install libmysqlclient-dev libpq-dev libqtwebkit-dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure any of these are actually necessary any more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strike that... libmysqlclient-dev is needed to build the mysql2 gem, but it actually is now provided by libmariadbclient-dev
on debian.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think they are needed when used with MySQL. At least I needed them when I was setting up my developmental environment.
setup/deb-setup.sh
Outdated
sudo apt-get install pandoc | ||
|
||
echo '[*] Creating configuration files...' | ||
cp config/application.example.yml config/application.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two cp
steps should only be done if the relevant files already present already. Otherwise, they'll overwrite what is there.
setup/deb-setup.sh
Outdated
|
||
echo '[*] Creating configuration files...' | ||
cp config/application.example.yml config/application.yml | ||
cp config/database.example.yml config/database.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what we want to do here is to change the example database.yml file to use a different user instead of root, and then create that user in mysql with the password specified in the file and grant ownership to that user for the new databases.
Otherwise, this will break at the rake step unless the root mysql password has been set to the same one in database.yml.
Thanks for the review. I will look through all the changes carefully. |
setup/deb-setup.sh
Outdated
bundle install | ||
|
||
echo '[*] Installing yarn...' | ||
sudo apt-get install yarn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work without first adding a repo that has (the right) yarn
. On debian, there may be a default package, cmdtest
, which provides yarn
and conflicts with the yarn deb repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I shifted the command for adding the repo for yarn on the top so that for all the keys required we need to call apt-get update
only once.
This is a promising start! I'll merge it once I can run it on a clean debian system, and once we get reports of it working successfully on windows and OSX. (I might be able to test those in a VM once the debian version works.) A few ideas that would help make this easier to use, maintain, and troubleshoot:
This is a big job, so thanks for taking this on! |
Makes the script silent ie. script doesn't print unnecessary installation output statements and prints only the working task. Errors are still logged on the shell for refrence for the user.
Add the default credentials for the user in database.example.yml and create user in debian setup script.
45f476b
to
940427f
Compare
setup/deb-setup.sh
Outdated
else | ||
printf "${CLEAR_LINE}Application configurations not found!\n" | ||
printf '[*] Creating Application configurations...' | ||
cp config/application.example.yml config/application.yml && printf "${CLEAR_LINE}Application configurations created!\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This must be done before db:migrate
, or the migrations will fail.
1edc9a9
to
dfff87f
Compare
dfff87f
to
09e998f
Compare
284fcad
to
85c7185
Compare
Hi @ragesoss , I had made the changes for the ruby error and exit. Please look into this and suggest any changes. |
setup/deb-setup.sh
Outdated
# Add Keys for MariaDB | ||
output_line "sudo apt-get install -y software-properties-common" | ||
output_line "sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8" && \ | ||
output_line "sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.2/ubuntu xenial main'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the problem. We should rely on whatever package provides mysql from the system default repositories. This repo is not compatible with my debian buster VM.
Got through the migrations this time, but now it's got problems probably because of too-old node (4.8.4 from the debian repo) which is only available via |
The debian script now works. I think before we merge this, though, we should add some directions for use to the script... something saying 'this is a work in progress; please report your setup results and any error messages at [link to issue on github]'. It almost certainly doesn't work on Windows or OSX yet, but we can keep the current scripts as starting points. |
Fixes #1467. This adds the setup scripts for the repo. The main setup.py looks for the operating system of the user and executes the corresponding script. Right now, the script supports Debian based systems, OSX and Windows systems.