Giter Club home page Giter Club logo

stelace's Introduction

Stelace platform runner

Open-source backend and API stack empowering dev teams to build, run and scale enduring platforms and marketplaces faster than ever.

Stelace.com | Documentation | Blog | Twitter


Stelace API Server

Includes:

For a full-stack experience, you can get started here with open-source Vue.js front-end templates.

CircleCI FOSSA Status JavaScript Style Guide Conventional Commits


Stelace as-a-service

The easiest way to deploy and leverage Stelace is with our official managed infrastructure. You can have a fresh platform backend up and running in minutes with high-availability deployment, automatic scaling, built-in test and live environments and admin dashboard. SLA, dedicated infrastructure and premium support are also available for Enterprise customers.


Contents

Built to last

With:

What is included

All APIs listed in docs and API Reference.

Admin Dashboard UI is tied with our Software-as-a-Service offer and is not open-source. It certainly won’t ever be unless community and staff collaborate to make this happen.

That’s it!

This means you can freely switch between any of our SaaS plans and self-hosting at any time if you don’t need Stelace support or SLA and you’re ready to build your own admin UI, or you don’t need one 👓.

Note: for your app UI, we also crafted open-source front-end templates.

marketplace-demo-screenshot

Setup

Docker

Please go to Docker website to install Docker CE/EE. Choose the right installation guide for your system.

Install yarn

Please refer to official instructions.

Clone

git clone https://github.com/stelace/stelace.git && cd stelace && git checkout origin/master

Development

We recommend using pre-configured Docker images for databases to ease development.

It’s how Stelace team develops and tests API server.

Please note that you should use proper databases in production though.

Let’s start with your own .env file to customize if needed:

cp .env.example .env

Start development databases

Build the Docker images:

docker-compose build

And start the databases:

yarn docker:db

Shorthand for: docker-compose up -d elasticsearch postgresql redis

Run server

  • Run yarn to install dependencies.

  • Run yarn prepare to install husky hooks

  • Run the database migration to automatically create or update tables:

yarn knex migrate:latest # or `npm run knex migrate:latest`
yarn plugins
  • You can also seed the database with auto-generated API keys:
yarn seed

Tip: use one of our Stelace Instant open-source templates for blazing fast full-stack development.

  • Start the server:
yarn start # or `npm start`

Develop with API server container

Stelace server is built on and deployed to Linux machines (Ubuntu), and you may have some trouble running server with another OS.

Docker can solve this with ease.

You just have to change host from 127.0.0.1 to elasticsearch, postgresql and redis in your .env file when using containerized API and databases.

Here is how you can install dependencies and init database:

# ephemeral container with --rm option
docker-compose run --rm api yarn
docker-compose run --rm api yarn seed

Note: project root directory is used as a Docker volume during development, including node_modules that are shared. You need to re-install dependencies when switching between plain server and server container setups.

Run:

docker-compose up -d

Useful commands to run from project root:

  • Follow logs of a API container

docker-compose logs -f api

  • Stop and remove containers

docker-compose down

  • Remove volumes (can be useful to solve dev issues with corrupted data or after database upgrade)

docker volume prune

Tip: Use yarn docker:db:reset to reset containers and volumes during development. This can be useful if you have any issue with corrupted database or redis store data, or if you want to upgrade databases (warning: containers data & volumes will be lost).

Tests

Tests are mostly integration tests with databases up and running to cover full API functionality.

Run npm run test or yarn test with ElasticSearch, PostgreSQL and Redis running and appropriate environment variables (hosts, ports, credentials).

You can use database Docker containers (see Using API server container) with appropriate host (127.0.0.1) and ports (e.g. PostgreSQL: 6543).

Tests files are run in parallel with AVA, using multiple schemas in PostgreSQL database.

Tests are quite CPU-intensive and you probably want to have 4 CPU cores to run them in good conditions.

Please find more details in server docs (testing).

Logs

Getting server logs in real-time can be very useful during development or tests.

You just have to set an environment variable:

ROARR_LOG=true yarn test

To see the output of console.log calls during AVA tests, add --verbose flag:

yarn test --verbose

Using API server container

Stelace team uses an API server Docker image in production, so do CI tests.

You can use an API server container to run tests locally too.

Ensure ElasticSearch, PostgreSQL and Redis are running once you’ve started database containers:

# Install dependencies used by API server container if not done yet
docker-compose run --rm api yarn
# Checking that databases are up and running
docker-compose run --rm api /bin/sh -c \
'until nc -z -v -w30 elasticsearch 9200 && nc -z -v -w30 postgresql 5432 && nc -z -v -w30 redis 6379
do
  echo "Waiting for PostgreSQL, ElasticSearch and Redis…"
  sleep 2
done';

Run tests with containerized API:

docker-compose run --rm api yarn test
# instead of standard local server with `yarn test`

Production

As mentioned above, we recommend using proper databases for production. You may self-host the databases or externalize them by using database providers.

Please find detailed procedures to configure SSL for database.

More details on API keys

Please find explanations on the different types of API keys.

Versioning

Stelace API public versions introducing breaking changes are publicly dated like 2019-05-20 but the repository itself follows semver rules. Dated version are the equivalent of major updates, as in semver major.minor.patch.

Old dated versions are supported thanks to transformers, inspired by great examples.

When introducing breaking changes (denoted by a new major version in this repository according to semver):

  • Dated version is added to src/versions/index.js
  • Appropriate transformers are added to request, response and validation subfolders
  • Changes are documented using a description field in request transformers
  • Conventional commit messages are used to keep track of breaking changes

Contributing

Stelace is open source and contributions from the community are most welcome, including yours!

Before contributing to Stelace:

  1. You’ll be prompted to read and sign our Contributor License Agreement, which ensures we can maintain appropriate governance of the project as a community in the long run.
  2. Dig into CONTRIBUTING.MD, about submitting issues, requesting new features, etc.
  3. Ensure we collaborate with mutual respect.

