From 8700e53db4af3f8b1cd7665b79ec1fc67b597d9f Mon Sep 17 00:00:00 2001 From: Christopher Yihan Jiang <48700578+Chrisyhjiang@users.noreply.github.com> Date: Wed, 5 Jun 2024 09:03:05 -0700 Subject: [PATCH 1/4] Simple meteorJS sample --- samples/golang-mongodb-atlas/compose.yaml | 22 +- samples/meteor/.dockerignore | 3 + samples/meteor/.gitignore | 1 + samples/meteor/.meteor/.finished-upgraders | 19 + samples/meteor/.meteor/.gitignore | 1 + samples/meteor/.meteor/.id | 7 + samples/meteor/.meteor/packages | 22 + samples/meteor/.meteor/platforms | 2 + samples/meteor/.meteor/release | 1 + samples/meteor/.meteor/versions | 71 ++ samples/meteor/.plandex/project.json | 1 + samples/meteor/Dockerfile | 38 + samples/meteor/README.md | 39 + samples/meteor/client/main.html | 9 + samples/meteor/client/main.js | 13 + samples/meteor/compose.dev.yaml | 28 + samples/meteor/compose.yaml | 16 + samples/meteor/package-lock.json | 814 +++++++++++++++++++++ 18 files changed, 1095 insertions(+), 12 deletions(-) create mode 100644 samples/meteor/.dockerignore create mode 100644 samples/meteor/.gitignore create mode 100644 samples/meteor/.meteor/.finished-upgraders create mode 100644 samples/meteor/.meteor/.gitignore create mode 100644 samples/meteor/.meteor/.id create mode 100644 samples/meteor/.meteor/packages create mode 100644 samples/meteor/.meteor/platforms create mode 100644 samples/meteor/.meteor/release create mode 100644 samples/meteor/.meteor/versions create mode 100755 samples/meteor/.plandex/project.json create mode 100644 samples/meteor/Dockerfile create mode 100644 samples/meteor/README.md create mode 100644 samples/meteor/client/main.html create mode 100644 samples/meteor/client/main.js create mode 100644 samples/meteor/compose.dev.yaml create mode 100644 samples/meteor/compose.yaml create mode 100644 samples/meteor/package-lock.json diff --git a/samples/golang-mongodb-atlas/compose.yaml b/samples/golang-mongodb-atlas/compose.yaml index 358b784b..109687e7 100644 --- a/samples/golang-mongodb-atlas/compose.yaml +++ b/samples/golang-mongodb-atlas/compose.yaml @@ -1,14 +1,12 @@ -version: '3.9' +version: '3.8' + services: - app: - restart: unless-stopped - build: - context: . - dockerfile: Dockerfile - ports: - - mode: ingress - target: 8080 - published: 8080 + meteor: + build: . + container_name: meteor environment: - - MONGO_URI=your mongo db URI connection string - \ No newline at end of file + - MONGO_URL=mongodb+srv://Chris:Defang12345@atlascluster.oo6gmyw.mongodb.net/?retryWrites=true&w=majority&appName=AtlasCluster + - ROOT_URL=http://your-production-domain.com + - PORT=3000 + ports: + - "3000:3000" diff --git a/samples/meteor/.dockerignore b/samples/meteor/.dockerignore new file mode 100644 index 00000000..c0536a95 --- /dev/null +++ b/samples/meteor/.dockerignore @@ -0,0 +1,3 @@ +.git +.meteor/local +node_modules \ No newline at end of file diff --git a/samples/meteor/.gitignore b/samples/meteor/.gitignore new file mode 100644 index 00000000..c2658d7d --- /dev/null +++ b/samples/meteor/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/samples/meteor/.meteor/.finished-upgraders b/samples/meteor/.meteor/.finished-upgraders new file mode 100644 index 00000000..c07b6ff7 --- /dev/null +++ b/samples/meteor/.meteor/.finished-upgraders @@ -0,0 +1,19 @@ +# This file contains information which helps Meteor properly upgrade your +# app when you run 'meteor update'. You should check it into version control +# with your project. + +notices-for-0.9.0 +notices-for-0.9.1 +0.9.4-platform-file +notices-for-facebook-graph-api-2 +1.2.0-standard-minifiers-package +1.2.0-meteor-platform-split +1.2.0-cordova-changes +1.2.0-breaking-changes +1.3.0-split-minifiers-package +1.4.0-remove-old-dev-bundle-link +1.4.1-add-shell-server-package +1.4.3-split-account-service-packages +1.5-add-dynamic-import-package +1.7-split-underscore-from-meteor-base +1.8.3-split-jquery-from-blaze diff --git a/samples/meteor/.meteor/.gitignore b/samples/meteor/.meteor/.gitignore new file mode 100644 index 00000000..40830374 --- /dev/null +++ b/samples/meteor/.meteor/.gitignore @@ -0,0 +1 @@ +local diff --git a/samples/meteor/.meteor/.id b/samples/meteor/.meteor/.id new file mode 100644 index 00000000..9390ea63 --- /dev/null +++ b/samples/meteor/.meteor/.id @@ -0,0 +1,7 @@ +# This file contains a token that is unique to your project. +# Check it into your repository along with the rest of this directory. +# It can be used for purposes such as: +# - ensuring you don't accidentally deploy one app on top of another +# - providing package authors with aggregated statistics + +llguvii62hi.wevyt9xba2dc diff --git a/samples/meteor/.meteor/packages b/samples/meteor/.meteor/packages new file mode 100644 index 00000000..eb65ea6a --- /dev/null +++ b/samples/meteor/.meteor/packages @@ -0,0 +1,22 @@ +# Meteor packages used by this project, one per line. +# Check this file (and the other files in this directory) into your repository. +# +# 'meteor add' and 'meteor remove' will edit this file for you, +# but you can also edit it by hand. + +meteor-base@1.5.1 # Packages every Meteor app needs to have +mobile-experience@1.1.1 # Packages for a great mobile UX +mongo@1.16.10 # The database Meteor supports right now +reactive-var@1.0.12 # Reactive variable for tracker + +standard-minifier-css@1.9.2 # CSS minifier run for production mode +standard-minifier-js@2.8.1 # JS minifier run for production mode +es5-shim@4.8.0 # ECMAScript 5 compatibility for older browsers +ecmascript@0.16.8 # Enable ECMAScript2015+ syntax in app code +typescript@4.9.5 # Enable TypeScript syntax in .ts and .tsx modules +shell-server@0.5.0 # Server-side component of the `meteor shell` command +hot-module-replacement@0.5.3 # Update client in development without reloading the page + + +static-html@1.3.2 # Define static page content in .html files +react-meteor-data # React higher-order component for reactively tracking Meteor data diff --git a/samples/meteor/.meteor/platforms b/samples/meteor/.meteor/platforms new file mode 100644 index 00000000..efeba1b5 --- /dev/null +++ b/samples/meteor/.meteor/platforms @@ -0,0 +1,2 @@ +server +browser diff --git a/samples/meteor/.meteor/release b/samples/meteor/.meteor/release new file mode 100644 index 00000000..5152abe9 --- /dev/null +++ b/samples/meteor/.meteor/release @@ -0,0 +1 @@ +METEOR@2.16 diff --git a/samples/meteor/.meteor/versions b/samples/meteor/.meteor/versions new file mode 100644 index 00000000..892d35d5 --- /dev/null +++ b/samples/meteor/.meteor/versions @@ -0,0 +1,71 @@ +allow-deny@1.1.1 +autoupdate@1.8.0 +babel-compiler@7.10.5 +babel-runtime@1.5.1 +base64@1.0.12 +binary-heap@1.0.11 +blaze-tools@1.1.3 +boilerplate-generator@1.7.2 +caching-compiler@1.2.2 +caching-html-compiler@1.2.1 +callback-hook@1.5.1 +check@1.4.1 +ddp@1.4.1 +ddp-client@2.6.2 +ddp-common@1.4.1 +ddp-server@2.7.1 +diff-sequence@1.1.2 +dynamic-import@0.7.3 +ecmascript@0.16.8 +ecmascript-runtime@0.8.1 +ecmascript-runtime-client@0.12.1 +ecmascript-runtime-server@0.11.0 +ejson@1.1.3 +es5-shim@4.8.0 +fetch@0.1.4 +geojson-utils@1.0.11 +hot-code-push@1.0.4 +hot-module-replacement@0.5.3 +html-tools@1.1.3 +htmljs@1.1.1 +id-map@1.1.1 +inter-process-messaging@0.1.1 +launch-screen@2.0.0 +logging@1.3.4 +meteor@1.11.5 +meteor-base@1.5.1 +minifier-css@1.6.4 +minifier-js@2.8.0 +minimongo@1.9.4 +mobile-experience@1.1.1 +mobile-status-bar@1.1.0 +modern-browsers@0.1.10 +modules@0.20.0 +modules-runtime@0.13.1 +modules-runtime-hot@0.14.2 +mongo@1.16.10 +mongo-decimal@0.1.3 +mongo-dev-server@1.1.0 +mongo-id@1.0.8 +npm-mongo@4.17.2 +ordered-dict@1.1.0 +promise@0.12.2 +random@1.2.1 +react-fast-refresh@0.2.8 +react-meteor-data@2.7.2 +reactive-var@1.0.12 +reload@1.3.1 +retry@1.1.0 +routepolicy@1.1.1 +shell-server@0.5.0 +socket-stream-client@0.5.2 +spacebars-compiler@1.3.1 +standard-minifier-css@1.9.2 +standard-minifier-js@2.8.1 +static-html@1.3.2 +templating-tools@1.2.2 +tracker@1.3.3 +typescript@4.9.5 +underscore@1.6.1 +webapp@1.13.8 +webapp-hashing@1.1.1 diff --git a/samples/meteor/.plandex/project.json b/samples/meteor/.plandex/project.json new file mode 100755 index 00000000..574625c5 --- /dev/null +++ b/samples/meteor/.plandex/project.json @@ -0,0 +1 @@ +{"id":"08e46c65-a394-4c1c-976e-18e23904217a"} \ No newline at end of file diff --git a/samples/meteor/Dockerfile b/samples/meteor/Dockerfile new file mode 100644 index 00000000..ec035729 --- /dev/null +++ b/samples/meteor/Dockerfile @@ -0,0 +1,38 @@ +# Use an official Meteor runtime as a parent image +FROM geoffreybooth/meteor-base:latest + +# Set the working directory +WORKDIR /app + +# Install Node.js +RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ + apt-get install -y nodejs + +# Copy only the package.json and package-lock.json first +COPY package*.json ./ + +# Install Node.js dependencies +RUN meteor npm install +RUN meteor npm install --save @babel/runtime + +# Copy the rest of the application +COPY . . + +# Set METEOR_ALLOW_SUPERUSER to avoid permission issues +ENV METEOR_ALLOW_SUPERUSER=true + +# Build the Meteor app +RUN meteor build --directory /app/build --server-only + +# Change to the server bundle directory and install server dependencies +WORKDIR /app/build/bundle/programs/server +RUN npm install + +# Change back to the app directory +WORKDIR /app + +# Expose the port the app runs on +EXPOSE 3000 + +# Define the command to run the app +CMD ["node", "/app/build/bundle/main.js"] diff --git a/samples/meteor/README.md b/samples/meteor/README.md new file mode 100644 index 00000000..03b811f9 --- /dev/null +++ b/samples/meteor/README.md @@ -0,0 +1,39 @@ +# Meteor Application with Docker + +This sample project demonstrates how to deploy a Meteor application using Docker and connect it to a MongoDB database. We also demonstrate how to run a MongoDB container during development and how to switch over to a managed MongoDB service in production. + +## Prerequisites + +1. Download [Defang CLI](https://github.com/DefangLabs/defang) +2. Have a managed MongoDB service configured and have the connection string ready. +3. (Optional) If you are using [Defang BYOC](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html) authenticated with your AWS account +4. (Optional - for local development) [Docker CLI](https://docs.docker.com/engine/install/) +5. (Optional - for local development) [Meteor CLI](https://docs.meteor.com/install.html) + +### Editing the database/permissions etc. + +If you want to edit the database, permissions, or any other Meteor settings such that you can deploy them to production, you should make those changes locally and test them in the development environment. Once satisfied, these changes can be applied to the production environment. + +## Deploying + +1. Open the terminal and type `defang login` +2. Add your connection string as a defang config value by typing `defang config set MONGO_URL` and pasting your connection string (which should be in the format `mongodb://username:password@host:port/dbname`) +3. Setup a password for Meteor by typing `defang config set METEOR_ADMIN_SECRET` and adding a password you would like to login with. +4. Type `defang compose up` in the CLI. +5. Your app will be running within a few minutes. + +## Development + +For development, we use a MongoDB container. The MongoDB container is defined in the `compose.dev.yaml` file. The Meteor container is also defined in the `compose.dev.yaml` file so it can correctly connect to the development database container. + +To start the development environment, run `docker-compose up --build`. This will start the MongoDB container and the Meteor container. The Meteor application will be available at `http://localhost:3000`. + +--- + +Title: Meteor Application with Docker + +Short Description: A sample project demonstrating how to deploy a Meteor application using Docker and connect it to a MongoDB database + +Tags: meteor, mongodb + +Languages: javascript, mongodb diff --git a/samples/meteor/client/main.html b/samples/meteor/client/main.html new file mode 100644 index 00000000..2bd27934 --- /dev/null +++ b/samples/meteor/client/main.html @@ -0,0 +1,9 @@ + + Defang x Meteor + + + +

