Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions samples/golang-mongodb-atlas/compose.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
version: '3.9'
services:
app:
restart: unless-stopped
build:
context: .
context: ./app
dockerfile: Dockerfile
ports:
- mode: ingress
target: 8080
published: 8080
environment:
- MONGO_URI=your mongo db URI connection string

5 changes: 5 additions & 0 deletions samples/meteor/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore node_modules directory
node_modules

# Ignore Meteor's local build directory
.meteor/local
1 change: 1 addition & 0 deletions samples/meteor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
19 changes: 19 additions & 0 deletions samples/meteor/.meteor/.finished-upgraders
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions samples/meteor/.meteor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
local
7 changes: 7 additions & 0 deletions samples/meteor/.meteor/.id
Original file line number Diff line number Diff line change
@@ -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

tp3bejc2h4ai.gwxx0phxb6jq
22 changes: 22 additions & 0 deletions samples/meteor/.meteor/packages
Original file line number Diff line number Diff line change
@@ -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.

[email protected] # Packages every Meteor app needs to have
[email protected] # Packages for a great mobile UX
[email protected] # The database Meteor supports right now
[email protected] # Reactive variable for tracker

[email protected] # CSS minifier run for production mode
[email protected] # JS minifier run for production mode
[email protected] # ECMAScript 5 compatibility for older browsers
[email protected] # Enable ECMAScript2015+ syntax in app code
[email protected] # Enable TypeScript syntax in .ts and .tsx modules
[email protected] # Server-side component of the `meteor shell` command
[email protected] # Update client in development without reloading the page


[email protected] # Define static page content in .html files
react-meteor-data # React higher-order component for reactively tracking Meteor data
2 changes: 2 additions & 0 deletions samples/meteor/.meteor/platforms
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
server
browser
1 change: 1 addition & 0 deletions samples/meteor/.meteor/release
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[email protected]
71 changes: 71 additions & 0 deletions samples/meteor/.meteor/versions
26 changes: 26 additions & 0 deletions samples/meteor/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Build stage
FROM zcloudws/meteor-build:2.11.0 as builder

USER root

RUN mkdir -p /build/source && chown zcloud:zcloud -R /build

USER zcloud

COPY --chown=zcloud:zcloud . /build/source

RUN cd /build/source && \
meteor npm install && \
meteor build --directory ../app-build

# Clean image with builded app
FROM zcloudws/meteor-node-mongodb-runtime:2.11.0

COPY --from=builder /build/app-build/bundle /home/zcloud/app

RUN cd /home/zcloud/app/programs/server && npm install

WORKDIR /home/zcloud/app

# Entrypoint from image
ENTRYPOINT ["/scripts/startup.sh"]
4 changes: 4 additions & 0 deletions samples/meteor/client/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
body {
padding: 10px;
font-family: sans-serif;
}
7 changes: 7 additions & 0 deletions samples/meteor/client/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<head>
<title>Defang X Meteor</title>
</head>

<body>
<h1>Defang X Meteor</h1>
</body>
10 changes: 10 additions & 0 deletions samples/meteor/client/main.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import { Meteor } from 'meteor/meteor';
import { App } from '/imports/ui/App';

Meteor.startup(() => {
const container = document.getElementById('react-target');
const root = createRoot(container);
root.render(<App />);
});
28 changes: 28 additions & 0 deletions samples/meteor/compose.dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: "3"

services:
meteor-app:
build:
context: .
dockerfile: Dockerfile
ports:
- "3000:3000"
environment:
- ROOT_URL=http://localhost:3000
- MONGO_URL=mongodb://mongo:27017/meteorapp
volumes:
- .:/usr/src/app
- /usr/src/app/node_modules
command: meteor run --allow-superuser
depends_on:
- mongo

mongo:
image: mongo:latest
volumes:
- mongo-data:/data/db
ports:
- "27017:27017"

volumes:
mongo-data:
23 changes: 23 additions & 0 deletions samples/meteor/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: "3"

services:
meteor-app:
build: .
ports:
- target: 3000
published: 3000
protocol: tcp
mode: ingress
environment:
- ROOT_URL=http://localhost:3000
- MONGO_URL=mongodb://mongo:27017/meteorapp
depends_on:
- mongo

mongo:
image: mongo:latest
volumes:
- mongo-data:/data/db

volumes:
mongo-data:
3 changes: 3 additions & 0 deletions samples/meteor/imports/api/links.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Mongo } from 'meteor/mongo';

export const LinksCollection = new Mongo.Collection('links');
11 changes: 11 additions & 0 deletions samples/meteor/imports/ui/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';
import { Hello } from './Hello.jsx';
import { Info } from './Info.jsx';

export const App = () => (
<div>
<h1>Welcome to Meteor!</h1>
<Hello/>
<Info/>
</div>
);
16 changes: 16 additions & 0 deletions samples/meteor/imports/ui/Hello.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React, { useState } from 'react';

export const Hello = () => {
const [counter, setCounter] = useState(0);

const increment = () => {
setCounter(counter + 1);
};

return (
<div>
<button onClick={increment}>Click Me</button>
<p>You've pressed the button {counter} times.</p>
</div>
);
};
23 changes: 23 additions & 0 deletions samples/meteor/imports/ui/Info.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import { useFind, useSubscribe } from 'meteor/react-meteor-data';
import { LinksCollection } from '../api/links';

export const Info = () => {
const isLoading = useSubscribe('links');
const links = useFind(() => LinksCollection.find());

if(isLoading()) {
return <div>Loading...</div>;
}

return (
<div>
<h2>Learn Meteor!</h2>
<ul>{links.map(
link => <li key={link._id}>
<a href={link.url} target="_blank">{link.title}</a>
</li>
)}</ul>
</div>
);
};
Loading