Skip to content

Commit

Permalink
Getting better
Browse files Browse the repository at this point in the history
  • Loading branch information
lagergren committed Dec 20, 2023
1 parent 30b3268 commit 53b2029
Show file tree
Hide file tree
Showing 18 changed files with 1,694 additions and 561 deletions.
42 changes: 30 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# Logs and databases #
######################
#
# Logs and databases
#
*.log
*.out
*.tmp
*.temp
*.sql
*.sqlite

#
# OS generated files #
######################
#
.DS_Store
.DS_Store?
._*
Expand All @@ -17,20 +19,36 @@
ehthumbs.db
Thumbs.db

# build directory #
###################
#
# Build directories
#
build/

#
# Module aggregation directory:
#
# While we can still collect everyting into a common lib folder, as a final build step,
# if we want, the 'standard' Maven style way would be to just build and run the project.
# Every component declaratively states its dependencies to build and/or run, and any
# task using these dependencies gets them lazily resolved, and exactly what it needs,
# nothing more. We will likely implement a distribution config for XTC applications
# like this, of course, so that the old "lib" folder is some kind of versioned
# publishable artifact)
#
lib/

# xdk directory #
###################
#
# XDK directory
#
xdk/

# user-specific project files #
###############################
#
# User-specific project files
#
prj/
.idea/

# Gradle-specific project files #
#################################
.gradle
#
# Gradle caches
#
.gradle
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ RUN mkdir -p ~/xqiz.it/platform \
&& cd ~/xtc_platform && ~/xvm/gradlew build

WORKDIR /root/xtc_platform
CMD ["xec", "-L", "lib/", "lib/kernel.xtc", "qwerty"]
CMD ["xec", "-L", "lib/", "lib/kernel.xtc", "qwerty"]
147 changes: 127 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,69 @@ TODO

The project is organized as a number of sub-projects, with the important ones to know about being:

* The *common* library ([platform/common](./common)), contains common interfaces shared across platform modules.

* The *kernel* library ([platform/kernel](./kernel)), contains the boot-strapping functionality. It's responsible for starting system services and introducing them to each other.

* The *common* library ([platform/common](./common)), contains common interfaces shared across platform modules.

* The *kernel* library ([platform/kernel](./kernel)), contains the boot-strapping functionality. It's responsible for starting system services and introducing them to each other.

* The *host* library ([platform/host](./host)), contains the manager for hosted applications.

* The *platformDB* library ([platform/platformDB](./platformDB)), contains the platform database.

* The *platformUI* library ([platform/platformUI](./platformUI)), contains the end-points for the platform web-application.

## Installation

