A few steps closer to running the cloudron code locally

This commit is contained in:
Johannes Zellner
2015-01-21 00:22:56 +01:00
parent b82e6045b4
commit 91f1ebdca2
2 changed files with 14 additions and 11 deletions
+1 -11
View File
@@ -31,18 +31,8 @@ Development setup
Running
-------
* `mkdir -p $HOME/.yellowtent/data` - create data directory
* `npm run-script migrate` - this sets up the database
* Setup initial webadmin oauth client credentials:
```bash
export ADMIN_ID=$(cat /proc/sys/kernel/random/uuid)
export ADMIN_ORIGIN=https://admin-localhost
export ADMIN_SCOPES="root,profile,users,apps,settings,roleAdmin"
sqlite3 ~/.yellowtent/data/cloudron.sqlite "INSERT OR REPLACE INTO clients (id, appId, clientId, clientSecret, name, redirectURI, scope) VALUES (\"\$ADMIN_ID\", \"webadmin\", \"cid-webadmin\", \"secret-webadmin\", \"WebAdmin\", \"$ADMIN_ORIGIN\", \"\$ADMIN_SCOPES\")"
```
* `./run.sh` - this starts up nginx to serve up the webadmin
* make sure at first run that the env variable `APP_SERVER_URL` is set to **https://cloudron-dev.herokuapp.com**
* `DEBUG=box:* ./app.js` - this the main box code. `NODE_ENV` is set to `production` by default.
* `DEBUG=box:* ./app.js` - this the main box code.
* Navigate to https://admin-localhost
Deployment setup
+13
View File
@@ -14,14 +14,27 @@ mkdir -p $NGINX_ROOT/applications
mkdir -p $NGINX_ROOT/cert
mkdir -p $DATA_DIR
# get the database current
npm run-script migrate
cp postinstall/nginx/nginx.conf $NGINX_ROOT/nginx.conf
cp postinstall/nginx/mime.types $NGINX_ROOT/mime.types
cp postinstall/nginx/cert/* $NGINX_ROOT/cert/
# adjust the generated nginx config for local use
touch $NGINX_ROOT/naked_domain.conf
sed -e "s/##ADMIN_FQDN##/admin-localhost/" -e "s|##SRCDIR##|$SRCDIR|" postinstall/nginx/admin.conf_template > $NGINX_ROOT/applications/admin.conf
sed -e "s/user www-data/user $USER/" -i $NGINX_ROOT/nginx.conf
# create basic version.json
echo "{ \"version\": \"$PROVISION_VERSION\", \"boxVersionsUrl\": \"$PROVISION_BOX_VERSIONS_URL\" }" > "$DATA_DIR/version.json"
# add webadmin oauth client
export WEBADMIN_ID=abcdefg
export WEBADMIN_ORIGIN=https://admin-localhost
export WEBADMIN_SCOPES="root,profile,users,apps,settings,roleAdmin"
sqlite3 $DATA_DIR/cloudron.sqlite "INSERT OR REPLACE INTO clients (id, appId, clientId, clientSecret, name, redirectURI, scope) VALUES (\"$WEBADMIN_ID\", \"webadmin\", \"cid-webadmin\", \"secret-webadmin\", \"WebAdmin\", \"$WEBADMIN_ORIGIN\", \"$WEBADMIN_SCOPES\")"
# start nginx
sudo nginx -c nginx.conf -p $NGINX_ROOT