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

Add support for CentOS 7 or newer to mup #949

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Meteor Up is a command line tool that allows you to deploy any [Meteor](http://meteor.com) app to your own server.

You can install and use Meteor Up on Linux, Mac and Windows. It can deploy to servers running Ubuntu 14 or newer.
You can install and use Meteor Up on Linux, Mac and Windows. It can deploy to servers running Ubuntu 14 or newer and CentOS 7 or newer.

This version of Meteor Up is powered by [Docker](http://www.docker.com/), making deployment easy to manage and reducing server specific errors.

Expand Down Expand Up @@ -86,5 +86,3 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
<a href="https://opencollective.com/meteor-up/sponsor/7/website" target="_blank"><img src="https://opencollective.com/meteor-up/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/meteor-up/sponsor/8/website" target="_blank"><img src="https://opencollective.com/meteor-up/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/meteor-up/sponsor/9/website" target="_blank"><img src="https://opencollective.com/meteor-up/sponsor/9/avatar.svg"></a>


26 changes: 17 additions & 9 deletions src/plugins/default/command-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ export function validate(api) {
function statusColor(
versionCorrect,
distributionCorrect,
hasAptGet,
hasPackageManager,
defaultBash,
_overallColor
) {
let color = chalk.green;
let overallColor = _overallColor;

if (!hasAptGet) {
if (!hasPackageManager) {
color = chalk.red;
overallColor = 'red';
} else if (!distributionCorrect) {
Expand All @@ -146,7 +146,7 @@ export async function status(api) {
const servers = Object.values(api.getConfig().servers);
const lines = [];
let overallColor = 'green';
const command = 'lsb_release -r -s || echo "false"; lsb_release -is; apt-get -v &> /dev/null && echo "true" || echo "false"; echo $BASH';
const command = 'lsb_release -r -s || echo "false"; lsb_release -is; apt-get -v &> /dev/null && echo "true" || echo "false"; yum -h &> /dev/null && echo "true" || echo "false"; echo $BASH';
const results = await map(
servers,
server => api.runSSHCommand(server, command),
Expand All @@ -160,18 +160,26 @@ export async function status(api) {
version,
distribution,
aptGet,
yum,
bash = ''
] = output.trim().split('\n');

const versionCorrect = parseInt(version, 10) > 13;
const distributionCorrect = distribution === 'Ubuntu';
const hasAptGet = aptGet.trim() === 'true';
let versionCorrect = false;
let distributionCorrect = false;
if (distribution === 'CentOS') {
distributionCorrect = true;
versionCorrect = parseInt(version, 10) >= 7;
} else if (distribution === 'Ubuntu') {
distributionCorrect = true;
versionCorrect = parseInt(version, 10) > 13;
}
const hasPackageManager = aptGet.trim() === 'true' || yum.trim() === 'true';
const defaultBash = bash.trim().length > 0;

const colors = statusColor(
versionCorrect,
distributionCorrect,
hasAptGet,
hasPackageManager,
defaultBash,
overallColor
);
Expand All @@ -180,8 +188,8 @@ export async function status(api) {
overallColor = colors.overallColor;

text += color(`${distribution} ${version}`);
if (!hasAptGet) {
text += chalk.red(' apt-get not available');
if (!hasPackageManager) {
text += chalk.red(' package manager (yum or apt-get) not available');
}

if (!defaultBash) {
Expand Down
38 changes: 26 additions & 12 deletions src/plugins/docker/assets/docker-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,33 @@
install_docker () {
# Remove the lock
set +e
sudo rm /var/lib/dpkg/lock > /dev/null
sudo rm /var/cache/apt/archives/lock > /dev/null
sudo dpkg --configure -a
set -e

# Required to update system
sudo apt-get update
sudo apt-get -y install wget lxc iptables curl

# Install docker
wget -qO- https://get.docker.com/ | sudo sh
sudo usermod -a -G docker ${USER}
if lsb_release -is > /dev/null
then
# Required to update Ubuntu system
sudo rm /var/lib/dpkg/lock > /dev/null
sudo rm /var/cache/apt/archives/lock > /dev/null
sudo dpkg --configure -a
set -e
sudo apt-get update
sudo apt-get -y install wget lxc iptables curl
# Install docker
wget -qO- https://get.docker.com/ | sudo sh
sudo usermod -a -G docker ${USER}
else
# Required to update CentOS system
sudo rm -f /var/run/yum.pid > /dev/null
sudo yum clean all > /dev/null
set -e
sudo yum -y update
sudo yum -y install wget lxc iptables curl redhat-lsb-core initscripts
# Install docker
wget -qO- https://get.docker.com/ | sudo sh
sudo usermod -a -G docker ${USER}
# start docker on boot
sudo chkconfig docker on
fi

# start docker service
sudo service docker start || sudo service docker restart
}

Expand Down