Use the selfhosting domains from the ecosystem

This commit is contained in:
Johannes Zellner 2016-09-13 10:19:18 +02:00
parent 9c58b903e6
commit ab26324364
5 changed files with 29 additions and 25 deletions

View File

@ -9,7 +9,7 @@ var common = require('./common.js'),
exports = module.exports = AppStore;
function AppStore(origin) {
this._origin = origin;
this._origin = origin || process.env.APPSTORE_API_ORIGIN;
// credentials for api calls
this._credentials = {

View File

@ -32,7 +32,7 @@ function Cloudron(box) {
}
Cloudron.prototype._setDomain = function (domain) {
this._isCustomDomain = domain === process.env.CUSTOM_DOMAIN || domain === process.env.SELFHOST_DOMAIN;
this._isCustomDomain = domain === process.env.CUSTOM_DOMAIN || domain === process.env.EC2_SELFHOST_DOMAIN || domain === process.env.DO_SELFHOST_DOMAIN;
this._adminFqdn = this._isCustomDomain ? 'my.' + domain : 'my-' + domain;
this._origin = this._isCustomDomain ? 'https://my.' + domain : 'https://my-' + domain;
};

View File

@ -22,7 +22,7 @@ var BOX_VERSION = process.env.BOX_VERSION;
describe('Appstore new user flow', function () {
this.timeout(0);
var appStore = new AppStore('https://api.staging.cloudron.io');
var appStore = new AppStore();
var owner = common.getOwner();
var admin = common.getAdmin();
@ -32,7 +32,7 @@ describe('Appstore new user flow', function () {
user: process.env.IMAP_USERNAME,
password: process.env.IMAP_PASSWORD,
host: process.env.IMAP_HOST,
port: 993, // imap port
port: 993, // imap port
tls: true,
readOnly: true
});

View File

@ -1,6 +1,8 @@
/*
* This tests a flow for cloudron owner creating a selfhosted cloudron on ec2
*
* This tests a flow for cloudron owner creating a selfhosted cloudron on digitalocean
* Owner creates a cloudron, activates it, installs and app and deletes the cloudron eventually
* We use a us-east-1 (US standard) backup bucket here
*
*/
@ -23,14 +25,14 @@ require('colors');
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
const BOX_VERSION = process.env.BOX_VERSION;
const SELFHOST_DOMAIN = 'smartserver.io';
const DO_SELFHOST_DOMAIN = process.env.DO_SELFHOST_DOMAIN;
const SSH_KEY = 'id_rsa_e2e_selfhost';
const DO_TYPE = '1gb';
const DO_REGION = 'ams2';
const DO_REGION = 'nyc3';
const DO_TOKEN = process.env.DIGITAL_OCEAN_TOKEN_STAGING;
const EC2_REGION = 'eu-central-1';
const EC2_REGION = 'us-east-1';
const BACKUP_KEY = 'somesecret';
const BACKUP_BUCKET = 'selfhost-test';
const BACKUP_BUCKET = 'selfhost-test-' + EC2_REGION;
const AWS_ACCESS_KEY = process.env.AWS_STAGING_ACCESS_KEY;
const AWS_ACCESS_SECRET = process.env.AWS_STAGING_SECRET_KEY;
@ -54,7 +56,7 @@ function machine(args, options) {
describe('Selfhost DigitalOcean Cloudron creation', function () {
this.timeout(0);
var appStore = new AppStore('https://api.staging.cloudron.io');
var appStore = new AppStore();
var owner = common.getOwner();
var cloudron, appId, backupInfo, instanceId, restoreInstanceId, migrateInstanceId;
@ -74,7 +76,7 @@ describe('Selfhost DigitalOcean Cloudron creation', function () {
it('can create a cloudron', function () {
var params = [
'--fqdn ' + SELFHOST_DOMAIN,
'--fqdn ' + DO_SELFHOST_DOMAIN,
'--type ' + DO_TYPE,
'--token ' + DO_TOKEN,
'--region ' + DO_REGION,
@ -100,7 +102,7 @@ describe('Selfhost DigitalOcean Cloudron creation', function () {
console.log('New instance created with ID', instanceId);
cloudron = new Cloudron({
domain: SELFHOST_DOMAIN,
domain: DO_SELFHOST_DOMAIN,
setupToken: null,
version: toVersion,
ip: null
@ -127,7 +129,7 @@ describe('Selfhost DigitalOcean Cloudron creation', function () {
});
it('send mail to cloudron user', function (done) {
mailer.sendMailToCloudronUser(owner.username + '@' + SELFHOST_DOMAIN, done);
mailer.sendMailToCloudronUser(owner.username + '@' + DO_SELFHOST_DOMAIN, done);
});
it('did receive mail', function (done) {
@ -152,7 +154,7 @@ describe('Selfhost DigitalOcean Cloudron creation', function () {
cloudron.checkForUpdates();
var params = [
SELFHOST_DOMAIN,
DO_SELFHOST_DOMAIN,
'--yes',
'--ssh-key ' + SSH_KEY,
'--username ' + owner.username,
@ -203,7 +205,7 @@ describe('Selfhost DigitalOcean Cloudron creation', function () {
it('can restore the box', function () {
var params = [
'--fqdn ' + SELFHOST_DOMAIN,
'--fqdn ' + DO_SELFHOST_DOMAIN,
// THOSE SHOULD BE STASHED IN THE CONFIG
// '--type ' + DO_TYPE,
// '--token ' + DO_TOKEN,
@ -240,7 +242,7 @@ describe('Selfhost DigitalOcean Cloudron creation', function () {
it('can migrate cloudron', function () {
var params = [
'--fqdn ' + SELFHOST_DOMAIN,
'--fqdn ' + DO_SELFHOST_DOMAIN,
// THOSE SHOULD BE STASHED IN THE CONFIG
// '--token ' + DO_TOKEN,
// '--ssh-key ' + SSH_KEY

View File

@ -1,6 +1,8 @@
/*
*
* This tests a flow for cloudron owner creating a selfhosted cloudron on ec2
* Owner creates a cloudron, activates it, installs and app and deletes the cloudron eventually
* We use a eu-central-1 backup bucket here
*
*/
@ -22,7 +24,7 @@ require('colors');
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
const BOX_VERSION = process.env.BOX_VERSION;
const SELFHOST_DOMAIN = 'cloudron.club';
const EC2_SELFHOST_DOMAIN = process.env.EC2_SELFHOST_DOMAIN;
const EC2_TYPE = 't2.small';
const EC2_SIZE = 30;
const EC2_REGION = 'eu-central-1';
@ -30,7 +32,7 @@ const EC2_SSH_KEY = 'id_rsa_e2e_selfhost';
const EC2_SUBNET = 'subnet-801402e9';
const EC2_SECURITY_GROUP = 'sg-b9a473d1';
const BACKUP_KEY = 'somesecret';
const BACKUP_BUCKET = 'selfhost-test';
const BACKUP_BUCKET = 'selfhost-test-' + EC2_REGION;
const AWS_ACCESS_KEY = process.env.AWS_STAGING_ACCESS_KEY;
const AWS_ACCESS_SECRET = process.env.AWS_STAGING_SECRET_KEY;
@ -54,7 +56,7 @@ function machine(args, options) {
describe('Selfhost EC2 Cloudron creation', function () {
this.timeout(0);
var appStore = new AppStore('https://api.staging.cloudron.io');
var appStore = new AppStore();
var ec2 = new AWS.EC2({ accessKeyId: AWS_ACCESS_KEY, secretAccessKey: AWS_ACCESS_SECRET, region: EC2_REGION });
var owner = common.getOwner();
@ -75,7 +77,7 @@ describe('Selfhost EC2 Cloudron creation', function () {
it('can create a cloudron', function () {
var params = [
'--fqdn ' + SELFHOST_DOMAIN,
'--fqdn ' + EC2_SELFHOST_DOMAIN,
'--type ' + EC2_TYPE,
'--disk-size ' + EC2_SIZE,
'--region ' + EC2_REGION,
@ -102,7 +104,7 @@ describe('Selfhost EC2 Cloudron creation', function () {
console.log('New instance created with ID', instanceId);
cloudron = new Cloudron({
domain: SELFHOST_DOMAIN,
domain: EC2_SELFHOST_DOMAIN,
setupToken: null,
version: toVersion,
ip: null
@ -129,7 +131,7 @@ describe('Selfhost EC2 Cloudron creation', function () {
});
it('send mail to cloudron user', function (done) {
mailer.sendMailToCloudronUser(owner.username + '@' + SELFHOST_DOMAIN, done);
mailer.sendMailToCloudronUser(owner.username + '@' + EC2_SELFHOST_DOMAIN, done);
});
it('did receive mail', function (done) {
@ -154,7 +156,7 @@ describe('Selfhost EC2 Cloudron creation', function () {
cloudron.checkForUpdates();
var params = [
SELFHOST_DOMAIN,
EC2_SELFHOST_DOMAIN,
'--yes',
'--ssh-key ' + EC2_SSH_KEY,
'--username ' + owner.username,
@ -205,7 +207,7 @@ describe('Selfhost EC2 Cloudron creation', function () {
it('can restore the box', function () {
var params = [
'--fqdn ' + SELFHOST_DOMAIN,
'--fqdn ' + EC2_SELFHOST_DOMAIN,
'--type ' + EC2_TYPE,
'--disk-size ' + EC2_SIZE,
'--region ' + EC2_REGION,
@ -242,7 +244,7 @@ describe('Selfhost EC2 Cloudron creation', function () {
it('can migrate cloudron', function () {
var params = [
'--fqdn ' + SELFHOST_DOMAIN,
'--fqdn ' + EC2_SELFHOST_DOMAIN,
'--ssh-key ' + EC2_SSH_KEY,
'--access-key-id ' + AWS_ACCESS_KEY,
'--secret-access-key ' + AWS_ACCESS_SECRET,