Dependencies

FOSSA Status

License

Stelace API server for Web platforms is licensed under the terms of the GNU General Public License Version 3.

Please contact us to discuss other licensing options or have look at our SaaS plans for hosted backend and premium support.

Stelace Copyright © 2018-present Sharinplace SAS.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

A copy of the GNU General Public License is included in this program, and is also available at https://www.gnu.org/licenses/gpl-3.0.txt.

We care about open-source

Made with ❤️ in Paris, France.

stelace's People

Contributors

abruere avatar dependabot-preview[bot] avatar dependabot[bot] avatar justinschuldt avatar woyuen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stelace's Issues

on install, is not pre-filling the database fields

The app is not functional after install, the interface is partly (almost not) functional:
screen shot 2018-03-25 at 10 33 34
sails starts without error, seems as the migration data is not populated in the database (e.g. listing types, etc..).

What would be the step to re-populate that migration data?

after transfer of database not able to filter by select custom attributes

I save the dump
pg_dump -p 6543 -h localhost -U user stelace-core > dump.pg

I am not able to use pg_restore but psql works so I first create the db from the server
createdb -h localhost -p 6543 -U user stelace-core

Then I run
psql -h localhost -p 6543 -U user -d stelace-core < dump.pg

I then follow the instructions in the file restore-from-dump.md

I configure the platform id

I update the platform data using the GET on the old server. I simply copy the result and send it as a PUT and I do this for both test and live

I didn't update the version because I don't know where to get it but I don't sense this is the issue

I then run elastic sync and redis sync on both test and live

At this point everything works (as far as I can tell) other than the filters based on "select" custom attributes. I see the custom attribute in the list and I see it in the asset itself but it acts like it's not there.

http to https

I still haven't solved the problem. I tried running another nodejs application and it worked on my nginx https, but stelace doesn't work for some reason. We contacted the technical support of our hoster, where we rent a server - they say that we need to contact the STELACE developers.

 Why is Stelace not working on my nginx?

Снимок экрана (332)

sorry for the persistence.

My NGINX

server {
            listen 80;
            listen 127.0.0.1;
            listen [::]:443 ssl ipv6only=on; # managed by Certbot
            listen 443 ssl; # managed by Certbot
            root /var/www/html;
            server_name timosh.com.ua www.timosh.com.ua;
            ssl_certificate /etc/letsencrypt/live/timosh.com.ua/fullchain.pem; # mana>
            ssl_certificate_key /etc/letsencrypt/live/timosh.com.ua/privkey.pem; # ma>
            include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
            ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
             location / {
                      # First attempt to serve request as file, then
                      # as directory, then fall back to displaying a 404.
                      try_files $uri $uri/ =404;
              }
              location /api {
              proxy_pass http://localhost:4100;
              proxy_http_version 1.1;
              proxy_set_header Upgrade $http_upgrade;
              proxy_set_header Connection 'upgrade';
              proxy_set_header Host $host;
              proxy_cache_bypass $http_upgrade;
              }
            }

My .env file:

Without change. As in the example.

My logs in nginx

2021/03/22 20:27:57 [error] 73771#73771: *1530 recv() failed (104: Connection re set by peer) while reading response header from upstream, client: 194.28.84.131, server: testapp, request: "GET / HTTP/1.1", upstream: "http://194.28.84.131:80/ ", host: "timosh.com.ua"
2021/03/22 20:28:19 [alert] 73771#73771: 768 worker_connections are not enough
2021/03/22 20:28:19 [error] 73771#73771: *2299 recv() failed (104: Connection re set by peer) while reading response header from upstream, client: 194.28.84.131, server: testapp, request: "GET / HTTP/1.1", upstream: "http://194.28.84.131:80/ ", host: "194.28.84.131"
2021/03/22 20:30:23 [alert] 73771#73771: 768 worker_connections are not enough
2021/03/22 20:30:23 [error] 73771#73771: *3071 recv() failed (104: Connection re set by peer) while reading response header from upstream, client: 194.28.84.131, server: testapp, request: "GET / HTTP/1.1", upstream: "http://194.28.84.131:80/ ", host: "vipsale.com.ua"
2021/03/22 20:33:18 [alert] 73771#73771: 768 worker_connections are not enough
2021/03/22 20:33:18 [error] 73771#73771: *3842 recv() failed (104: Connection re set by peer) while reading response header from upstream, client: 194.28.84.131, server: testapp, request: "GET / HTTP/1.1", upstream: "http://194.28.84.131:80/ ", host: "timosh.com.ua"
2021/03/22 20:33:19 [alert] 73771#73771: 768 worker_connections are not enough
2021/03/22 20:33:19 [error] 73771#73771: *4607 recv() failed (104: Connection re set by peer) while reading response header from upstream, client: 194.28.84.131, server: testapp, request: "GET /app HTTP/1.1", upstream: "http://194.28.84.131: 80/app", host: "timosh.com.ua"
2021/03/22 20:33:43 [alert] 73771#73771: 768 worker_connections are not enough
2021/03/22 20:33:43 [error] 73771#73771: *5373 recv() failed (104: Connection re set by peer) while reading response header from upstream, client: 194.28.84.131, server: testapp, request: "GET / HTTP/1.1", upstream: "http://194.28.84.131:80/ ", host: "194.28.84.131"
2021/03/22 20:34:43 [alert] 73771#73771: 768 worker_connections are not enough
2021/03/22 20:34:43 [error] 73771#73771: *6139 recv() failed (104: Connection re set by peer) while reading response header from upstream, client: 194.28.84.131, server: testapp, request: "GET / HTTP/1.1", upstream: "http://194.28.84.131:80/ ", host: "194.28.84.131"
2021/03/22 20:35:26 [error] 74348#74348: *3 directory index of "/var/www/html/" is forbidden, client: 88.155.44.155, server: timosh.com.ua, request: "GET / HTTP /1.1", host: "timosh.com.ua"
2021/03/22 20:35:43 [error] 74348#74348: *5 directory index of "/var/www/html/" is forbidden, client: 194.28.84.86, server: timosh.com.ua, request: "GET / HTTP/ 1.1", host: "194.28.84.131"
2021/03/22 20:37:43 [error] 74348#74348: *7 directory index of "/var/www/html/" is forbidden, client: 194.28.84.86, server: timosh.com.ua, request: "GET / HTTP/ 1.1", host: "194.28.84.131"
2021/03/22 20:39:43 [error] 74348#74348: *11 directory index of "/var/www/html/" is forbidden, client: 194.28.84.86, server: timosh.com.ua, request: "GET / HTTP /1.1", host: "194.28.84.131"
2021/03/22 20:40:50 [error] 74348#74348: *12 directory index of "/var/www/html/" is forbidden, client: 5.255.253.66, server: timosh.com.ua, request: "GET / HTTP /1.1", host: "timosh.com.ua"
2021/03/22 20:41:43 [error] 74348#74348: *16 directory index of "/var/www/html/" is forbidden, client: 194.28.84.86, server: timosh.com.ua, request: "GET / HTTP /1.1", host: "194.28.84.131"
2021/03/22 20:43:43 [error] 74348#74348: *21 directory index of "/var/www/html/" is forbidden, client: 194.28.84.86, server: timosh.com.ua, request: "GET / HTTP /1.1", host: "194.28.84.131"
2021/03/23 13:56:24 [error] 74348#74348: *1910 connect() failed (111: Connection refused) while connecting to upstream, client: 93.183.192.183, server: timosh.com.ua, request: "GET /api HTTP/1.1", upstream: "http://[::1]:4100/api", host: "timosh.com.ua"
2021/03/23 13:57:19 [error] 74348#74348: *1914 directory index of "/var/www/html/" is forbidden, client: 194.28.84.86, server: timosh.com.ua, request: "GET / HTTP/1.1", host: "194.28.84.131"

