Skip to content

Commit 4a49db5

Browse files
VanshikaSabharwalfahdfadyviferga
authored
Added Dockerfile and Documentation (#85)
* added Dockerfile * Added expose in Dockerfile * updated code * updated code * added docs to installation.md * removed deployment section from README.md * Update Dockerfile --------- Co-authored-by: Fahd Ashour <fahd.fady212@gmail.com> Co-authored-by: Vicente Eduardo Ferrer Garcia <7854099+viferga@users.noreply.github.com>
1 parent 7757415 commit 4a49db5

File tree

3 files changed

+115
-6
lines changed

3 files changed

+115
-6
lines changed

Dockerfile

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
FROM rust:slim-trixie AS base
2+
3+
# Image descriptor
4+
LABEL copyright.name="Vicente Eduardo Ferrer Garcia" \
5+
copyright.address="vic798@gmail.com" \
6+
maintainer.name="Vicente Eduardo Ferrer Garcia" \
7+
maintainer.address="vic798@gmail.com" \
8+
vendor="MetaCall Inc." \
9+
version="0.1"
10+
11+
# Install MetaCall dependencies
12+
RUN apt-get update \
13+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
14+
ca-certificates \
15+
git \
16+
wget \
17+
npm \
18+
nodejs
19+
20+
# Set working directory to root
21+
WORKDIR /root
22+
23+
# Debug Image
24+
FROM base AS build_debug
25+
26+
# Argument for the name of the app
27+
ARG APP_NAME
28+
29+
# Install MetaCall in debug mode
30+
RUN wget -O - https://raw.githubusercontent.com/metacall/install/master/install.sh | bash -s -- --debug
31+
32+
# Copy the project
33+
COPY . .
34+
35+
ENV RUSTFLAGS="-g"
36+
37+
# Build with debug mode
38+
RUN cargo build \
39+
&& cp target/debug/metassr /usr/local/bin/metassr
40+
41+
# Application location
42+
WORKDIR /root/${APP_NAME}
43+
44+
# Install packages & Build the Application
45+
RUN npm install \
46+
&& npm run build:ssr
47+
48+
# Exposing Port
49+
EXPOSE 8080
50+
51+
CMD ["npm", "start:ssr"]

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
> this project under development, **Using it is your responsibility**.
33
44
<div align="center">
5-
<img src="assets/logo.png" h alt="MetaSSR">
5+
<img src="assets/logo.png" alt="MetaSSR">
66
<p align='center'> SSR framework for React.js built on <a href="https://github.com/metacall/core">MetaCall</a> </p>
77
</div>
88

9-
109
MetaSSR is a powerful Server-Side Rendering (SSR) framework crafted for high-performance, dynamic web applications. Built on Rust and leveraging the Axum web framework, MetaSSR integrates seamlessly with the Metacall Runtime, showcasing a real-world use case for polyglot programming. It was created as part of [Google Summer of Code 2024](https://summerofcode.withgoogle.com/archive/2024/projects/yRWw2gPh) by [Mohamed Emad](https://github.com/hulxv), to demonstrate the capabilities of polyglot programming.
1110

1211
## Why MetaSSR?
@@ -28,8 +27,6 @@ Here's how MetaSSR compares to Next.js under high load (12 threads, 1000 connect
2827

2928
</center>
3029

31-
32-
3330
## Key Features
3431

3532
- **Rust-Powered Performance**: Enjoy the speed and safety of Rust in your server-side rendering tasks.
@@ -46,7 +43,7 @@ To get started with MetaSSR, follow these steps:
4643

4744
## Contributing
4845

49-
We welcome contributions from the community! If youre interested in helping out, please check out our [Contributing Guide](CONTRIBUTING.md) for information on how to get involved.
46+
We welcome contributions from the community! If you're interested in helping out, please check out our [Contributing Guide](CONTRIBUTING.md) for information on how to get involved.
5047

5148
## Development
5249

@@ -87,7 +84,7 @@ To ensure a positive and inclusive environment, please review our [Code of Condu
8784

8885
- **Discussion Forum**: [Join the Conversation](https://github.com/metacall/metassr/discussions)
8986
- **Twitter**: [Follow US](https://twitter.com/metacallio)
90-
- **Metacall Community**:
87+
- **Metacall Community**:
9188
- [Discord](https://discord.gg/upwP4mwJWa)
9289
- [Telegram](https://t.me/joinchat/BMSVbBatp0Vi4s5l4VgUgg)
9390
- [Matrix](https://matrix.to/#/#metacall:matrix.org)

docs/getting-started/installation.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,67 @@ After completing the above steps, you'll be able to create your first web applic
6666
$ metassr create <project-name>
6767
```
6868

69+
## Deployment
70+
71+
### Prerequisites
72+
- **Docker Installed**
73+
74+
### Step-by-Step Deployment
75+
76+
#### 1. Create & Build Your App
77+
78+
Scaffold a new MetaSSR app and bundle its assets:
79+
80+
```sh
81+
metassr create ${name of the app}
82+
cd ${name of the app}
83+
npm install
84+
npm run build:ssr
85+
```
86+
87+
Example:-
88+
```sh
89+
metassr create vis
90+
cd vis
91+
npm install
92+
npm run build:ssr
93+
```
94+
95+
#### 2. Build the Docker Image
96+
97+
Build a production-ready Docker image using the release stage:
98+
99+
```sh
100+
docker build --build-arg APP_NAME=${name of app} -t metassr-debug .
101+
```
102+
103+
Example:
104+
```sh
105+
docker build --build-arg APP_NAME=vis -t metassr-debug .
106+
```
107+
108+
#### 3. Test Locally
109+
110+
Run the container and verify everything works before deploying:
111+
112+
Example:
113+
```sh
114+
docker run -p 8080:8080 metassr-debug
115+
```
116+
117+
Visit [http://localhost:8080](http://localhost:8080) and check logs with:
118+
119+
```sh
120+
docker logs <container-id>
121+
```
122+
123+
#### 5. Verify & Monitor
124+
125+
- **Endpoint**: `GET /` should return server-side rendered content.
126+
- **Logging**: Set `RUST_LOG=info` in your environment for detailed logs.
127+
- **Scaling**: Add replicas via Docker Compose's `scale` option or a Kubernetes deployment.
128+
129+
69130
## Conclusion
70131

71132
You have successfully installed and set up your first SSR framework project! Explore the [docs](../README.md) for more advanced features and customization options.

0 commit comments

Comments
 (0)