1. Please follow steps 1-3 of the [XDK Installation](https://github.com/xtclang/xvm#installation).
2. Clone [the platform repository](https://github.com/xtclang/platform) to your local machine.

## Steps to test the PAAS functionality:

Note that steps 2 and 3 are temporary, and step 3 needs to be re-executed every time after an OS reboot.

1. Create "xqiz.it" subdirectory under the user home directory for the platform persistent data. The subdirectory "platform" will be used to keep the platform operational information and subdirectory "users" for hosted applications.

2. Create a file "~/xqiz.it/port-forwarding.conf" with the following content:

rdr pass on lo0 inet proto tcp from any to self port 80 -> 127.0.0.1 port 8080
rdr pass on lo0 inet proto tcp from any to self port 443 -> 127.0.0.1 port 8090

3. Run the following command to redirect http and https traffic to unprivileged ports:

sudo pfctl -evf ~/xqiz.it/platform/port-forwarding.conf

4. Make sure you can ping the local platform address:

gradle@linuxkit-1a9fc18e4ccc:~/platform$ more README.md
# Platform as a Service #

This is the public repository for the prototype of the PAAS project.

## What is PAAS?

TODO

## Status:

This project is currently in the "proof of concept" mode.

## License

TODO

## Layout

The project is organized as a number of sub-projects, with the important ones to know about being:

* The *common* library ([platform/common](./common)), contains common interfaces shared across platform modules.

* The *kernel* library ([platform/kernel](./kernel)), contains the boot-strapping functionality. It's responsible for starting system services and introducing them to each other.

* The *host* library ([platform/host](./host)), contains the manager for hosted applications.

* The *platformDB* library ([platform/platformDB](./platformDB)), contains the platform database.
* The *platformDB* library ([platform/platformDB](./platformDB)), contains the platform database.

* The *platformUI* library ([platform/platformUI](./platformUI)), contains the end-points for the platform web-application.

* The *platformUI* library ([platform/platformUI](./platformUI)), contains the end-points for the platform web-application.

## Installation

1. Please follow steps 1-3 of the [XDK Installation](https://github.com/xtclang/xvm#installation).
Expand All @@ -45,35 +98,89 @@ Note that steps 2 and 3 are temporary, and step 3 needs to be re-executed every
rdr pass on lo0 inet proto tcp from any to self port 443 -> 127.0.0.1 port 8090

3. Run the following command to redirect http and https traffic to unprivileged ports:

sudo pfctl -evf ~/xqiz.it/platform/port-forwarding.conf

4. Make sure you can ping the local platform address:


gradle@linuxkit-1a9fc18e4ccc:~/platform$ more README.md
# Platform as a Service #

This is the public repository for the prototype of the PAAS project.

## What is PAAS?

TODO

## Status:

This project is currently in the "proof of concept" mode.

## License

TODO

## Layout

The project is organized as a number of sub-projects, with the important ones to know about being:

* The *common* library ([platform/common](./common)), contains common interfaces shared across platform modules.

* The *kernel* library ([platform/kernel](./kernel)), contains the boot-strapping functionality. It's responsible for starting system services and introducing them to each other.

* The *host* library ([platform/host](./host)), contains the manager for hosted applications.

* The *platformDB* library ([platform/platformDB](./platformDB)), contains the platform database.

* The *platformUI* library ([platform/platformUI](./platformUI)), contains the end-points for the platform web-application.

## Installation

1. Please follow steps 1-3 of the [XDK Installation](https://github.com/xtclang/xvm#installation).
2. Clone [the platform repository](https://github.com/xtclang/platform) to your local machine.

## Steps to test the PAAS functionality:

Note that steps 2 and 3 are temporary, and step 3 needs to be re-executed every time after an OS reboot.

1. Create "xqiz.it" subdirectory under the user home directory for the platform persistent data. The subdirectory "platform" will be used to keep the platform operational information and subdirectory "users" for hosted applications.

2. Create a file "~/xqiz.it/port-forwarding.conf" with the following content:

rdr pass on lo0 inet proto tcp from any to self port 80 -> 127.0.0.1 port 8080
rdr pass on lo0 inet proto tcp from any to self port 443 -> 127.0.0.1 port 8090

3. Run the following command to redirect http and https traffic to unprivileged ports:

sudo pfctl -evf ~/xqiz.it/platform/port-forwarding.conf

4. Make sure you can ping the local platform address:

ping xtc-platform.localhost.xqiz.it

If that address fails to resolve you may need to change the rools on you DNS server. For example, for Verizon routers you would need add an exception entry for "127.0.0.1" to your DNS Server settiings: "Exceptions to DNS Rebind Protection" (Advanced - Network Settings - DNS Server)

If that address fails to resolve you may need to change the rools on you DNS server. For example, for Verizon routers you would need add an exception entry for "127.0.0.1" to your DNS Server settiings: "Exceptions to DNS Rebind Protection" (Advanced - Network Set
tings - DNS Server)

5. Create a self-signed certificate for the platform web server. For example:

keytool -genkeypair -alias platform -keyalg RSA -keysize 2048 -validity 365 -dname "OU=Platform, O=[your name], C=US" -keystore ~/xqiz.it/platform/keystore.p12 -storetype PKCS12 -storepass [password]

6. Add a symmetric key to encode the cookies:

keytool -genseckey -alias cookies -keyalg AES -keysize 256 -keystore ~/xqiz.it/platform/keystore.p12 -storetype PKCS12 -storepass [password]
7. Make sure you have the latest [gradle](https://gradle.org/), [node](https://nodejs.org/en), [yarn](https://yarnpkg.com/) and [xdk-latest](https://github.com/xtclang/xvm#readme) installed. If you are using `brew`, you can simply say:

7. Make sure you have the latest [gradle](https://gradle.org/), [node](https://nodejs.org/en), [yarn](https://yarnpkg.com/) and [xdk-latest](https://github.com/xtclang/xvm#readme) installed. If you are using `brew`, you can simply say:

brew install gradle node yarn

8. Make sure all necessary *node* modules are installed using the following command from the ([platform/platformUI/gui](./platformUI/gui)) directory:

npm install

9. If you plan to use `quasar` dev environment, please intall it globally by the following command:

npm install -g @quasar/cli

10. Build the platform services using the gradle command (from within the "platform" directory):

gradle build
Expand All @@ -82,12 +189,12 @@ Note that steps 2 and 3 are temporary, and step 3 needs to be re-executed every

xec -L lib/ lib/kernel.xtc [password]

12. Open the hosting site in a browser:
12. Open the hosting site in a browser:

https://xtc-platform.localhost.xqiz.it

13. Follow the instructions from the [Examples](https://github.com/xtclang/examples) repository to build and "upload" a web application.
14. Log into the "Ecstasy Cloud" platform using "[email protected]/password" credentials.
15. Go to the "Modules" panel and install any of the example module (e.g. "welcome.examples.org").
16. Go to the "Application" panel, register a deployment (e.g. "welcome") and "start" it
17. Click on the URL to launch your application web page.
16. Go to the "Application" panel, register a deployment (e.g. "welcome") and "start" it
17. Click on the URL to launch your application web page.
62 changes: 40 additions & 22 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,53 @@
* Main build file for the "platform" project.
*/

group = "platform.xqiz.it"
version = "0.1.0"

val libDir = "${projectDir}/lib"
plugins {
alias(libs.plugins.xtc)
}

tasks.register("clean") {
group = "Build"
description = "Delete previous build results"
delete(libDir)
dependencies {
xdkZip(libs.xdk)
xtcModule(project(":kernel"))
xtcModule(project(":common")) // runtime path
xtcModule(project(":platformDB")) // runtime path
xtcModule(project(":host")) // runtime path
xtcModule(project(":platformUI")) // runtime path
}

val build = tasks.register("build") {
group = "Build"
description = "Build all"
//x/ec -L lib/ kernel.xtc [password]")

dependsOn(project(":kernel") .tasks["build"])
dependsOn(project(":host") .tasks["build"])
dependsOn(project(":platformDB").tasks["build"])
dependsOn(project(":platformUI").tasks["build"])
/*
* xtcRun is a configuration for anything launching from the main source set.
* xtcRunTest
*/
xtcRun {
verbose = true
module {
moduleName = "kernel"
// TOOD: Check that grabbing properties through -P or -D or System.getenv works and maps to XTC properties.
// TODO: Implement arg() and args() syntactic sugar
args = listOf(readPassword())
}
}

tasks.register("run") {
group = "Run"
description = "Run the platform"
val runXtc by tasks.existing {
dependsOn(tasks.build)
}

dependsOn(build)
val run by tasks.registering {
group = "application"
description = "Build (if necessary) and run the platform (equivalent to 'xec [-L <module>]+ kernel.xtc <password>)"
dependsOn("runXtc")
doFirst {
logger.lifecycle("Starting the XTC platform (kernel).")
}
}

doLast {
println("Please run the platform directly using the following command:")
println(" xec -L lib/ kernel.xtc [password]")
internal fun readPassword(): String {
val password = findProperty("org.xtclang.platform.password")?.toString() ?: ""
if (password.isEmpty()) {
throw GradleException("Error. No password was given.")
}
logger.lifecycle("Resolved password: [REDACTED]")
return password
}
Loading

0 comments on commit 53b2029

Please sign in to comment.