Warm Greetings

Hi Andy..
Could we join to make some project according to stelace?
please contact me at [email protected], couse I don't know how to contact you.
thanks..

Regards,
Afif

Error: connect ECONNREFUSED 127.0.0.1:6543 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)

Hello, I'm trying to install Stelace on CentOS Linux release 7.8.2003 (Core), I get an error
Error: connect ECONNREFUSED 127.0.0.1:6543 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
Tell me what could be wrong? Attached an .env file and a screenshot of the error. I hope you can help me.

OC - CentOS Linux release 7.8.2003 (Core),
Node.js - v12.16.3
File.env - env.zip

EDIT: I am running Stelace on the server http://194.28.84.131:4100 - what do I need to change in order to use it on my server?
Снимок экрана (268)

Path redis.conf

How can I specify the path to the redis.conf file in redis ??
I think it needs to be done in the docker-compose.override.yml file, right ??

Do I need to replace this line?
volumes: - redis-v5.0.1-data:/data
on this:
volumes: - ./redis.conf:/usr/local/etc/redis/redis.conf
or should you leave the old line and add a new line to it ??
volumes: - redis-v5.0.1-data:/data - ./redis.conf:/usr/local/etc/redis/redis.conf
????

ps Sorry for bad English((

Server hangs after being killed and only computer reboot helps

Hello everyone!
First of all I would like to tell that most likely I am doing something wrong, as I try to use the stelace for the first time in an ongoing project, but I kindly ask to point it out if you know.

I am using Mac OS m1. And what I experience now so far is: after 2 or more tries of shutting down by CRL+C or sending a signal to shut down node process after yarn start my computer starts to work slow, terminal freezes, vsCode freezes, and even browser stops loading pages. And after some minutes computer shuts down. Only reboot helps. And that happens not just on first time but on second-forth.
I tried to use debug mode and I saw that server scans for free ports. For first times it works, but then it looks like that server was not able to find ports or something like this BUT no more logs after that, command line hangs. And after that sending a kill signal to node does not kill it at all. Once after this I saw debug logs with countless amount of such logs:
{"context":{"application":"stelace-core","logLevel":50,"err":{"errno":-57,"code":"ENOTCONN","syscall":"recvmsg","name":"Error","message":"recvmsg ENOTCONN","stack":"Error: recvmsg ENOTCONN\n at UDP.onMessage [as onmessage] (dgram.js:931:31)"}},"message":"Uncaught exception","sequence":20475,"time":1643483059537,"version»:»1.0.0»}
But I saw it just once. Looks like the spam of this logs causes that heavy issue. Tried to research it, but without any result.

Signal not working

Hi,

I'm opening this issue after you kindly invited me to, when I brought up the Signal malfunction subject in stelace/marketplace-demo#207 .

Shortly after upgrading to 0.7.0, I noticed a whole lot of websocket related errors in my console. I tried to disable the cache as suggested, but it didn't work.
This is the error I'm encountering : failed: Error during WebSocket handshake: Unexpected response code: 400

Here is an extract of my network log :

Screenshot_2020-07-18 13 26 58_Csze1F

As you can see, the first request named socket.io does succeed...
For running my tests, I'm running Stelace on a DigitalOcean server, and I'm using Netlify (or local server) for the frontend. Both are not on the same domain. Could it be something related to my server config, despite everything else working ? In the same browser, https://marketplace.demo.stelace.com/ is working.

Thanks a lot for your help, and for all the amazing work you're doing on this project... As I'm getting familiar with Stelace, I hope to be able to submit my own humble contributions in the future !

Error 400 "body\" is required

I have a question. When adding a new product, I get an error (POST request), although the GET request works. What could it be ?? Maybe you need to connect ssl for POST to work?

Снимок экрана (272)
Снимок экрана (273)

ERROR:
{
"message": ""body" is required",
"statusCode": 400,
"data": [
{
"message": ""body" is required",
"path": [],
"type": "any.required",
"context": {
"label": "value"
}
}
],
"_stack": [
"BadRequestError: "body" is required",
" at errorTransformer (/usr/src/app/src/versions/validation/index.js:91:15)",
" at /usr/src/app/src/versions/validation/index.js:158:9",
" at nextTick (/usr/src/app/node_modules/restify/lib/chain.js:167:13)",
" at processTicksAndRejections (internal/process/task_queues.js:76:11)"
]
}

Platform 1 does not exist.

Hello, we have such an error.
Error:
{
"message": "Internal Server Error",
"statusCode": 500,
"_stack": [
"Error: Platform 1 does not exist.",
" at getPlatformEnvData (/root/timka/stelace/src/redis.js:191:24)",
" at runMicrotasks ()",
" at processTicksAndRejections (internal/process/task_queues.js:97:5)",
" at async getConnection (/root/timka/stelace/src/models/index.js:126:28)",
" at async getModels (/root/timka/stelace/src/models/index.js:185:34)",
" at async /root/timka/stelace/src/services/apiKey.js:466:24",
" at async newHandler (/root/timka/stelace/src/cote/CustomResponder.js:33:24)"
],
"_message": "Platform 1 does not exist."
}
Снимок экрана (277)

Not work "- yarn seed"

Hi, guys.

I have a problem. I am trying to execute - yarn seed - but it stays in place and does not add keys. Tell me what can I do to make it work ??
redis - works.
Maybe there is an opportunity to view the logs - yarn seed?

It just hangs what is on the screen and does not load further
Снимок экрана (333)

p.s Guys, sorry for the stupid questions. But I am a beginner and want to use Stelace as it is interesting.

brothers help me @abruere @woyuen @justinschuldt

contato

Hello I'm trying to contact the site for a few days and I have some questions:

The output option what is the value?

Can we use a trial license to test the saas option?

I would like to know if it would be possible to carry out exchanges between products, could the system support this purpose?

I would like to know more about plugin creation, I need to make a payment gateway from my country....

please wait for the contact ..

Private & protected namespace are not visible to users with role 'dev'

The default role dev has readNamespaces and editNamespaces set to all (*) but the API does not return fields in _private and _protected namespaces.

I tried requesting a random user with firstname, lastname and a phone filed in metadata._protected but the API returns empty values.

Is that how it is supposed to work?

Date filter does not work with exact match but only with range

Apparently, date like filters (eg. createdDate, updatedDate) should support exact match createdDate=2021-10-26 but in reality it works only with range createdDate[gte]=2021-10-26&createdDate[lte]=2021-10-26.

I'm using v1.0.0-beta.8. I have not tested the dev branch yet. Can you guys confirm this is an issue?

Issues with cache

I think these are related so I am going to send them together. I really didn't find any information related to cache in the docs.

1.) When adding a new category, patch will not work the first time. It will return 404 not found. Simply running the same request again will work but clearly there is some cache issue. This could be happening with other api sections as well.

2.) After a db reset
yarn docker:db:reset

I will get the previous list of categories list every other time. Also apparently some cache issue. I have tried using postman and powershell and both produce the same result.

I would be interested in helping too but I have only got the system working in linux and my pc windows.

User organization and permissions

This is more a question rather than an issue. Is it possible with steleace to have users assigned to organizations and give them the permissions to create/read/update/delete only items within the organization?

On server we lose our platform ID.

Our server is with digitalocean. The platformId just disappears randomly. I believe it happens with a lot of activity but I am not sure. It only happens with digital ocean. We are in the process of trying another provider. On a simple virtualbox vm with debian or ubuntu it has no problem but we have issues in the cloud.

Dashboard not accessible over proxy

Hi, Thank you for the great work!

I have issue that took me already long time - and still cannot find the right setting.

im trying to access https://xxx.xxxxxx.com/dashboard

I have nodejs behind nginx. The nginx proxy config is working as i deploy other apps on the same server - i forward as: proxy_pass 8010

in the local.js i tried all the combinations till now:

the settings file
secret: '678910', // must replace it with random characters (different fromtoken.authSecret`)
url: 'https://xxx.xxxxx.com',

    // CONFIG
    defaultFeatures: {
        GAMIFICATION: false,
        TAGS: false,
        EVENTS: true,
        SOCIAL_LOGIN: false,
        INCOME_REPORT: false,
        LISTING_CATEGORIES: true,
        SMS: false,
        MAP: true,
    },
    defaultConfig: {
        SERVICE_NAME: 'MyStelace',
    },

    // Stelace SaaS or custom dashboard base url
    dashboardUrl: 'http://localhost:8010', 
    stelaceId: '', // used for Stelace SaaS

    superAdmin: false,
},



