Skip to content
Snippets Groups Projects
Commit 1e3b4682 authored by Cam Saul's avatar Cam Saul
Browse files

Simplify Mac App setup steps

parent 3543183d
No related merge requests found
......@@ -36,7 +36,6 @@ OSX/Resources/metabase.jar
OSX/build
/osx-artifacts
OSX/dsa_priv.pem
bin/config.json
bin/release/aws-eb/metabase-aws-eb.zip
*.sqlite
/reset-password-artifacts
......
{
"codesigningIdentity": "Developer ID Application: Metabase, Inc",
"slackWebhookURL": "",
"awsProfile": "metabase",
"awsBucket": ""
"awsBucket": "downloads.metabase.com"
}
......@@ -8,11 +8,9 @@ use File::Copy 'copy';
use File::Copy::Recursive 'rcopy'; # CPAN
use File::Path 'remove_tree';
use File::stat 'stat';
use JSON 'encode_json', 'from_json'; # CPAN
use Readonly; # CPAN
use String::Util 'trim'; # CPAN
use Text::Caml; # CPAN
use WWW::Curl::Simple; # CPAN
use Metabase::Util;
......@@ -298,30 +296,6 @@ sub create_dmg {
# ------------------------------------------------------------ UPLOADING ------------------------------------------------------------
sub announce_on_slack {
Readonly my $slack_url => config('slackWebhookURL') or return;
Readonly my $version => version();
Readonly my $awsURL => 'https://s3.amazonaws.com/' . config('awsBucket') . '/' . upload_subdir() . '/Metabase.dmg';
my $text = "Metabase OS X $version 'Complexity-Embracing Toucan' Is Now Available!\n\n" .
"Get it here: $awsURL\n\n";
open(my $file, get_file_or_die($release_notes)) or die $!;
while (<$file>) {
m/^\s+<li>.*$/ && s|^\s+<li>(.*)</li>$|$1| && ($text .= '* ' . $_);
}
my $json = encode_json {
channel => '#general',
username => 'OS X Bot',
icon_emoji => ':bird:',
text => trim($text)
};
my $curl = WWW::Curl::Simple->new;
unless ((my $response = $curl->post($slack_url, $json))->code == 200) {
die 'Error posting to slack: ' . $response->code . ' ' . $response->content . "\n";
}
}
# Upload artifacts to AWS
# Make sure to run `aws configure --profile metabase` first to set up your ~/.aws/config file correctly
......@@ -352,8 +326,6 @@ sub upload {
's3', 'cp', $upload_dir,
"s3://$aws_bucket") == 0 or die "Upload failed: $!\n";
announce_on_slack;
announce "Upload finished."
}
......
# Metabase OS X App
NOTE: These instructions are only for packaging a built Metabase uberjar into `Metabase.app`. They are not useful if your goal is to work on Metabase itself; for development, please see our [developers' guide](developers-guide.md).
NOTE: These instructions are only for packaging a built Metabase uberjar into `Metabase.app`. They are not useful if your goal is to work on Metabase itself; for development, please see our [developers' guide](developers-guide.md).
## Prereqs
1. Install XCode.
2. Run `./bin/build` to build the latest version of the uberjar.
1. Run `./bin/build` to build the latest version of the uberjar.
3. Update Perl. I'm not sure these steps are actually needed, so feel free to try skipping it and come back to it if it fails:
```bash
# Upgrade Perl
brew install perl
# Add new version of perl to your $PATH
# (replace "5.24.0_1" below with whatever version you installed)
echo 'export PATH="/usr/local/Cellar/perl/5.24.0_1/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
# Double-check that we're using the newer version of CPAN
# (If this is your first time running CPAN, use the default config settings when prompted)
cpan --version # You should see a line like "running under Perl version 5.24.0."
```
4. Next, you'll need to run the following commands before building the app:
1. Next, you'll need to run the following commands before building the app:
```bash
# Fetch and initialize git submodule
git submodule update --init
# Install libcurl (needed by WWW::Curl::Simple (I think))
brew install curl && brew link curl --force
# The new version of LLVM is snippy so have CPAN pass compiler flags to fix errors
# (Make sure this file exists first. If you didn't upgrade Perl in the step above,
# it might be in a different location; perhaps called "Config.pm".
# You may need to run "cpan" (no arguments) to generate an appropriate initial config.
# As above, you can go with the defaults).
sed -i '' -e "s/'make_arg' => q\[\]/'make_arg' => q\[CCFLAGS=\"-Wno-return-type\"\]/" ~/.cpan/CPAN/MyConfig.pm
# Install Perl modules used by ./bin/osx-setup and ./bin/osx-release
# You may have to run this as sudo if you didn't upgrade perl as described in step above
cpan install File::Copy::Recursive JSON Readonly String::Util Text::Caml WWW::Curl::Simple
cpan install File::Copy::Recursive Readonly String::Util Text::Caml
# Copy JRE and uberjar
./bin/osx-setup
```
......@@ -66,16 +40,12 @@ brew install awscli
# You just need the access key ID and secret key; use the defaults for locale and other options.
aws configure --profile metabase
# Copy & Edit Config file. Alternative ask Cam for a copy of his
cp bin/config.json.template bin/config.json
emacs bin/config.json
# Obtain a copy of the private key used for signing the app (ask Cam)
# and put a copy of it at ./dsa_priv.pem
cp /path/to/private/key.pem OSX/dsa_priv.pem
```
You'll probably also want an Apple Developer ID Application Certificate in your computer's keychain. You'll need to generate a Certificate Signing Request from Keychain Access, and have Sameer go to [the Apple Developer Site](https://developer.apple.com/account/mac/certificate/) and generate one for you, then load the file on your computer.
You'll probably also want an Apple Developer ID Application Certificate in your computer's keychain. You'll need to generate a Certificate Signing Request from Keychain Access, and have Sameer go to [the Apple Developer Site](https://developer.apple.com/account/mac/certificate/) and generate one for you, then load the file on your computer.
After that, you are good to go:
```bash
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment