Skip to content

Commit

Permalink
Begin to add reproducable builds
Browse files Browse the repository at this point in the history
  • Loading branch information
LadyCailin committed Sep 15, 2017
1 parent b013a0e commit 63ee648
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
14 changes: 13 additions & 1 deletion src/main/java/com/laytonsmith/core/Main.java
Expand Up @@ -217,7 +217,19 @@ public class Main {
+ " for future runs, you can be sure that the local cache is up to date.") + " for future runs, you can be sure that the local cache is up to date.")
.addFlag("clear-local-cache", "Clears the local cache of all entries, then exits.") .addFlag("clear-local-cache", "Clears the local cache of all entries, then exits.")
.addFlag('d', "do-validation", "Validates all of the uploaded web pages, and prints out a summary of the results." .addFlag('d', "do-validation", "Validates all of the uploaded web pages, and prints out a summary of the results."
+ " This requires internet connection."); + " This requires internet connection.")
.addFlag("install", "When installing a fresh server, it is useful to have the setup completely automated. If this flag"
+ " is set, then the server is assumed to be a fresh ubuntu server, with nothing else on it. In that case,"
+ " the server will be installed from scratch automatically. NOTE: This will not account for the fact that"
+ " the documentation website is generally configured to allow for multiple versions of documentation. Old"
+ " versions will not be accounted for or uploaded. This process, if desired, must be done manually. If this"
+ " option is configured, the installation will occur before the upload or processing of files. During installation,"
+ " a \"lock\" file will be created, and if that file is present, it is assumed that the installation"
+ " has already occured on the instance, and will not be repeated. This is a safety measure to ensure"
+ " that the instance will not attempt to be redeployed, making it safe to always add the install"
+ " flag. If this flag is set, additional options need to be added to the config file. The remote server"
+ " is assumed to be an already running AWS ubuntu instance, with security groups configured and a pem"
+ " file available, but no login is necessary.");
suite.addMode("site-deploy", siteDeploy); suite.addMode("site-deploy", siteDeploy);


ARGUMENT_SUITE = suite; ARGUMENT_SUITE = suite;
Expand Down
Expand Up @@ -62,8 +62,6 @@
import java.util.Set; import java.util.Set;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
Expand Down Expand Up @@ -95,6 +93,10 @@ public class SiteDeploy {
private static final String VALIDATOR_URL = "validator-url"; private static final String VALIDATOR_URL = "validator-url";
private static final String POST_SCRIPT = "post-script"; private static final String POST_SCRIPT = "post-script";


private static final String INSTALL_URL = "install-url";
private static final String INSTALL_PEM_FILE = "install-pem-file";
private static final String INSTALL_PUB_KEYS = "install-pub-keys";

public static void run(boolean generate_prefs, boolean useLocalCache, File sitedeploy, String password, public static void run(boolean generate_prefs, boolean useLocalCache, File sitedeploy, String password,
boolean doValidation) throws Exception { boolean doValidation) throws Exception {
List<Preferences.Preference> defaults = new ArrayList<>(); List<Preferences.Preference> defaults = new ArrayList<>();
Expand Down Expand Up @@ -149,6 +151,15 @@ public static void run(boolean generate_prefs, boolean useLocalCache, File sited
+ " executed using the system shell. Leave this option empty to skip this" + " executed using the system shell. Leave this option empty to skip this"
+ " step. If the file is specified, it must exist, and if it does not end" + " step. If the file is specified, it must exist, and if it does not end"
+ " in .ms, it must be executable.")); + " in .ms, it must be executable."));
defaults.add(new Preferences.Preference(INSTALL_URL, "", Preferences.Type.STRING, "The ec2 instance public url."
+ " NOTE: The security group of the instance must be configured to allow access to port 22. Ports 80 and"
+ " 443 are also used, and should be opened, but that will not affect the installation process."));
defaults.add(new Preferences.Preference(INSTALL_PEM_FILE, "", Preferences.Type.STRING, "The path to the PEM file"
+ " used for initial login."));
defaults.add(new Preferences.Preference(INSTALL_PUB_KEYS, "", Preferences.Type.STRING, "A list of public keys"
+ " to upload to, and add to the authorized_keys file on the server. These keys will not"
+ " be used by this script, but can allow easier login in the future. If blank, no additional keys"
+ " will be uploaded."));


Preferences prefs = new Preferences("Site-Deploy", Logger.getLogger(SiteDeploy.class.getName()), defaults); Preferences prefs = new Preferences("Site-Deploy", Logger.getLogger(SiteDeploy.class.getName()), defaults);
if (generate_prefs) { if (generate_prefs) {
Expand Down
21 changes: 21 additions & 0 deletions src/main/resources/siteDeploy/install.sh
@@ -0,0 +1,21 @@
#!/bin/bash

# This script is meant to install all the components needed to install the methodscript.com site
# on a brand new server. There are a few assumptions that are made, if this script is to be run without
# problems.
# 1. This will be installed on a fresh server in the AWS cloud
# 2. This script will be run as root.
# 3. Nothing else is present on the server, and only ephemeral data will be stored on this server
# If any of these assumptions are incorrect, then the "install" option must not be specified in the deploy
# command

# Don't break stuff
set -e

# Update the server
apt-get update
apt-get upgrade

# Install apache
apt-get install apache2

0 comments on commit 63ee648

Please sign in to comment.