// SERVER
port: process.env.PORT || 8010,
environment: process.env.NODE_ENV || 'development', // replace 'development' with 'production' for production environment
http: { trustProxy: true }, // replace with `trustProxy: true` if the project runs behind a proxy
hookTimeout: 600000, // 10 minutes
// basicAuth: '', // ('username:password' in Base64)

`

thank you

Is this project still alive?

Hi

We are building our marketplace with Stelace. Really like it.

I've tried multiple times to contact Sales team through the website but had no response.

Is this project still alive? If not, would you mind to opensource the Admin Dashboard? Or at least sell it.

Please, contact me! Email : [email protected] or +77771191415 (WhatsApp, Telegram)

Platform 1 does not exist.

Hello, we have such an error.
Error:

{
"message": "Internal Server Error",
"statusCode": 500,
"_stack": [
"Error: Platform 1 does not exist.",
" at getPlatformEnvData (/root/timka/stelace/src/redis.js:191:24)",
" at runMicrotasks ()",
" at processTicksAndRejections (internal/process/task_queues.js:97:5)",
" at async getConnection (/root/timka/stelace/src/models/index.js:126:28)",
" at async getModels (/root/timka/stelace/src/models/index.js:185:34)",
" at async /root/timka/stelace/src/services/apiKey.js:466:24",
" at async newHandler (/root/timka/stelace/src/cote/CustomResponder.js:33:24)"
],
"_message": "Platform 1 does not exist."
}
Снимок экрана (277)

Platform 1 error

Hi Guys,

I am getting the below error whenever marketplace-demo web is trying to access the api server which I have hosted in a machine. Here is the example from one of the APIs url 78.56.34.89:4100/config.

{"context":{"application":"stelace-core","logLevel":50,"err":{"name":"Error","message":"Platform 1 does not exist.","stack":"Error: Platform 1 does not exist.\n    at getPlatformEnvData (/usr/src/app/src/redis.js:191:24)\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (internal/process/task_queues.js:94:5)\n    at async getConnection (/usr/src/app/src/models/index.js:96:28)\n    at async getModels (/usr/src/app/src/models/index.js:142:34)\n    at async /usr/src/app/src/services/apiKey.js:453:24\n    at async newHandler (/usr/src/app/src/cote/CustomResponder.js:33:24)","statusCode":500,"params":[]},"custom":{"metrics":{"statusCode":500,"method":"GET","path":"/config"},"requestContext":{"method":"GET","routeName":"config.read","ip":"::ffff:117.203.29.51","requestId":"bee0ed20-752a-4640-b1a5-e0f8501407a4","selectedVersion":"2019-05-20","platformVersion":"2019-05-20","latestVersion":"2019-05-20","platformId":"1","env":"test"}}},"message":"Error","sequence":57,"time":1625301089282,"version":"1.0.0"}

Can somebody help me on this. Thank you.

Filter transactions by status

Would be nice to have a filter to list transactions with/without a specific status (or even an array of status). Is this already possible or is this a feature request?

search for items with quantity of 0

The search option only allows for searches of assets with a quantity of 0 or more. I am well aware of the fact that officially it returns only assets with a quantity of 1 or more but there are cases where a search is desired on assets with a quantity of 0. For example, a user wants to know all the assets with a quantity of 0 but he wants to filter his query by a custom attribute.

Since stelace is exhibiting expected behavior, this is a feature request.

Error 500 redis

Hello, I have this error. It does not arise immediately, but 2 hours after the creation of the stelace project.

{
"code": "MISCONF",
"statusCode": 500,
"message": "Internal Server Error",
"_stack": [
"ReplyError: MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.",
" at new Command (/root/timka/stelace/node_modules/redis/lib/command.js:12:22)",
" at RedisClient.set (/root/timka/stelace/node_modules/redis/lib/commands.js:46:47)",
"From previous event:",
" at setPlatformEnvData (/root/timka/stelace/src/redis.js:232:18)",
" at /root/timka/stelace/server/index.js:605:15",
" at nextTick (/root/timka/stelace/node_modules/restify/lib/chain.js:167:13)",
" at processTicksAndRejections (internal/process/task_queues.js:79:11)"
],
"_message": "MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error."
}

feat(order): safer & automatic transition of transactions

Currently, transactions need to be manually updated when completing (paying) an order.

Order completion and transitions applied to its transactions should belong to the same database transaction, as mentioned before:


What if the /order-moves request fails after transitions have been applied to transactions and we have an inconsistent state as a result?
I asked about a more integrated sequence on slack but maybe we didn’t spare enough time to think about this.

I don’t promote API complexity, but here we could help Order API user to feel safer and have less work to do to add transitions to every single transaction. Extra parameters might be worth it.

What about some utility parameter (like transactionTransitionName, set to a valid transition name) in Order moves API that could automatically add transition to all transactions given transactions transactionIdsInTransition, in a Postgres transaction.

It’s a feature so it’s not required to include such a change in this PR if you don’t have time. This could also make an issue and a PR on its own.

Originally posted by @abruere in #297

how not to use the docker compose

Hi,

I tried not to use your docker compose and connect me directly to containers that have the official images (because later I plan to use postgres on AWS) but I have this error when I do a yarn seed (the yarn knex migrate:latest works)

The error :

jamesadams@jamesadams-ubuntu:~/Documents/Dev/test/back$ yarn knex migrate:latest
yarn run v1.22.17
$ knex migrate:latest
Already up to date
Done in 0.52s.
jamesadams@jamesadams-ubuntu:~/Documents/Dev/test/back$ yarn seed
yarn run v1.22.17
$ INSTANT_DATA=true npm test scripts/instantData.js

> [email protected] pretest /home/jamesadams/Documents/Dev/test/back
> NODE_ENV=test node test/pretest.js

email plugin enabled
rating plugin enabled
saved-search plugin enabled
stelace-search-filter-dsl-parser plugin enabled

> [email protected] test /home/jamesadams/Documents/Dev/test/back
> NODE_ENV=test ava --c $(node -p 'Math.max(os.cpus().length - 2, 1)') "scripts/instantData.js"


email plugin enabled
rating plugin enabled
saved-search plugin enabled
stelace-search-filter-dsl-parser plugin enabled
migration file "20200713111032_init.js" failed
migration failed with error: 
    SELECT public.create_hypertable(
      's1_test."event"', 'createdTimestamp'
      
    )
   - function public.create_hypertable(unknown, unknown) does not exist
  beforeEach hook for initializing data

  Rejected promise returned by test. Reason:

  Error {
    response: Response {
      _events: {},
      _eventsCount: 0,
      _maxListeners: undefined,
      accepted: false,
      badRequest: false,
      body: {
        _message: `␊
            SELECT public.create_hypertable(␊
              's1_test."event"', 'createdTimestamp'␊
              ␊
            )␊
           - function public.create_hypertable(unknown, unknown) does not exist`,
        _stack: Array [ … ],
        code: '42883',
        message: 'Internal Server Error',
        statusCode: 500,
      },
      buffered: true,
      clientError: false,
      created: false,
      error: Error {
        method: 'POST',
        path: '/store/platforms/1/database/migrate',
        status: 500,
        text: '{"code":"42883","message":"Internal Server Error","statusCode":500,"_stack":["error: ","    SELECT public.create_hypertable(","      \'s1_test.\\"event\\"\', \'createdTimestamp\'","      ","    )","   - function public.create_hypertable(unknown, unknown) does not exist","    at Parser.parseErrorMessage (/home/jamesadams/Documents/Dev/test/back/node_modules/pg-protocol/src/parser.ts:369:69)","    at Parser.handlePacket (/home/jamesadams/Documents/Dev/test/back/node_modules/pg-protocol/src/parser.ts:188:21)","    at Parser.parse (/home/jamesadams/Documents/Dev/test/back/node_modules/pg-protocol/src/parser.ts:103:30)","    at Socket.<anonymous> (/home/jamesadams/Documents/Dev/test/back/node_modules/pg-protocol/src/index.ts:7:48)","    at Socket.emit (events.js:223:5)","    at Socket.EventEmitter.emit (domain.js:475:20)","    at addChunk (_stream_readable.js:309:12)","    at readableAddChunk (_stream_readable.js:290:11)","    at Socket.Readable.push (_stream_readable.js:224:10)","    at TCP.onStreamRead (internal/stream_base_commons.js:181:23)"],"_message":"\\n    SELECT public.create_hypertable(\\n      \'s1_test.\\"event\\"\', \'createdTimestamp\'\\n      \\n    )\\n   - function public.create_hypertable(unknown, unknown) does not exist"}',
        message: 'cannot POST /store/platforms/1/database/migrate (500)',
      },
      files: undefined,
      forbidden: false,
      header: {
        'access-control-allow-credentials': 'true',
        connection: 'close',
        'content-encoding': 'gzip',
        'content-type': 'application/json',
        date: 'Thu, 09 Dec 2021 19:42:19 GMT',
        server: 'stelace-server',
        'transfer-encoding': 'chunked',
        vary: 'origin,access-control-request-method,access-control-request-headers',
      },
      headers: {
        'access-control-allow-credentials': 'true',
        connection: 'close',
        'content-encoding': 'gzip',
        'content-type': 'application/json',
        date: 'Thu, 09 Dec 2021 19:42:19 GMT',
        server: 'stelace-server',
        'transfer-encoding': 'chunked',
        vary: 'origin,access-control-request-method,access-control-request-headers',
      },
      info: false,
      links: {},
      noContent: false,
      notAcceptable: false,
      notFound: false,
      ok: false,
      pipe: Function {},
      redirect: false,
      redirects: [],
      req: ClientRequest {
        _contentLength: 0,
        _ended: true,
        _events: Object { … },
        _eventsCount: 3,
        _hasBody: true,
        _header: `POST /store/platforms/1/database/migrate HTTP/1.1␍␊
        Host: 127.0.0.1:43589␍␊
        Accept-Encoding: gzip, deflate␍␊
        x-stelace-system-key: system␍␊
        x-stelace-env: test␍␊
        Connection: close␍␊
        Content-Length: 0␍␊
        ␍␊
        `,
        _headerSent: true,
        _last: true,
        _maxListeners: undefined,
        _onPendingData: Function noopPendingOutput {},
        _removedConnection: false,
        _removedContLen: false,
        _removedTE: false,
        _trailer: '',
        aborted: false,
        agent: Agent { … },
        chunkedEncoding: false,
        connection: Socket { … },
        finished: true,
        maxHeadersCount: null,
        method: 'POST',
        outputData: [],
        outputSize: 0,
        parser: null,
        path: '/store/platforms/1/database/migrate',
        res: IncomingMessage { … },
        sendDate: false,
        shouldKeepAlive: false,
        socket: Socket { … },
        socketPath: undefined,
        timeoutCb: null,
        upgradeOrConnect: false,
        useChunkedEncodingByDefault: true,
        writable: true,
        [Symbol(kNeedDrain)]: false,
        [Symbol(isCorked)]: false,
        [Symbol(kOutHeaders)]: Object { … },
      },
      request: Request {
        _agent: false,
        _callback: Function {},
        _enableHttp2: false,
        _endCalled: true,
        _events: Object { … },
        _eventsCount: 1,
        _formData: null,
        _fullfilledPromise: Promise {},
        _header: Object { … },
        _maxListeners: undefined,
        _maxRedirects: 5,
        _query: [],
        _redirectList: [],
        _redirects: 0,
        _resBuffered: true,
        _streamRequest: false,
        called: true,
        cookies: '',
        header: Object { … },
        host: '127.0.0.1:43589',
        method: 'POST',
        protocol: 'http:',
        qs: {},
        qsRaw: [],
        req: ClientRequest { … },
        res: IncomingMessage { … },
        response: [Circular],
        url: 'http://127.0.0.1:43589/store/platforms/1/database/migrate',
        writable: true,
      },
      res: IncomingMessage {
        _consuming: false,
        _dumped: false,
        _events: Object { … },
        _eventsCount: 3,
        _maxListeners: undefined,
        _readableState: ReadableState [ … ],
        aborted: false,
        client: Socket { … },
        complete: true,
        connection: Socket { … },
        headers: Object { … },
        httpVersion: '1.1',
        httpVersionMajor: 1,
        httpVersionMinor: 1,
        method: null,
        on: Function {},
        rawHeaders: Array [ … ],
        rawTrailers: [],
        readable: false,
        req: ClientRequest { … },
        setEncoding: Function {},
        socket: Socket { … },
        statusCode: 500,
        statusMessage: 'Internal Server Error',
        text: '{"code":"42883","message":"Internal Server Error","statusCode":500,"_stack":["error: ","    SELECT public.create_hypertable(","      \'s1_test.\\"event\\"\', \'createdTimestamp\'","      ","    )","   - function public.create_hypertable(unknown, unknown) does not exist","    at Parser.parseErrorMessage (/home/jamesadams/Documents/Dev/test/back/node_modules/pg-protocol/src/parser.ts:369:69)","    at Parser.handlePacket (/home/jamesadams/Documents/Dev/test/back/node_modules/pg-protocol/src/parser.ts:188:21)","    at Parser.parse (/home/jamesadams/Documents/Dev/test/back/node_modules/pg-protocol/src/parser.ts:103:30)","    at Socket.<anonymous> (/home/jamesadams/Documents/Dev/test/back/node_modules/pg-protocol/src/index.ts:7:48)","    at Socket.emit (events.js:223:5)","    at Socket.EventEmitter.emit (domain.js:475:20)","    at addChunk (_stream_readable.js:309:12)","    at readableAddChunk (_stream_readable.js:290:11)","    at Socket.Readable.push (_stream_readable.js:224:10)","    at TCP.onStreamRead (internal/stream_base_commons.js:181:23)"],"_message":"\\n    SELECT public.create_hypertable(\\n      \'s1_test.\\"event\\"\', \'createdTimestamp\'\\n      \\n    )\\n   - function public.create_hypertable(unknown, unknown) does not exist"}',
        trailers: {},
        upgrade: false,
        url: '',
      },
      serverError: true,
      setEncoding: Function bound  {},
      status: 500,
      statusCode: 500,
      statusType: 5,
      text: '{"code":"42883","message":"Internal Server Error","statusCode":500,"_stack":["error: ","    SELECT public.create_hypertable(","      \'s1_test.\\"event\\"\', \'createdTimestamp\'","      ","    )","   - function public.create_hypertable(unknown, unknown) does not exist","    at Parser.parseErrorMessage (/home/jamesadams/Documents/Dev/test/back/node_modules/pg-protocol/src/parser.ts:369:69)","    at Parser.handlePacket (/home/jamesadams/Documents/Dev/test/back/node_modules/pg-protocol/src/parser.ts:188:21)","    at Parser.parse (/home/jamesadams/Documents/Dev/test/back/node_modules/pg-protocol/src/parser.ts:103:30)","    at Socket.<anonymous> (/home/jamesadams/Documents/Dev/test/back/node_modules/pg-protocol/src/index.ts:7:48)","    at Socket.emit (events.js:223:5)","    at Socket.EventEmitter.emit (domain.js:475:20)","    at addChunk (_stream_readable.js:309:12)","    at readableAddChunk (_stream_readable.js:290:11)","    at Socket.Readable.push (_stream_readable.js:224:10)","    at TCP.onStreamRead (internal/stream_base_commons.js:181:23)"],"_message":"\\n    SELECT public.create_hypertable(\\n      \'s1_test.\\"event\\"\', \'createdTimestamp\'\\n      \\n    )\\n   - function public.create_hypertable(unknown, unknown) does not exist"}',
      type: 'application/json',
      unauthorized: false,
      unprocessableEntity: false,
    },
    status: 500,
    message: 'Internal Server Error',
  }

  › Request.callback (node_modules/superagent/src/node/index.js:879:15)
  › fn (node_modules/superagent/src/node/index.js:1130:18)
  › IncomingMessage.<anonymous> (node_modules/superagent/src/node/parsers/json.js:19:7)
  › Unzip.<anonymous> (node_modules/superagent/src/node/unzip.js:54:12)

  ─

  1 hook failed
npm ERR! Test failed.  See above for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

```

