Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat: merge ui and server repos (closes #203) (#214)
  • Loading branch information
gempain committed Mar 24, 2021
1 parent f7bda23 commit 5dc005e
Show file tree
Hide file tree
Showing 774 changed files with 59,112 additions and 17,587 deletions.
11 changes: 6 additions & 5 deletions .dockerignore
@@ -1,6 +1,7 @@
*
!node_modules
!migrate-mongo-config.js
!migrations
!build
!docker/files
!server/node_modules
!server/migrate-mongo-config.js
!server/migrations
!server/build
!ui/build
!docker
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
@@ -1,8 +1,8 @@
<!--
<!--
Thanks for opening a PR on this repo 🎉 ! This is just a quick reminder of things we'd like you to check before submitting:
- [ ] target your PR to branch `next`
- [ ] if necessary, updates the [docs](https://github.com/getmeli/meli-docs)
- [ ] if necessary, update the [docs](https://github.com/getmeli/meli-docs)
- [ ] use [semantic commits](https://www.conventionalcommits.org/en/v1.0.0)
- [ ] read our [contributing guidelines](https://github.com/getmeli/meli/blob/beta/CONTRIBUTING.md)
Expand Down
19 changes: 6 additions & 13 deletions .github/workflows/main.yml
Expand Up @@ -4,8 +4,6 @@ env:
GITHUB_REPOSITORY_SSH_URL: "git@github.com:${{ github.repository }}.git"
TMP_DOCKER_IMAGE: "getmeli/api/${{ github.ref }}"
DOCKER_IMAGE: "getmeli/api"
TMP_DOCKER_IMAGE_UNIFIED: "getmeli/meli/${{ github.ref }}"
DOCKER_IMAGE_UNIFIED: "getmeli/meli"
IS_RELEASE_BRANCH: "${{ github.ref == 'refs/heads/latest' || github.ref == 'refs/heads/next' || github.ref == 'refs/heads/beta' }}"
GIT_AUTHOR_NAME: "meli-release-bot"
GIT_COMMITTER_NAME: "meli-release-bot"
Expand All @@ -30,6 +28,7 @@ jobs:
npx semantic-release -r $GITHUB_REPOSITORY_SSH_URL -d
echo "Next release version is $(cat VERSION)"
echo "Next release channel is $(cat RELEASE_CHANNEL)"
npm version --no-git-tag-version $(cat VERSION) --allow-same-version
env:
RELEASE_DEPLOY_KEY: ${{ secrets.RELEASE_DEPLOY_KEY }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
Expand All @@ -38,18 +37,13 @@ jobs:
- name: "test"
run: npm run test
- name: "build"
run: |
if [ -f VERSION ]; then
npm version --no-git-tag-version $(cat VERSION) --allow-same-version
fi
npm run build
run: npm run build
- name: "docker build"
run: |
docker build --pull -t $TMP_DOCKER_IMAGE -f ./docker/Dockerfile .
- name: "docker build unified"
if: ${{ env.IS_RELEASE_BRANCH == 'true' }}
run: |
docker build --pull -t $TMP_DOCKER_IMAGE_UNIFIED -f ./docker/unified.Dockerfile --build-arg "UI_VERSION=$(cat HEAD_BRANCH)" .
rm -rf server/node_modules
npm ci --production --prefix server
docker build --pull -t $TMP_DOCKER_IMAGE -f ./Dockerfile .
npm ci
- name: "release"
if: ${{ github.ref == 'refs/heads/latest' || github.ref == 'refs/heads/beta' }}
run: |
Expand All @@ -64,7 +58,6 @@ jobs:
docker login -u $DOCKER_USER -p $DOCKER_TOKEN
IS_NEXT=${{ github.ref == 'refs/heads/next' }}
npx docker-semver-tags --sourceImage $TMP_DOCKER_IMAGE --targetImage $DOCKER_IMAGE --versionTag $(cat VERSION) --channelOnly $IS_NEXT
npx docker-semver-tags --sourceImage $TMP_DOCKER_IMAGE_UNIFIED --targetImage $DOCKER_IMAGE_UNIFIED --versionTag $(cat VERSION) --channelOnly $IS_NEXT
env:
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
DOCKER_USER: ${{ secrets.DOCKER_USER }}
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Expand Up @@ -4,12 +4,12 @@
!.idea/runConfigurations

# deps
/node_modules
node_modules
/.pnp
.pnp.js

# testing
/coverage
coverage

# production
/build
Expand Down
40 changes: 40 additions & 0 deletions Dockerfile
@@ -0,0 +1,40 @@
FROM alpine:3.13

LABEL maintainer="meli.sh"

RUN apk add --no-cache \
caddy \
nodejs

# entrypoint
COPY ./docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# caddy
COPY ./docker/caddy-config.json /etc/caddy/config.json
# ui
COPY ./ui/build /app/ui
# server
COPY ./server/build /app/server
COPY ./server/node_modules /app/server/node_modules
COPY ./server/migrate-mongo-config.js /app/server
COPY ./server/migrations /app/server/migrations

WORKDIR /app/server

ENV MELI_URL_INTERNAL=http://localhost:3001
ENV MELI_UI_DIR=/app/ui

# Caddy defaults, copied from official Dockerfile
# https://github.com/caddyserver/caddy-docker/blob/2093c4a571bfe356447008d229195eb7063232b2/2.3/alpine/Dockerfile
ENV XDG_CONFIG_HOME /caddy/config
ENV XDG_DATA_HOME /caddy/data
VOLUME /caddy/config
VOLUME /caddy/data

EXPOSE 80
EXPOSE 443
EXPOSE 2019


ENTRYPOINT ["/entrypoint.sh"]
CMD ["node", "index.js"]
52 changes: 26 additions & 26 deletions README.md
Expand Up @@ -35,8 +35,10 @@ Want to change the way you ship front-end, forever ? Let's get started !
- [Automatic HTTPs certificate issuing with letsencrypt (or private ACME server)](https://docs.meli.sh/configuration/ssl)
- [Deploy branches](https://docs.meli.sh/get-started/branches)
- [API with per-endpoint scopes](https://docs.meli.sh/api/get-started)
- Integrations ([Webhooks](https://docs.meli.sh/integrations/webhooks), [Slack](https://docs.meli.sh/integrations/slack), [Mattermost](https://docs.meli.sh/integrations/mattermost), [Email](https://docs.meli.sh/integrations/email))
- Easily [deploy](https://docs.meli.sh/get-started/installation#installation) and [upgrade](https://docs.meli.sh/get-started/upgrade-and-downgrade) with Docker Compose
- Integrations ([Webhooks](https://docs.meli.sh/integrations/webhooks), [Slack](https://docs.meli.sh/integrations/slack)
, [Mattermost](https://docs.meli.sh/integrations/mattermost), [Email](https://docs.meli.sh/integrations/email))
- Easily [deploy](https://docs.meli.sh/get-started/installation#installation)
and [upgrade](https://docs.meli.sh/get-started/upgrade-and-downgrade) with Docker Compose
- [Password protected pages](https://docs.meli.sh/branches/password-protected-pages)
- [Path overrides with in-memory files or reverse proxies](https://docs.meli.sh/branches/redirects#redirects)
- [Single page application mode](https://docs.meli.sh/get-started/single-page-applications-spa)
Expand All @@ -54,23 +56,14 @@ Want to change the way you ship front-end, forever ? Let's get started !

## Development

### Start UI

1. Clone the [UI repo](https://github.com/getmeli/meli-ui).
1. `npm i && npm start`
1. The app is accessible from http://localhost:3001, but we develop from http://localhost:8080 (see below)

### Start Caddy and the API

1. Run `docker-compose -f ./docker-compose-dev.yml up -d`
1. Configure your `.env` (copy `.env.example` to start with)
1. Configure `server/.env` (copy `server/.env.example` to start with)
1. Run `npm i && npm start`

If you develop with the UI, you'll need to clone the [UI repo](https://github.com/getmeli/meli-ui), then start it.

You can now browse at `http://localhost:8080`:

- `http://localhost:8080/` => UI
- `http://localhost:8080/api`, `http://localhost:8080/auth` and `http://localhost:8080/socket.io` => API
- `http://localhost:8080/api`, `http://localhost:8080/auth`, `http://localhost:8080/system` and `http://localhost:8080/socket.io` => API
- `http://loopback.sh` => your sites will be served here

### DNS config
Expand All @@ -87,8 +80,7 @@ MELI_SITES_URL=loopback.sh

Your sites will be served at `*.loopback.sh`.

Pros: simple, no config required
Cons: you need to be connected to the internet
Pros: simple, no config required Cons: you need to be connected to the internet

#### Using /etc/hosts

Expand All @@ -99,8 +91,7 @@ Unfortunately, /etc/hosts doesn't support wildcard domains, so you'll need to ed
127.0.0.1 my-channel.my-site.test
```

Pros: simple, can develop without internet
Cons: have to reconfigure every time you add a site
Pros: simple, can develop without internet Cons: have to reconfigure every time you add a site

#### Using dnsmasq

Expand All @@ -124,19 +115,28 @@ ping hello.test

Your sites will be served at `*.test`.

Pros: you don't need to be connected to the internet, no need to reconfigure /etc/hosts
Cons: a bit complex, config required
Pros: you don't need to be connected to the internet, no need to reconfigure /etc/hosts Cons: a bit complex, config required

## License

The words "Open Source" in our README refer to the definition given by many well-recognized dictionaries of various languages, which is "used to describe software for which the original source code is made available to anyone".
The words "Open Source" in our README refer to the definition given by many well-recognized dictionaries of various languages, which is "
used to describe software for which the original source code is made available to anyone".

The words "Open Source" in our license, introduced and written by MariaDB, refer to the definition given by the Open Source Foundation. Though we adopted this license to make it easier for users to recognize it, we disagree with this sentence being part of it and are working on this matter.
The words "Open Source" in our license, introduced and written by MariaDB, refer to the definition given by the Open Source Foundation.
Though we adopted this license to make it easier for users to recognize it, we disagree with this sentence being part of it and are working
on this matter.

The BSL license allows you to modify, share, redistribute and use this software for free with the only condition that you do not run a competing SAAS service based on this project, which would both be unfair and jeopardize the options of making this tool sustainable.
The BSL license allows you to modify, share, redistribute and use this software for free with the only condition that you do not run a
competing SAAS service based on this project, which would both be unfair and jeopardize the options of making this tool sustainable.

We chose the BSL license because we believe it is fair for both users and maintainers. It allows us to secure a monetization path while providing proper support in the long run. Also, our license converts automatically within 4 years of each release to a license officially recognized by the Open Source Foundation, which secures a way for the community to see the sole restriction removed.
We chose the BSL license because we believe it is fair for both users and maintainers. It allows us to secure a monetization path while
providing proper support in the long run. Also, our license converts automatically within 4 years of each release to a license officially
recognized by the Open Source Foundation, which secures a way for the community to see the sole restriction removed.

We are aware of the debate around the BSL conflicting with rule number 9 of the definition given by the Open Source Foundation. We do believe that, in specific cases, this rule should be relaxed as it prevents platform maintainers to secure a path to sustaining the development of their tool and support of their community while preventing large players from running unfair competition by leveraging their infrastructure and name. There is sufficient material on this matter available on the internet for users to make up their mind.
We are aware of the debate around the BSL conflicting with rule number 9 of the definition given by the Open Source Foundation. We do
believe that, in specific cases, this rule should be relaxed as it prevents platform maintainers to secure a path to sustaining the
development of their tool and support of their community while preventing large players from running unfair competition by leveraging their
infrastructure and name. There is sufficient material on this matter available on the internet for users to make up their mind.

As a side note, rule number 9 conflicts similarly with the BSL than with the GPL3.0, which does restrict the creation of other software in its own way, while still being officially recognized by the Open Source Foundation.
As a side note, rule number 9 conflicts similarly with the BSL than with the GPL3.0, which does restrict the creation of other software in
its own way, while still being officially recognized by the Open Source Foundation.
16 changes: 0 additions & 16 deletions docker/Dockerfile

This file was deleted.

File renamed without changes.
File renamed without changes.
35 changes: 0 additions & 35 deletions docker/unified.Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion docs/generate-env-docs.ts
Expand Up @@ -7,7 +7,7 @@
* still generate the env reference docs.
*/

import { envSpec } from '../src/env/env-spec';
import { envSpec } from '../server/src/env/env-spec';

interface Entry {
name: string;
Expand Down

0 comments on commit 5dc005e

Please sign in to comment.