Defang x Meteor

+
+ + \ No newline at end of file diff --git a/samples/meteor/client/main.js b/samples/meteor/client/main.js new file mode 100644 index 00000000..da8488e2 --- /dev/null +++ b/samples/meteor/client/main.js @@ -0,0 +1,13 @@ +import { Meteor } from 'meteor/meteor'; +import { render } from 'react-dom'; +import React from 'react'; + +const App = () => ( +
+

Defang x Meteor

+
+); + +Meteor.startup(() => { + render(, document.getElementById('render-target')); +}); diff --git a/samples/meteor/compose.dev.yaml b/samples/meteor/compose.dev.yaml new file mode 100644 index 00000000..2451e596 --- /dev/null +++ b/samples/meteor/compose.dev.yaml @@ -0,0 +1,28 @@ +version: "3.8" + +services: + meteor-app: + build: . + ports: + - target: 3000 + published: 3000 + protocol: tcp + mode: ingress + environment: + MONGO_URL: mongodb://mongo:27017/meteor + ROOT_URL: http://localhost:3000 + PORT: 3000 + depends_on: + - mongo + + mongo: + image: mongo:latest + ports: + - target: 27017 + published: 27017 + protocol: tcp + mode: host + volumes: + - mongo-data:/data/db +volumes: + mongo-data: diff --git a/samples/meteor/compose.yaml b/samples/meteor/compose.yaml new file mode 100644 index 00000000..3a3d9a39 --- /dev/null +++ b/samples/meteor/compose.yaml @@ -0,0 +1,16 @@ +version: "3.8" + +services: + meteor: + build: . + container_name: meteor + platform: linux/amd64 + environment: + - MONGO_URL=mongodb+srv://Chris:Defang12345@atlascluster.oo6gmyw.mongodb.net/?retryWrites=true&w=majority&appName=AtlasCluster # your connection string + - ROOT_URL=https://chrisyhjiang-meteor--3000.prod1.defang.dev # your ROOT URL + - PORT=3000 + ports: + - target: 3000 + published: 3000 + protocol: tcp + mode: ingress diff --git a/samples/meteor/package-lock.json b/samples/meteor/package-lock.json new file mode 100644 index 00000000..d67b38b8 --- /dev/null +++ b/samples/meteor/package-lock.json @@ -0,0 +1,814 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "@babel/runtime": { + "version": "7.24.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.6.tgz", + "integrity": "sha512-Ja18XcETdEl5mzzACGd+DKgaGJzPTCow7EglgwTmHdwokzDFYh/MHua6lU6DV/hjF2IaOJ4oX2nqnjG7RElKOw==", + "requires": { + "regenerator-runtime": "^0.14.0" + } + }, + "jquery": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz", + "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==" + }, + "meteor-node-stubs": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/meteor-node-stubs/-/meteor-node-stubs-1.2.9.tgz", + "integrity": "sha512-EKRezc1/PblYtYiK4BOT3h5geWDo9AFBBSYNamPNh8AC5msUbVCcg8kekzAa7r7JPzBX8nZWaXEQVar4t8q/Hg==", + "requires": { + "@meteorjs/crypto-browserify": "^3.12.1", + "assert": "^2.1.0", + "browserify-zlib": "^0.2.0", + "buffer": "^5.7.1", + "console-browserify": "^1.2.0", + "constants-browserify": "^1.0.0", + "domain-browser": "^4.23.0", + "elliptic": "^6.5.4", + "events": "^3.3.0", + "https-browserify": "^1.0.0", + "os-browserify": "^0.3.0", + "path-browserify": "^1.0.1", + "process": "^0.11.10", + "punycode": "^1.4.1", + "querystring-es3": "^0.2.1", + "readable-stream": "^3.6.2", + "stream-browserify": "^3.0.0", + "stream-http": "^3.2.0", + "string_decoder": "^1.3.0", + "timers-browserify": "^2.0.12", + "tty-browserify": "0.0.1", + "url": "^0.11.3", + "util": "^0.12.5", + "vm-browserify": "^1.1.2" + }, + "dependencies": { + "@meteorjs/crypto-browserify": { + "version": "3.12.1", + "bundled": true, + "requires": { + "browserify-cipher": "^1.0.1", + "browserify-sign": "^4.2.3", + "create-ecdh": "^4.0.4", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "diffie-hellman": "^5.0.3", + "hash-base": "~3.0.4", + "inherits": "^2.0.4", + "pbkdf2": "^3.1.2", + "public-encrypt": "^4.0.3", + "randombytes": "^2.1.0", + "randomfill": "^1.0.4" + }, + "dependencies": { + "hash-base": { + "version": "3.0.4", + "bundled": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + } + } + }, + "asn1.js": { + "version": "4.10.1", + "bundled": true, + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "bundled": true + } + } + }, + "assert": { + "version": "2.1.0", + "bundled": true, + "requires": { + "call-bind": "^1.0.2", + "is-nan": "^1.3.2", + "object-is": "^1.1.5", + "object.assign": "^4.1.4", + "util": "^0.12.5" + } + }, + "available-typed-arrays": { + "version": "1.0.5", + "bundled": true + }, + "base64-js": { + "version": "1.5.1", + "bundled": true + }, + "bn.js": { + "version": "5.2.0", + "bundled": true + }, + "brorand": { + "version": "1.1.0", + "bundled": true + }, + "browserify-aes": { + "version": "1.2.0", + "bundled": true, + "requires": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "browserify-cipher": { + "version": "1.0.1", + "bundled": true, + "requires": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "browserify-des": { + "version": "1.0.2", + "bundled": true, + "requires": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "browserify-rsa": { + "version": "4.1.0", + "bundled": true, + "requires": { + "bn.js": "^5.0.0", + "randombytes": "^2.0.1" + } + }, + "browserify-sign": { + "version": "4.2.3", + "bundled": true, + "requires": { + "bn.js": "^5.2.1", + "browserify-rsa": "^4.1.0", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "elliptic": "^6.5.5", + "hash-base": "~3.0", + "inherits": "^2.0.4", + "parse-asn1": "^5.1.7", + "readable-stream": "^2.3.8", + "safe-buffer": "^5.2.1" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "bundled": true + }, + "hash-base": { + "version": "3.0.4", + "bundled": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "readable-stream": { + "version": "2.3.8", + "bundled": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "bundled": true + } + } + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "requires": { + "safe-buffer": "~5.1.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "bundled": true + } + } + } + } + }, + "browserify-zlib": { + "version": "0.2.0", + "bundled": true, + "requires": { + "pako": "~1.0.5" + } + }, + "buffer": { + "version": "5.7.1", + "bundled": true, + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "buffer-xor": { + "version": "1.0.3", + "bundled": true + }, + "builtin-status-codes": { + "version": "3.0.0", + "bundled": true + }, + "call-bind": { + "version": "1.0.5", + "bundled": true, + "requires": { + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.1", + "set-function-length": "^1.1.1" + } + }, + "cipher-base": { + "version": "1.0.4", + "bundled": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "console-browserify": { + "version": "1.2.0", + "bundled": true + }, + "constants-browserify": { + "version": "1.0.0", + "bundled": true + }, + "core-util-is": { + "version": "1.0.3", + "bundled": true + }, + "create-ecdh": { + "version": "4.0.4", + "bundled": true, + "requires": { + "bn.js": "^4.1.0", + "elliptic": "^6.5.3" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "bundled": true + } + } + }, + "create-hash": { + "version": "1.2.0", + "bundled": true, + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "create-hmac": { + "version": "1.1.7", + "bundled": true, + "requires": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "define-data-property": { + "version": "1.1.1", + "bundled": true, + "requires": { + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + } + }, + "define-properties": { + "version": "1.2.1", + "bundled": true, + "requires": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + } + }, + "des.js": { + "version": "1.0.1", + "bundled": true, + "requires": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "diffie-hellman": { + "version": "5.0.3", + "bundled": true, + "requires": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "bundled": true + } + } + }, + "domain-browser": { + "version": "4.23.0", + "bundled": true + }, + "elliptic": { + "version": "6.5.5", + "bundled": true, + "requires": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "bundled": true + } + } + }, + "events": { + "version": "3.3.0", + "bundled": true + }, + "evp_bytestokey": { + "version": "1.0.3", + "bundled": true, + "requires": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "for-each": { + "version": "0.3.3", + "bundled": true, + "requires": { + "is-callable": "^1.1.3" + } + }, + "function-bind": { + "version": "1.1.2", + "bundled": true + }, + "get-intrinsic": { + "version": "1.2.2", + "bundled": true, + "requires": { + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + } + }, + "gopd": { + "version": "1.0.1", + "bundled": true, + "requires": { + "get-intrinsic": "^1.1.3" + } + }, + "has-property-descriptors": { + "version": "1.0.1", + "bundled": true, + "requires": { + "get-intrinsic": "^1.2.2" + } + }, + "has-proto": { + "version": "1.0.1", + "bundled": true + }, + "has-symbols": { + "version": "1.0.3", + "bundled": true + }, + "has-tostringtag": { + "version": "1.0.0", + "bundled": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, + "hash-base": { + "version": "3.1.0", + "bundled": true, + "requires": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + } + }, + "hash.js": { + "version": "1.1.7", + "bundled": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hasown": { + "version": "2.0.0", + "bundled": true, + "requires": { + "function-bind": "^1.1.2" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "bundled": true, + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "https-browserify": { + "version": "1.0.0", + "bundled": true + }, + "ieee754": { + "version": "1.2.1", + "bundled": true + }, + "inherits": { + "version": "2.0.4", + "bundled": true + }, + "is-arguments": { + "version": "1.1.1", + "bundled": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-callable": { + "version": "1.2.7", + "bundled": true + }, + "is-generator-function": { + "version": "1.0.10", + "bundled": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-nan": { + "version": "1.3.2", + "bundled": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + } + }, + "is-typed-array": { + "version": "1.1.12", + "bundled": true, + "requires": { + "which-typed-array": "^1.1.11" + } + }, + "isarray": { + "version": "1.0.0", + "bundled": true + }, + "md5.js": { + "version": "1.3.5", + "bundled": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "miller-rabin": { + "version": "4.0.1", + "bundled": true, + "requires": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "bundled": true + } + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "bundled": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "bundled": true + }, + "object-inspect": { + "version": "1.13.1", + "bundled": true + }, + "object-is": { + "version": "1.1.5", + "bundled": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + } + }, + "object-keys": { + "version": "1.1.1", + "bundled": true + }, + "object.assign": { + "version": "4.1.4", + "bundled": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + } + }, + "os-browserify": { + "version": "0.3.0", + "bundled": true + }, + "pako": { + "version": "1.0.11", + "bundled": true + }, + "parse-asn1": { + "version": "5.1.7", + "bundled": true, + "requires": { + "asn1.js": "^4.10.1", + "browserify-aes": "^1.2.0", + "evp_bytestokey": "^1.0.3", + "hash-base": "~3.0", + "pbkdf2": "^3.1.2", + "safe-buffer": "^5.2.1" + }, + "dependencies": { + "hash-base": { + "version": "3.0.4", + "bundled": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + } + } + }, + "path-browserify": { + "version": "1.0.1", + "bundled": true + }, + "pbkdf2": { + "version": "3.1.2", + "bundled": true, + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "process": { + "version": "0.11.10", + "bundled": true + }, + "process-nextick-args": { + "version": "2.0.1", + "bundled": true + }, + "public-encrypt": { + "version": "4.0.3", + "bundled": true, + "requires": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "bundled": true + } + } + }, + "punycode": { + "version": "1.4.1", + "bundled": true + }, + "qs": { + "version": "6.11.2", + "bundled": true, + "requires": { + "side-channel": "^1.0.4" + } + }, + "querystring-es3": { + "version": "0.2.1", + "bundled": true + }, + "randombytes": { + "version": "2.1.0", + "bundled": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "randomfill": { + "version": "1.0.4", + "bundled": true, + "requires": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "readable-stream": { + "version": "3.6.2", + "bundled": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "ripemd160": { + "version": "2.0.2", + "bundled": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "safe-buffer": { + "version": "5.2.1", + "bundled": true + }, + "set-function-length": { + "version": "1.1.1", + "bundled": true, + "requires": { + "define-data-property": "^1.1.1", + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + } + }, + "setimmediate": { + "version": "1.0.5", + "bundled": true + }, + "sha.js": { + "version": "2.4.11", + "bundled": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "side-channel": { + "version": "1.0.4", + "bundled": true, + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, + "stream-browserify": { + "version": "3.0.0", + "bundled": true, + "requires": { + "inherits": "~2.0.4", + "readable-stream": "^3.5.0" + } + }, + "stream-http": { + "version": "3.2.0", + "bundled": true, + "requires": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "xtend": "^4.0.2" + } + }, + "string_decoder": { + "version": "1.3.0", + "bundled": true, + "requires": { + "safe-buffer": "~5.2.0" + } + }, + "timers-browserify": { + "version": "2.0.12", + "bundled": true, + "requires": { + "setimmediate": "^1.0.4" + } + }, + "tty-browserify": { + "version": "0.0.1", + "bundled": true + }, + "url": { + "version": "0.11.3", + "bundled": true, + "requires": { + "punycode": "^1.4.1", + "qs": "^6.11.2" + } + }, + "util": { + "version": "0.12.5", + "bundled": true, + "requires": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true + }, + "vm-browserify": { + "version": "1.1.2", + "bundled": true + }, + "which-typed-array": { + "version": "1.1.13", + "bundled": true, + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.4", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + } + }, + "xtend": { + "version": "4.0.2", + "bundled": true + } + } + }, + "regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + } + } +} From 6342822380c44746a834e96909f364e9e8e8d974 Mon Sep 17 00:00:00 2001 From: Christopher Yihan Jiang <48700578+Chrisyhjiang@users.noreply.github.com> Date: Wed, 5 Jun 2024 15:51:36 -0700 Subject: [PATCH 2/4] took out sensitive info (secrets) and changed README --- samples/meteor/README.md | 11 +++++++---- samples/meteor/compose.yaml | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/samples/meteor/README.md b/samples/meteor/README.md index 03b811f9..460a7ddf 100644 --- a/samples/meteor/README.md +++ b/samples/meteor/README.md @@ -18,15 +18,18 @@ If you want to edit the database, permissions, or any other Meteor settings such 1. Open the terminal and type `defang login` 2. Add your connection string as a defang config value by typing `defang config set MONGO_URL` and pasting your connection string (which should be in the format `mongodb://username:password@host:port/dbname`) -3. Setup a password for Meteor by typing `defang config set METEOR_ADMIN_SECRET` and adding a password you would like to login with. -4. Type `defang compose up` in the CLI. -5. Your app will be running within a few minutes. +3. Set up the environment variables `MONGO_URL` and `ROOT_URL` by typing in `defang config set MONGO_URL` and `defang config set `ROOT_URL` +4. Type `defang compose up` in the CLI. 5. Your app will be running within a few minutes. ## Development For development, we use a MongoDB container. The MongoDB container is defined in the `compose.dev.yaml` file. The Meteor container is also defined in the `compose.dev.yaml` file so it can correctly connect to the development database container. -To start the development environment, run `docker-compose up --build`. This will start the MongoDB container and the Meteor container. The Meteor application will be available at `http://localhost:3000`. +To start the development environment, run + +`docker-compose up --build`. + +This will start the MongoDB container and the Meteor container. The Meteor application will be available at `http://localhost:3000`. --- diff --git a/samples/meteor/compose.yaml b/samples/meteor/compose.yaml index 3a3d9a39..09807914 100644 --- a/samples/meteor/compose.yaml +++ b/samples/meteor/compose.yaml @@ -6,8 +6,8 @@ services: container_name: meteor platform: linux/amd64 environment: - - MONGO_URL=mongodb+srv://Chris:Defang12345@atlascluster.oo6gmyw.mongodb.net/?retryWrites=true&w=majority&appName=AtlasCluster # your connection string - - ROOT_URL=https://chrisyhjiang-meteor--3000.prod1.defang.dev # your ROOT URL + - MONGO_URL #your MONGODB URL + - ROOT_URL # your ROOT URL - PORT=3000 ports: - target: 3000 From 19dfbd11a669d3a1e5c4f41b2961152ba331a44a Mon Sep 17 00:00:00 2001 From: Christopher Yihan Jiang <48700578+Chrisyhjiang@users.noreply.github.com> Date: Wed, 5 Jun 2024 16:27:28 -0700 Subject: [PATCH 3/4] changed the compose file --- samples/meteor/README.md | 4 ++-- samples/meteor/compose.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/meteor/README.md b/samples/meteor/README.md index 460a7ddf..7172910c 100644 --- a/samples/meteor/README.md +++ b/samples/meteor/README.md @@ -18,7 +18,7 @@ If you want to edit the database, permissions, or any other Meteor settings such 1. Open the terminal and type `defang login` 2. Add your connection string as a defang config value by typing `defang config set MONGO_URL` and pasting your connection string (which should be in the format `mongodb://username:password@host:port/dbname`) -3. Set up the environment variables `MONGO_URL` and `ROOT_URL` by typing in `defang config set MONGO_URL` and `defang config set `ROOT_URL` +3. Set up the environment variables `MONGO_URL` and `ROOT_URL` by typing in `defang config set MONGO_URL` and `defang config set ROOT_URL` 4. Type `defang compose up` in the CLI. 5. Your app will be running within a few minutes. ## Development @@ -33,7 +33,7 @@ This will start the MongoDB container and the Meteor container. The Meteor appli --- -Title: Meteor Application with Docker +Title: Meteor Short Description: A sample project demonstrating how to deploy a Meteor application using Docker and connect it to a MongoDB database diff --git a/samples/meteor/compose.yaml b/samples/meteor/compose.yaml index 09807914..33acfaad 100644 --- a/samples/meteor/compose.yaml +++ b/samples/meteor/compose.yaml @@ -6,7 +6,7 @@ services: container_name: meteor platform: linux/amd64 environment: - - MONGO_URL #your MONGODB URL + - MONGO_URL # your MONGODB URL - ROOT_URL # your ROOT URL - PORT=3000 ports: From df059c50152b2111d4d98df421b437cfa2176b27 Mon Sep 17 00:00:00 2001 From: Christopher Yihan Jiang <48700578+Chrisyhjiang@users.noreply.github.com> Date: Fri, 5 Jul 2024 08:46:41 -0700 Subject: [PATCH 4/4] reverted golang mongodb atlas compose file the mongoURI string was there --- samples/golang-mongodb-atlas/compose.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/samples/golang-mongodb-atlas/compose.yaml b/samples/golang-mongodb-atlas/compose.yaml index 109687e7..ad446e64 100644 --- a/samples/golang-mongodb-atlas/compose.yaml +++ b/samples/golang-mongodb-atlas/compose.yaml @@ -1,12 +1,12 @@ -version: '3.8' - services: - meteor: - build: . - container_name: meteor - environment: - - MONGO_URL=mongodb+srv://Chris:Defang12345@atlascluster.oo6gmyw.mongodb.net/?retryWrites=true&w=majority&appName=AtlasCluster - - ROOT_URL=http://your-production-domain.com - - PORT=3000 + app: + restart: unless-stopped + build: + context: ./app + dockerfile: Dockerfile ports: - - "3000:3000" + - mode: ingress + target: 8080 + published: 8080 + environment: + - MONGO_URI=your mongo db URI connection string