Category AND subcategory

Prompt, when we filter Assets by main category, subcategories are NOT filtered. I have 2 products in the first main category in the second subcategory. Whom I filter by the main category, I must also filter the subcategory. And it is not filtered - then what is the point of subcategory?

What is the Document resource for?

This is more a question rather than an issue. Looking at the resources exposed by the API I noticed the Document resource but I couldn't find any documentation about it.

What are documents? Is it used to store dynamic content tied specifically to a user? What is the target?

missing stelace config

Want to first say this is awesome love what you guys are building! Hope it goes well.

I spun it up to check it out on my machine and ran into an issue. Following your directions to get everything up and running, Browsersync works fine on port 3001 but Port 3000 just tries to load for a while and then eventually dies and I get this in the command line:

info: Starting app...

debug: --------------------------------------------------------
debug: :: Sat Oct 28 2017 19:37:40 GMT-0400 (EDT)
debug: Environment : development
debug: Port        : 1337
debug: --------------------------------------------------------
Unhandled rejection Error: No Stelace config available
    at _fetchConfig (/opt/stelace/api/services/StelaceConfigService.js:88:15)
    at <anonymous>

Unhandled rejection Error: No Stelace config available
    at _fetchConfig (/opt/stelace/api/services/StelaceConfigService.js:88:15)
    at <anonymous>

