File tree Expand file tree Collapse file tree 8 files changed +62
-22
lines changed
Expand file tree Collapse file tree 8 files changed +62
-22
lines changed Original file line number Diff line number Diff line change 11aws
2- awscliv2.zip
2+ awscliv2.zip
3+ ssl
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ RUN apt-get update && apt-get install -y \
77COPY server/ /usr/src/syntaxmakersserver/server/
88WORKDIR /usr/src/syntaxmakersserver/server
99RUN cargo build --release
10-
1110RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
1211 apt-get install -y nodejs
1312COPY webclient/ /usr/src/syntaxmakersserver/webclient/
@@ -20,12 +19,13 @@ RUN apt-get update && \
2019 apt-get install -y \
2120 nginx \
2221 libssl3 \
22+ curl \
23+ jq \
2324 && apt-get clean
24-
2525COPY --from=builder /usr/src/syntaxmakersserver /usr/local/bin/syntaxmakersserver
2626RUN rm /etc/nginx/sites-enabled/default
2727EXPOSE 80 443
28- RUN mv /usr/local/bin/syntaxmakersserver/server /nginx.conf /etc/nginx/conf.d/nginx.conf
29- RUN mv /usr/local/bin/syntaxmakersserver/server/.env.production /usr/local/bin/syntaxmakersserver/server/.env
28+ RUN mv /usr/local/bin/syntaxmakersserver/webclient /nginx.conf /etc/nginx/conf.d/nginx.conf
29+ # RUN mv /usr/local/bin/syntaxmakersserver/server/.env.production /usr/local/bin/syntaxmakersserver/server/.env
3030WORKDIR /usr/local/bin/syntaxmakersserver/server
3131CMD ["sh" , "-c" , "nginx && ./target/release/syntaxmakers-server" ]
Original file line number Diff line number Diff line change 1- echo build docker container
1+ docker rmi $( docker images -q ) -f
22docker build -f ./Dockerfile -t syntaxmakers:1.0 ..
3+ docker tag syntaxmakers:1.0 201558611471.dkr.ecr.us-east-2.amazonaws.com/syntaxmakers1
4+ aws ecr get-login-password --region us-east-2 --profile cli | docker login --username AWS --password-stdin 201558611471.dkr.ecr.us-east-2.amazonaws.com
5+ docker push 201558611471.dkr.ecr.us-east-2.amazonaws.com/syntaxmakers1
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -154,8 +154,7 @@ pub async fn run() -> std::io::Result<()> {
154154 dotenv ( ) . ok ( ) ;
155155 let host = env:: var ( "HOST" ) . unwrap ( ) ;
156156 let port = env:: var ( "PORT" ) . unwrap ( ) . parse :: < u16 > ( ) . unwrap ( ) ;
157- let allowed_origin1 = env:: var ( "ALLOWED_ORIGIN1" ) . unwrap ( ) ;
158- info ! ( "ALLOWED_ORIGIN1 {}" , & allowed_origin1) ;
157+ let allowed_domain = env:: var ( "ALLOWED_DOMAIN" ) . unwrap ( ) ;
159158
160159 let app_data = actix_web:: web:: Data :: new ( AppState {
161160 repo : DbRepo :: init ( ) . await ,
@@ -170,7 +169,7 @@ pub async fn run() -> std::io::Result<()> {
170169 . wrap ( Logger :: default ( ) )
171170 . wrap (
172171 Cors :: default ( )
173- . allowed_origin ( & allowed_origin1 )
172+ . allowed_origin ( & allowed_domain )
174173 . allowed_methods ( vec ! [ "GET" , "POST" ] )
175174 . allowed_headers ( vec ! [
176175 header:: CONTENT_TYPE ,
@@ -256,7 +255,7 @@ pub async fn run() -> std::io::Result<()> {
256255 . bind ( ( host, port) ) . expect ( "" )
257256 // note: cannot use this for dev as client must also be on https,
258257 // enable at production
259- // .bind_openssl((host, port), ssl_builder()).expect("SSL not working")
258+ // .bind_openssl((host, port), ssl_builder()).expect("SSL not working")
260259 . run ( )
261260 . await
262261}
Original file line number Diff line number Diff line change 1- VITE_API_URL = http ://localhost:4003 /v1/
1+ VITE_API_URL = https ://syntaxmakers.com /v1/
Original file line number Diff line number Diff line change @@ -22,3 +22,5 @@ dist-ssr
2222* .njsproj
2323* .sln
2424* .sw ?
25+
26+ ssl
Original file line number Diff line number Diff line change 1+ server {
2+ listen 80 ;
3+ server_name www.syntaxmakers.com;
4+
5+ location / {
6+ return 301 http ://syntaxmakers.com$request_uri ;
7+ }
8+ }
9+
10+ server {
11+ listen 80 ;
12+ server_name syntaxmakers.com;
13+
14+ location / {
15+ return 301 https://$host$request_uri ;
16+ }
17+ }
18+
19+ server {
20+ listen 443 ssl ;
21+ server_name syntaxmakers.com;
22+
23+ ssl_certificate /usr/local/bin/syntaxmakersserver/server /ssl /cert.pem;
24+ ssl_certificate_key /usr/local/bin/syntaxmakersserver/server /ssl /key.pem;
25+ ssl_protocols TLSv1.2 TLSv1.3;
26+ ssl_ciphers HIGH:!aNULL:!MD5;
27+
28+ access_log /dev/stdout;
29+ error_log /dev/stderr;
30+
31+ # Serve static files from React build
32+ location / {
33+ root /usr/local/bin/syntaxmakersserver/webclient/dist;
34+ index index .html;
35+ try_files $uri $uri / /index .html;
36+ }
37+
38+ # Proxy requests to the API server
39+ location /v1/ {
40+ proxy_pass http ://localhost:4003 /;
41+ proxy_set_header Host $host ;
42+ proxy_set_header X-Real-IP $remote_addr ;
43+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
44+ proxy_set_header X-Forwarded-Proto $scheme ;
45+ }
46+ }
You can’t perform that action at this time.
0 commit comments