Skip to content

Commit

Permalink
Merge pull request #173 from konturio/resolve-kontur-mr-conflicts
Browse files Browse the repository at this point in the history
Deliver all the kontur changes to original repos
  • Loading branch information
dqunbp authored Sep 11, 2023
2 parents 3956151 + 31f6181 commit fd39c5f
Show file tree
Hide file tree
Showing 15 changed files with 396 additions and 162 deletions.
36 changes: 36 additions & 0 deletions .env.local.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# OAuth login for users
# ---------------------

FACEBOOK_APP_ID=fillme
FACEBOOK_APP_SECRET=fillme

GOOGLE_CLIENT_ID=fillme
GOOGLE_CLIENT_SECRET=fillme

GDRIVE_KEY=fillme

# OAM-specific
# ------------

# The bucket into which images uploaded by users are placed
OIN_BUCKET=fillme
# Convenience for not having to create new buckets. Eg; Travis CI tests require this.
# Remove if not needed, do not leave empty.
# OIN_BUCKET_PREFIX=development
# A bucket just for somewhere to place imagery uploaded from the browser, before it
# gets fully processed.
UPLOAD_BUCKET=fillme
# Used to identify imagery after it has been uploaded.
S3_PUBLIC_DOMAIN=s3.eu-central-1.amazonaws.com

# AWS credentials
AWS_ACCESS_KEY_ID=fillme
AWS_SECRET_ACCESS_KEY=fillme
AWS_REGION=eu-central-1 # the same region as S3_PUBLIC_DOMAIN

# For sending emails
SENDGRID_API_KEY=fillme
SENDGRID_FROM=fillme

# required to run locally
NEW_RELIC_LICENSE_KEY=a1b2c3
37 changes: 37 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: deploy

on:
push:
branches:
- develop

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup ssh
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Create SSH key
run: |
mkdir -p ~/.ssh/
echo "$SSH_PRIVATE_KEY" > ../private.key
chmod 600 ../private.key
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
shell: bash
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}

- name: Deploy to server
run: |
ssh -p 33322 -o "StrictHostKeyChecking no" [email protected] << 'ENDSSH'
cd ~/oam-api && git pull
docker-compose up -d --build
ENDSSH
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ npm-debug.log
*#
.DS_STORE
.netbeans
.env
.env*
!.env.sample
!.env.local.sample
.idea
.node_history
temp
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/mojodna/marblecutter-tools
FROM public.ecr.aws/r4e3a2l5/marblecutter-tools:latest

ARG NODE_ENV=production

Expand All @@ -11,7 +11,7 @@ RUN apt-get update \
git \
software-properties-common \
&& curl -sf https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
&& add-apt-repository -s "deb https://deb.nodesource.com/node_10.x $(lsb_release -c -s) main" \
&& add-apt-repository -s "deb https://deb.nodesource.com/node_14.x $(lsb_release -c -s) main" \
&& apt-get update \
&& apt-get install --no-install-recommends -y nodejs \
&& apt-get clean \
Expand Down
35 changes: 12 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ And the background OIN indexer can be run with: `node catalog-worker.js`

## Development Using Docker

Before running `oam-api` you need to run `oam-mosaic`

```bash
git clone https://github.com/hotosm/oam-mosaic-map
cd oam-mosaic-map
docker-compose up
```

To start a self-contained development instance using Docker Compose, run:

```bash
Expand All @@ -47,32 +55,13 @@ Once it has started, connect to `http://localhost:4000` to access the API.

The MongoDB command line interface can be run within its container like so: `docker-compose exec mongo mongo`

The following environment variables should be set (probably in `.env`; see `sample.env` for defaults and additional information):
Use `http://localhost:8081` to inspect the `mongo` database content with `mongo-express`.

```bash
# AWS credentials for writing to S3
AWS_ACCESS_KEY_ID=<redacted>
AWS_SECRET_ACCESS_KEY=<redacted>
AWS_REGION=us-east-1

# Social login
FACEBOOK_APP_ID=<redacted>
FACEBOOK_APP_SECRET=<redacted>
GOOGLE_CLIENT_ID=<redacted>
GOOGLE_CLIENT_SECRET=<redacted>

# S3 resources
OIN_BUCKET=<redacted>
OIN_BUCKET_PREFIX=<optional>
UPLOAD_BUCKET=<redacted>

# JWT Secret Key
JWT_SECRET_KEY=<redacted>
```
The following environment variables should be set (probably in `.env.local`; see `.env.local.sample` for defaults and additional information)

If Docker does not bind / forward ports to `localhost`, set `HOST_TLD` to the Docker hostname and use that to access the API.
If `OIN_REGISTER_URL` env variable is not set, the `OIN_BUCKET` will be used for indexing by default.
You can also set `OIN_REGISTER_URL=http://register:8080/fixtures/oin-buckets.json` to the `worker` service on `docker-compose.yml` and then modify `test/fixtures/oin-buckets.json` to specify a bucket for indexing.

To specify a bucket for indexing, modify `test/fixtures/oin-buckets.json`.

Instructions for generating the JWT signing key can be found [here](https://github.com/dwyl/hapi-auth-jwt2#generating-your-secret-key).
If you find that additional environment variables are needed, please submit a pull request!
Expand Down
Loading

0 comments on commit fd39c5f

Please sign in to comment.