Not sure why that is possibly somewhere, sails.config.stelace isn't being called somewhere.

Plugin installation fails on MacOs

I've got issues running the command yarn plugins. It looks like the problem is with this line as the sed command for MacOs terminal is slightly different.

A simple solution could be the one proposed here using the variable process.platform to detect the OS running the application

Stelace instance stops whenever I create a user

Hi,

I am running a local dockerized instance of Stelace on my computer. Everything is properly running (incl. DB, redis and elasticsearch) and I can for example create assets. However, whenever I try to create a user with a username and password, the Stelace instance stops and I don't get any information in the log about the potential root cause.

Here is how I am performing the call through Stelace SDK :
await stelace.users.create({ username: '[email protected]', password: 'secretPassword' })

When looking at the Postgres container, i get this error:
unexpected eof on client connection with an open transaction
=> It seems that the stelace instance stops in the middle of the transaction.

I encountered this issue both on the dev and master branch. Any idea on how to solve this ?

Thanks a ton for your support

Google Key Setting

Hello Team,

Where can I put the google map key? I am always getting This page can't load Google Maps correctly.

I already updated:

app.config.js

var googleMapConfig = {
            key: "TOKEN HERE",
            v: "3.30",
            libraries: "places,weather,geometry,visualization",
            // sensor: false, // not required anymore since 3.22
            language: 'en'
        };

        var googleMapApiKey = platformProvider.getGoogleMapApiKey();
        if (googleMapApiKey) {
            googleMapConfig.key = "TOKEN HERE";
        }

