Giter Club home page Giter Club logo

openship's Introduction

Openship is an operations platform that enables multi-channel fulfillment

Website · Documentation · Openship Cloud

Running locally

To get Openship running on your local machine:

Clone the repo

git clone https://github.com/openshiporg/openship

Rename example.env to .env

//.env
FRONTEND_URL=http://localhost:3000
DATABASE_URL=postgresql://postgres:example@url:3000/postgres
SESSION_SECRET=please_change_me

Be sure to replace DATABASE_URL with a postgres connection string.

You can run postgres locally or get a database online.

Railway offers a free, temporary postgres database.

Start the application

Run the following commands start up Openship:

$ cd openship
$ yarn install
$ yarn dev

Once the application is running, go to localhost:3000. If there are no users in the database, you'll be redirected to localhost:3000/init where you can create the admin user.

Use the playground to build and run queries/mutations against the API.

Openship uses Keystone.js. Openship mounts the Keystone Admin UI to /dashboard. It's a great way to see and interact with your database.

Deployment

Openship uses Next.js, so naturally, it can be hosted anywhere that supports Node.js. Openship also requires a postgres database.

1-Click Deployment

These deployment services offer Node.js and postgres databases so Openship can be deployed in 1-click.

Railway

Deploy on Railway

Render

Deploy to Render

Next.js Deployment

To deploy on platforms that don't support databases like Netlify and Vercel, you'll need to pass a postgres connection string as the DATABASE_URL variable.

Vercel

Deploy with Vercel

Netlify

Deploy to Netlify

Go to site settings > build & deploy > environment and add these variables:

  FRONTEND_URL=http://localhost:3000
  DATABASE_URL=postgresql://postgres:example@url:3000/postgres
  SESSION_SECRET=OH_PLEASE_PLEASE_CHANGE_ME

Replace DATABASE_URL with a postgres database connection string and FRONTEND_URL with the url ending in netlify.app. Redeploy the site.

Docker

Create a copy of example.env named .env and cusotmize the session secret, as well as the postgres user/password/dbname as you wish:

cp example.env .env

The project datase init is coupled with the build system, so we have to start the postgres service before building:

mkdir ./volumes/postgres/data
docker-compose up -d postgres

Now build and start the OpenShip container itself:

docker-compose up -d

The web app should be available at curl localhost:3100. If it is not, please check docker-compose logs.

Finally, expose the localhost:3100 to the desired public host.

Credits

Openship wouldn't be here without these great projects

openship's People

Contributors

dmikushin avatar junaid33 avatar sven3270350 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

openship's Issues

Build fails on Netlify

Hi there,

I've tested the "One Click deploy to Netlify" button from the readme and here is the result from the Netlify build logs:

6:51:11 PM: $ yarn build
6:51:11 PM: yarn run v1.22.10
6:51:11 PM: $ keystone prisma migrate deploy && next build
6:51:15 PM: Prisma schema loaded from schema.prisma
6:51:15 PM: Error: Get config: Schema Parsing P1012
6:51:15 PM: 
6:51:15 PM: error: Environment variable not found: DATABASE_URL.
6:51:15 PM:   -->  schema.prisma:5
6:51:15 PM:    |
6:51:15 PM:  4 | datasource postgresql {
6:51:15 PM:  5 |   url               = env("DATABASE_URL")
6:51:15 PM:    |
6:51:15 PM: Validation Error Count: 1
6:51:15 PM: error Command failed with exit code 1. (https://ntl.fyi/exit-code-1)

Here is the full report; OTH:

6:50:11 PM: Build ready to start
6:50:12 PM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)
6:50:12 PM: build-image tag: v4.10.1
6:50:12 PM: buildbot version: 67e75f1ba713a8213d4b5a8ccf9708af751e2390
6:50:12 PM: Fetching cached dependencies
6:50:13 PM: Failed to fetch cache, continuing with build
6:50:13 PM: Starting to prepare the repo for build
6:50:13 PM: No cached dependencies found. Cloning fresh repo
6:50:13 PM: git clone https://github.com/openshiporg/openship
6:50:13 PM: Preparing Git Reference refs/heads/main
6:50:13 PM: Parsing package.json dependencies
6:50:14 PM: Starting build script
6:50:14 PM: Installing dependencies
6:50:14 PM: Python version set to 2.7
6:50:15 PM: Downloading and installing node v16.17.0...
6:50:15 PM: Downloading https://nodejs.org/dist/v16.17.0/node-v16.17.0-linux-x64.tar.xz...
6:50:15 PM: Computing checksum with sha256sum
6:50:15 PM: Checksums matched!
6:50:17 PM: Now using node v16.17.0 (npm v8.15.0)
6:50:17 PM: Started restoring cached build plugins
6:50:17 PM: Finished restoring cached build plugins
6:50:17 PM: Attempting ruby version 2.7.2, read from environment
6:50:18 PM: Using ruby version 2.7.2
6:50:18 PM: Using PHP version 8.0
6:50:18 PM: Started restoring cached yarn cache
6:50:18 PM: Finished restoring cached yarn cache
6:50:19 PM: No yarn workspaces detected
6:50:19 PM: Started restoring cached node modules
6:50:19 PM: Finished restoring cached node modules
6:50:19 PM: Installing NPM modules using Yarn version 1.22.10
6:50:19 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
6:50:19 PM: npm WARN config location in the cache, and they are managed by
6:50:19 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
6:50:19 PM: yarn install v1.22.10
6:50:19 PM: [1/5] Validating package.json...
6:50:19 PM: [2/5] Resolving packages...
6:50:19 PM: [3/5] Fetching packages...
6:50:37 PM: info @next/[email protected]: The platform "linux" is incompatible with this module.
6:50:37 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
6:50:37 PM: info @next/[email protected]: The platform "linux" is incompatible with this module.
6:50:37 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
6:50:37 PM: info @next/[email protected]: The platform "linux" is incompatible with this module.
6:50:37 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
6:50:37 PM: info @next/[email protected]: The platform "linux" is incompatible with this module.
6:50:37 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info @next/[email protected]: The platform "linux" is incompatible with this module.
6:50:37 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
6:50:37 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
6:50:37 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
6:50:37 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info @next/[email protected]: The platform "linux" is incompatible with this module.
6:50:37 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
6:50:37 PM: info @next/[email protected]: The platform "linux" is incompatible with this module.
6:50:37 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
6:50:37 PM: info @next/[email protected]: The platform "linux" is incompatible with this module.
6:50:37 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info [email protected]: The platform "linux" is incompatible with this module.
6:50:37 PM: info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: [4/5] Linking dependencies...
6:50:37 PM: warning "@keystone-6/auth > @keystone-ui/core > @emotion/react > @emotion/[email protected]" has unmet peer dependency "@babel/core@^7.0.0".
6:50:37 PM: warning "@keystone-6/auth > @keystone-ui/fields > react-day-picker > @reach/[email protected]" has incorrect peer dependency "react@^16.8.0 || 17.x".
6:50:37 PM: warning "@keystone-6/auth > @keystone-ui/fields > react-day-picker > @reach/[email protected]" has incorrect peer dependency "react-dom@^16.8.0 || 17.x".
6:50:37 PM: warning "@keystone-6/auth > @keystone-ui/core > @emotion/react > @emotion/babel-plugin > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
6:50:37 PM: warning "@keystone-6/auth > @keystone-ui/fields > react-day-picker > @reach/auto-id > @reach/[email protected]" has incorrect peer dependency "react@^16.8.0 || 17.x".
6:50:37 PM: warning "@keystone-6/auth > @keystone-ui/fields > react-day-picker > @reach/auto-id > @reach/[email protected]" has incorrect peer dependency "react-dom@^16.8.0 || 17.x".
6:50:37 PM: warning "@keystone-6/core > @aws-sdk/[email protected]" has unmet peer dependency "@aws-sdk/abort-controller@^3.0.0".
6:50:37 PM: warning "@keystone-6/core > @prisma/[email protected]" has unmet peer dependency "@prisma/generator-helper@*".
6:50:37 PM: warning "@mantine/core > @radix-ui/[email protected]" has incorrect peer dependency "react@^16.8 || ^17.0".
6:50:37 PM: warning "@mantine/core > @radix-ui/react-scroll-area > @radix-ui/[email protected]" has incorrect peer dependency "react@^16.8 || ^17.0".
6:50:37 PM: warning "@mantine/core > @radix-ui/react-scroll-area > @radix-ui/[email protected]" has incorrect peer dependency "react@^16.8 || ^17.0".
6:50:37 PM: warning "@mantine/core > @radix-ui/react-scroll-area > @radix-ui/[email protected]" has incorrect peer dependency "react@^16.8 || ^17.0".
6:50:37 PM: warning "@mantine/core > @radix-ui/react-scroll-area > @radix-ui/[email protected]" has incorrect peer dependency "react@^16.8 || ^17.0".
6:50:37 PM: warning "@mantine/core > @radix-ui/react-scroll-area > @radix-ui/[email protected]" has incorrect peer dependency "react@^16.8 || ^17.0".
6:50:37 PM: warning "@mantine/core > @radix-ui/react-scroll-area > @radix-ui/[email protected]" has incorrect peer dependency "react@^16.8 || ^17.0".
6:50:37 PM: warning "@mantine/core > @radix-ui/react-scroll-area > @radix-ui/react-primitive > @radix-ui/[email protected]" has incorrect peer dependency "react@^16.8 || ^17.0".
6:50:37 PM: warning "@mantine/next > @mantine/ssr > [email protected]" has incorrect peer dependency "[email protected] || 15 || 16 || 17".
6:50:37 PM: warning " > [email protected]" has unmet peer dependency "graphql@14 - 16".
6:50:37 PM: warning "next-pwa > [email protected]" has unmet peer dependency "@babel/core@^7.0.0".
6:50:37 PM: warning "next-pwa > [email protected]" has unmet peer dependency "webpack@>=2".
6:50:37 PM: warning "next-pwa > [email protected]" has unmet peer dependency "webpack@>=4.0.0 <6.0.0".
6:50:37 PM: warning "next-pwa > [email protected]" has unmet peer dependency "webpack@^5.1.0".
6:50:37 PM: warning "next-pwa > [email protected]" has unmet peer dependency "webpack@^4.4.0 || ^5.9.0".
6:50:49 PM: [5/5] Building fresh packages...
6:50:53 PM: $ keystone postinstall
6:50:56 PM: ✨ GraphQL and Prisma schemas are up to date
6:50:57 PM: Done in 38.39s.
6:50:57 PM: NPM modules installed using Yarn
6:50:58 PM: Started restoring cached go cache
6:50:58 PM: Finished restoring cached go cache
6:50:58 PM: Installing Go version 1.17 (requested 1.17)
6:51:02 PM: unset GOOS;
6:51:02 PM: unset GOARCH;
6:51:02 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
6:51:02 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
6:51:02 PM: go version >&2;
6:51:02 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
6:51:02 PM: go version go1.17 linux/amd64
6:51:02 PM: Installing missing commands
6:51:02 PM: Verify run directory
6:51:03 PM: ​
6:51:03 PM: ────────────────────────────────────────────────────────────────
6:51:03 PM:   Netlify Build                                                 
6:51:03 PM: ────────────────────────────────────────────────────────────────
6:51:03 PM: ​
6:51:03 PM: ❯ Version
6:51:03 PM:   @netlify/build 27.16.1
6:51:03 PM: ​
6:51:03 PM: ❯ Flags
6:51:03 PM:   baseRelDir: true
6:51:03 PM:   buildId: 63123443b8121f02bbd07e5a
6:51:03 PM:   deployId: 63123443b8121f02bbd07e5c
6:51:03 PM: ​
6:51:03 PM: ❯ Current directory
6:51:03 PM:   /opt/build/repo
6:51:03 PM: ​
6:51:03 PM: ❯ Config file
6:51:03 PM:   No config file was defined: using default values.
6:51:03 PM: ​
6:51:03 PM: ❯ Context
6:51:03 PM:   production
6:51:03 PM: ​
6:51:03 PM: ❯ Installing plugins
6:51:03 PM:    - @netlify/[email protected]
6:51:10 PM: ​
6:51:10 PM: ❯ Loading plugins
6:51:10 PM:    - @netlify/[email protected] from Netlify app
6:51:10 PM: ​
6:51:10 PM: ────────────────────────────────────────────────────────────────
6:51:10 PM:   1. @netlify/plugin-nextjs (onPreBuild event)                  
6:51:10 PM: ────────────────────────────────────────────────────────────────
6:51:10 PM: ​
6:51:11 PM: No Next.js cache to restore.
6:51:11 PM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
6:51:11 PM: ​
6:51:11 PM: (@netlify/plugin-nextjs onPreBuild completed in 14ms)
6:51:11 PM: ​
6:51:11 PM: ────────────────────────────────────────────────────────────────
6:51:11 PM:   2. Build command from Netlify app                             
6:51:11 PM: ────────────────────────────────────────────────────────────────
6:51:11 PM: ​
6:51:11 PM: $ yarn build
6:51:11 PM: yarn run v1.22.10
6:51:11 PM: $ keystone prisma migrate deploy && next build
6:51:15 PM: Prisma schema loaded from schema.prisma
6:51:15 PM: Error: Get config: Schema Parsing P1012
6:51:15 PM: 
6:51:15 PM: error: Environment variable not found: DATABASE_URL.
6:51:15 PM:   -->  schema.prisma:5
6:51:15 PM:    |
6:51:15 PM:  4 | datasource postgresql {
6:51:15 PM:  5 |   url               = env("DATABASE_URL")
6:51:15 PM:    |
6:51:15 PM: Validation Error Count: 1
6:51:15 PM: error Command failed with exit code 1. (https://ntl.fyi/exit-code-1)
6:51:15 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
6:51:15 PM: ​
6:51:15 PM: ────────────────────────────────────────────────────────────────
6:51:15 PM:   "build.command" failed                                        
6:51:15 PM: ────────────────────────────────────────────────────────────────
6:51:15 PM: ​
6:51:15 PM:   Error message
6:51:15 PM:   Command failed with exit code 1: yarn build (https://ntl.fyi/exit-code-1)
6:51:15 PM: ​
6:51:15 PM:   Error location
6:51:15 PM:   In Build command from Netlify app:
6:51:15 PM:   yarn build
6:51:15 PM: ​
6:51:15 PM:   Resolved config
6:51:15 PM:   build:
6:51:15 PM:     command: yarn build
6:51:15 PM:     commandOrigin: ui
6:51:15 PM:     environment:
6:51:15 PM:       - NEXT_PRIVATE_TARGET
6:51:15 PM:     publish: /opt/build/repo/.next
6:51:15 PM:     publishOrigin: ui
6:51:15 PM:   plugins:
6:51:15 PM:     - inputs: {}
6:51:15 PM:       origin: ui
6:51:15 PM:       package: '@netlify/plugin-nextjs'
6:51:16 PM: Caching artifacts
6:51:16 PM: Started saving node modules
6:51:16 PM: Finished saving node modules
6:51:16 PM: Started saving build plugins
6:51:16 PM: Finished saving build plugins
6:51:16 PM: Started saving yarn cache
6:51:20 PM: Finished saving yarn cache
6:51:20 PM: Started saving pip cache
6:51:20 PM: Finished saving pip cache
6:51:20 PM: Started saving emacs cask dependencies
6:51:20 PM: Finished saving emacs cask dependencies
6:51:20 PM: Started saving maven dependencies
6:51:20 PM: Finished saving maven dependencies
6:51:20 PM: Started saving boot dependencies
6:51:20 PM: Finished saving boot dependencies
6:51:20 PM: Started saving rust rustup cache
6:51:20 PM: Finished saving rust rustup cache
6:51:20 PM: Started saving go dependencies
6:51:20 PM: Finished saving go dependencies
6:51:21 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:51:21 PM: Creating deploy upload records
6:51:21 PM: Failing build: Failed to build site
6:51:21 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
6:51:21 PM: Finished processing build request in 1m8.5871423s

How to

How to generate SESSION_SECRET?

Issue with Netlify Deployment

Good afternoon, when attempting to deploy to Netlify, i'm getting the following error message:

2:38:50 PM: build-image version: 8fa244c78cd67d8b6f2fa49817cac5c730095600 (focal)
2:38:50 PM: buildbot version: ffe65ff6df272d8339700be586c63030d957782b
2:38:50 PM: Fetching cached dependencies
2:38:50 PM: Failed to fetch cache, continuing with build
2:38:50 PM: Starting to prepare the repo for build
2:38:51 PM: No cached dependencies found. Cloning fresh repo
2:38:51 PM: git clone --filter=blob:none https://github.com/**respositoryname**/openship
2:38:51 PM: Preparing Git Reference refs/heads/main
2:38:52 PM: Failing build: Failed to parse configuration
2:38:52 PM: Finished processing build request in 1.927s
2:38:52 PM: Failed during stage "Reading and parsing configuration files":
When resolving config file /opt/build/repo/netlify.toml:
Could not parse configuration file
Expected """, """"", "+", "-", "[", """, """"", "_", "false", "true", "{", [ \t] or [0-9] but "$" found.

: exit status 1

Repositoryname has an actual name its just omitted from this code.

Password validation doesn't support special characters

Init password validation regex doesn't support special characters.

Realisistically it should, but if not the error message should be updated from:

Password should contain 1 number, 1 letter and at least 8 characters

to

Password should contain 1 number, 1 letter, at least 8 characters, and no special characters

Suggestion: Utilising Docker

This project could benefit from utilising Docker.

At least for local development a docker-compose.yml would make setting up postgress simple:

version: '3.8'
services:
    database:
        image: 'postgres:14.1-alpine'
        environment:
            - POSTGRES_USER=postgres
            - POSTGRES_PASSWORD=postgres
            - POSTGRES_DB=openship
        expose:
            - '5435'
        ports:
            - '5435:5432'
        volumes:
            - './.cache/db/data:/var/lib/postgresql/data'
            - './.cachec/db/init:/docker-entrypoint-initdb.d'
            

Running / Deploying keystone via docker is also pretty simple, but there are a heap of ways you can do it so I won't drop all the code here.

Thoughts?

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.