Stripe

Does this have stripe already intergrated?

Installing ElasticSearch plugins fails

on v1.0.0-beta.8, installing elasticsearch plugin returns an error:
ERROR: Service 'elasticsearch' failed to build: The command '/bin/sh -c bin/elasticsearch-plugin install analysis-icu' returned a non-zero code: 1

error on password reset

I get the following error when running a password reset on the dev branch. Our db was created on the master branch however we are sending the header x-stelace-version: 2019-02-20

"DBError: insert into "s1_live"."event" ("apiVersion", "changesRequested", "createdDate", "createdTimestamp", "emitter", "emitterId", "id", "metadata", "object", "objectId", "objectType", "parentId", "relatedObjectsIds", "type") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning "id" - column "createdTimestamp" of relation "event" does not exist",
" at Object.wrapError (/var/www/services/stelace/node_modules/db-errors/lib/dbErrors.js:19:14)",
" at SchemaQueryBuilder. (/var/www/services/stelace/node_modules/objection-db-errors/index.js:9:40)",
" at OnErrorOperation.onError (/var/www/services/stelace/node_modules/objection/lib/queryBuilder/operations/OnErrorOperation.js:17:22)",
" at /var/www/services/stelace/node_modules/objection/lib/queryBuilder/QueryBuilderOperationSupport.js:358:37",
" at Object.promiseTry [as try] (/var/www/services/stelace/node_modules/objection/lib/utils/promiseUtils/try.js:8:26)",
" at SchemaQueryBuilder.callAsyncOperationMethod (/var/www/services/stelace/node_modules/objection/lib/queryBuilder/QueryBuilderOperationSupport.js:358:11)",
" at /var/www/services/stelace/node_modules/objection/lib/queryBuilder/QueryBuilder.js:1299:17",
"From previous event:",
" at processImmediate (internal/timers.js:464:21)",
"From previous event:",
" at SchemaQueryBuilder.execute (/var/www/services/stelace/node_modules/objection/lib/queryBuilder/QueryBuilder.js:581:13)",
" at SchemaQueryBuilder.then (/var/www/services/stelace/node_modules/objection/lib/queryBuilder/QueryBuilder.js:496:26)"

HTTPS

I will try to ask the correct question (I have not been able to resolve this issue for about 2 weeks).
I transferred stelace to a VPS server where nginx and https are installed and the domain name is timosh.com.ua.
Can you tell me what to change in the .env file to make stelace work on my server?

P.s: I used to have Stelace on a server without https and nginx and Stelace worked.


Do I need to register this data ??

SSL certificate (common extensions: .crt, .cert, .cer)

POSTGRES_SSL_CERT =

Private key (common extension: .key)

POSTGRES_SSL_KEY =

Certificate authority (common extensions: .pem, .der)

POSTGRES_SSL_CA =

And do I need to change
ELASTIC_SEARCH_PROTOCOL = http
on
ELASTIC_SEARCH_PROTOCOL = https

???????????
Help please, I have no one else to ask

Transferring an application to a domain

Well thank you. But if I was allowed to develop on an ip address on vps. Then I bought the domain timosh.com.ua - and now I want to transfer the stelace applications to the domain. But the application already has data that cannot be deleted. How can I correctly transfer Stelace applications to the timosh.com.ua domain and what changes need to be made in the application?

bug(Transaction): moment using local time instead of UTC

Problem: moment using local (server) time

We use both moment and ms libraries to manipulate dates with computeDate util function.

Using moment.js duration objects without specificying moment.utc() means we use local time instead of UTC we have to stick to according to ISO 8601 date format 2019-10-14T12:31:32.049Z we are using everywhere.

We should default to UTC for consistency and let any API consumer decide how transactions spanning over any Daylight Saving Time switch should be handled.

Example

When using duration object like { d: 1 }, some platform could expect the transactions to really last 24 hours, while others would expect startDate and endDate to have the same hour, meaning the transaction should last 23 or 25 hours, but this depends on local time and there is no timezone abstraction in Transaction API.

Note: This issue mainly impacts Transaction API as it is not supposed to be aware of timezones unlike Task API and Availability API (recurringTimezone). PR bringing breaking changes also needs to fix some inconsistencies in Availability, not defaulting to UTC, and Task API to a lesser extent (#33).

bug: inconsistent `recurringTimezone`

Availability API (and to some extent Task API) defaults to Europe/London recurringTimezone instead of UTC we have to use everywhere:

if (!recurringTimezone) {
recurringTimezone = 'Europe/London'
createAttrs.recurringTimezone = recurringTimezone
}

This will cause unexpected issues with recurring availabilities, especially if API user is in another timezone.

Using timezones in Availability API makes sense for end-user but most platforms obviously won’t rely on British timezone, so we should have a default value consistent with our API, namely UTC, and let API user decide.

This will be a breaking change.

As a part of the breaking change, it’s probably appropriate to UTC as a default here too, for consistency:

function computeRecurringDates (pattern, { startDate, endDate, timezone = 'Europe/London' } = {}) {


EDIT: this impacts Task API too since by default no timezone is null in task service, with no fallback, so that cron-converter we’re using to trigger task defaults to local time:

https://github.com/roccivic/cron-converter/blob/ebfae6a2f5cf3fd621af1ad1e34dfbe4ee6f7df9/src/seeker.js#L17-L21

if (cron.options.timezone) {
  date = moment.tz(now, cron.options.timezone);
} else {
  date = moment(now);
}

This confirms we need a consistent default timezone set to UTC.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.