<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Adam Raudonis on Medium]]></title>
        <description><![CDATA[Stories by Adam Raudonis on Medium]]></description>
        <link>https://medium.com/@adamraudonis?source=rss-9165d51189e4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*h1hB14SDjBATLVmLf6DVkA.jpeg</url>
            <title>Stories by Adam Raudonis on Medium</title>
            <link>https://medium.com/@adamraudonis?source=rss-9165d51189e4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 25 Nov 2026 02:47:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@adamraudonis/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Install Python 3.10 using pyenv and virtualenv on a Mac]]></title>
            <link>https://adamraudonis.medium.com/install-python-3-10-using-pyenv-and-virtualenv-on-a-mac-683df43072d?source=rss-9165d51189e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/683df43072d</guid>
            <dc:creator><![CDATA[Adam Raudonis]]></dc:creator>
            <pubDate>Sat, 04 Mar 2023 22:39:07 GMT</pubDate>
            <atom:updated>2023-03-04T22:39:07.085Z</atom:updated>
            <content:encoded><![CDATA[<p>Courtesy of ChatGPT. Confirmed by a human. Lightly edited for brevity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_14PnXhaAGyueOiiJ57mZw.png" /></figure><p>First, you’ll need to make sure you have Homebrew installed. If you don’t already have it installed, you can install it by running the following command in your terminal:</p><pre>/bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&quot;</pre><p>Next, you can use Homebrew to install pyenv. Run the following:</p><pre>brew install pyenv</pre><p>After installing pyenv, you need to add it to your shell’s configuration file. Depending on your shell, the file you need to modify may be different. For example, if you’re using Bash, you can add the following to your .bashrc or .bash_profile file:</p><p><strong>HUMAN NOTE: </strong>If you are using <strong>zsh shell</strong> (default for <strong>macOS Catalina</strong> and/or <strong>Big Sur</strong>) you have to use ~/.zprofile file rather than ~/.bash_profile from <a href="https://stackoverflow.com/a/63399199/495630">StackOverflow</a></p><pre>export PYENV_ROOT=&quot;$HOME/.pyenv&quot;<br>export PATH=&quot;$PYENV_ROOT/bin:$PATH&quot;<br>eval &quot;$(pyenv init -)&quot;<br>eval &quot;$(pyenv virtualenv-init -)&quot;</pre><p><strong>HUMAN NOTE:</strong> The `eval “$(pyenv virtualenv-init -)”` will be used later</p><p>Now that you have pyenv configured, you can use it to install Python 3.10:</p><pre>pyenv install 3.10.0</pre><p>Once the installation is complete, you can set the global version of Python to 3.10.0 by running the following:</p><pre>pyenv global 3.10.0</pre><p>This will set the global version of Python to 3.10.0, which means that any new terminal sessions you open will use this version of Python by default. Finally, you can verify it by running:</p><p><strong>HUMAN NOTE: </strong>You need to first run source ~/.bash_profile or create a new terminal window for the following to work</p><pre>python --version</pre><p>This should display Python 3.10.0. That’s it! You’ve now set up Python 3.10.0 on your Mac!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J0QLjmS_hCdgLntYSbthTQ.png" /></figure><p>First, make sure you have pyenv-virtualenv installed. You can install it using Homebrew with the following command:</p><pre>brew install pyenv-virtualenv</pre><p>Once pyenv-virtualenv is installed, you can create a new virtual environment by running the following:</p><pre>pyenv virtualenv 3.10.0 myenv</pre><p>This will create a new virtual environment called myenv based on Python 3.10.0. You can replace myenv with whatever name you want.</p><p>After creating the virtual environment, you can activate it with:</p><pre>pyenv activate myenv</pre><p><strong>HUMAN NOTE:</strong><br>If you see the error Failed to activate virtualenv then ensure you set eval &quot;$(pyenv virtualenv-init -)&quot; and then opened a new window or ran source ~/.bash_rc</p><p>This will activate the myenv virtual environment, so any commands you run will use the version of Python installed in the virtual environment.</p><p>You can verify that the virtual environment is active by running:</p><pre>which python</pre><p>This should output a path that points to the myenv virtual environment, rather than the system Python installation.</p><p>To deactivate the virtual environment and switch back to the system Python installation, you can run the following:</p><pre>pyenv deactivate</pre><p>That’s it! You’ve now created and activated a virtual environment using pyenv. You can use this virtual environment to install packages and dependencies specific to your project, without affecting other Python installations on your system.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=683df43072d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to deploy a website on AWS with Docker, Flask, & React from scratch]]></title>
            <link>https://adamraudonis.medium.com/how-to-deploy-a-website-on-aws-with-docker-flask-react-from-scratch-d0845ebd9da4?source=rss-9165d51189e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0845ebd9da4</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Adam Raudonis]]></dc:creator>
            <pubDate>Sun, 20 Sep 2020 01:33:53 GMT</pubDate>
            <atom:updated>2021-02-27T16:15:06.179Z</atom:updated>
            <content:encoded><![CDATA[<p>There are many ways to build and deploy a simple, scalable website. This tutorial outlines one method and hopefully saves you time not having to go through all the same pitfalls I did.</p><p>The overall architecture is:</p><ul><li>Frontend: Javascript React App with Create React App deployed on S3 and Cloudfront</li><li>Backend: Dockerized Python Flask App deployed on Elastic Beanstalk</li><li>Domain: Parked at Godaddy.com</li></ul><p>For this example, we’ll be creating a website called <a href="https://logicshare.io/">https://logicshare.io</a> . You can view the final code here: <a href="https://github.com/adamraudonis/logicshare">https://github.com/adamraudonis/logicshare</a></p><p>First let’s create a <a href="https://github.com/new">github</a> repo:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rh8NaNEeFZK4kJau9_0swg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DAmhOv4jcSX12WRnEEkXOw.png" /></figure><p>Now we’ll want to develop locally so copy the above and run:</p><pre># Go to or make the folder you want<br>cd /Users/adamraudonis/Desktop/Projects/<br>mkdir LogicShare<br>cd LogicShare</pre><pre># Replace with your repo link<br>git clone <a href="/service/mailto:git@github.com">git@github.com</a>:adamraudonis/logicshare.git<br>cd logicshare</pre><h3>Frontend</h3><p>Ensure you have <a href="https://nodejs.org/en/">Node &gt;= 8.10 and npm &gt;= 5.6</a> installed. Let’s call our app frontend, but you can name it something different if you want. NOTE: This will take several minutes to run. The REACT_APP_API_URL is needed to talk to the backend later.</p><pre>npx create-react-app frontend<br>cd frontend<br>export REACT_APP_API_URL=http://localhost:8080/api<br>npm start</pre><p>You should now see the default react app here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qBf4iWKNkzIoe7mOxIPdkQ.png" /></figure><p>Let’s change it a bit to make it our own add a form so we can test interaction with our backend. For editing the code, I’m using <a href="https://code.visualstudio.com/">Microsoft’s Visual Studio Code (VSCode)</a> which has great support for react and python. You can make some test changes and then just save the file and the localhost website will automatically update.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WsTbL8zfJ4eRwfny2QIoMg.png" /></figure><p>Next I added the code to make the requests to the backend. See here: <a href="https://github.com/adamraudonis/logicshare/blob/master/frontend/src/App.js">https://github.com/adamraudonis/logicshare/blob/master/frontend/src/App.js</a> You may need to install additional packages like so:</p><pre>npm install --save axios</pre><p>Now obviously our frontend is showing errors trying to load from the backend because the backend doesn’t exist and we never set the env var REACT_APP_API_URL.</p><h3>Backend</h3><p>Here is the code for our very simple backend:</p><pre>import json<br>from flask import Flask, request<br>from flask_cors import CORS</pre><pre>app = Flask(__name__)<br>CORS(app)</pre><pre># NOTE: This route is needed for the default EB health check route<br>@app.route(&#39;/&#39;)<br>def home():<br>    return &quot;ok&quot;</pre><pre>@app.route(&#39;/api/get_topics&#39;)<br>def get_topics():<br>    return {&quot;topics&quot;: [&quot;topic1&quot;, &quot;other stuff&quot;, &quot;next topic&quot;]}</pre><pre>@app.route(&#39;/api/submit_question&#39;, methods=[&quot;POST&quot;])<br>def submit_question():<br>    question = json.loads(request.data)[&quot;question&quot;]<br>    return {&quot;answer&quot;: f&quot;You Q was {len(question)} chars long&quot;}</pre><pre>if __name__ == &#39;__main__&#39;:<br>    app.run(port=8080)</pre><p>Setup virtual environment in a new terminal window. If you don’t have python3.6 or later install it first. I like to set this up outside of the git repo.</p><pre>python3.7 -m venv venv      # Create the virtual environment<br>source venv/bin/activate    # Go inside the virtual environment<br>cd logicshare/backend<br>pip install flask<br>pip install flask-cors<br>pip freeze -&gt; requirements.txt</pre><pre># Test running locally:<br>python app.py</pre><p>Now we can see that our simple website it working locally:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h2Q26xWoOTHPwT3See3UXw.png" /></figure><p>For deployment, we’re going to want to use the production web server gunicorn instead of the built in flask one.</p><pre>pip install gunicorn<br>pip freeze -&gt; requirements.txt</pre><p>Next for gunicorn we need to make a file called wsgi.py</p><pre>from app import app</pre><pre>if __name__ == &quot;__main__&quot;:<br>    app.run()</pre><p>You can test this works locally by running:</p><pre>gunicorn wsgi:app -w 2 -b 0.0.0.0:8080 -t 30</pre><h3>Docker</h3><p>Next let’s setup docker so we can get ready for deployment. Now you might be wondering why use Docker. For this ultra simple app and because we’re using Elastic Beanstalk which has Flask support it is not technically necessary. However, using Docker to start out gives you great flexibility if you ever want to switch to user Kubernetes, a different service, or if you have additional complexity such as nested directory structure or dependencies that require some specific environment. Next create the Dockerfile in backend/Dockerfile</p><pre>FROM python:3.7<br>WORKDIR /backend<br>COPY requirements.txt requirements.txt<br>RUN pip install -r requirements.txt<br>EXPOSE 8080<br>COPY . .<br>CMD [&quot;gunicorn&quot;, &quot;wsgi:app&quot;, &quot;-w 2&quot;, &quot;-b 0.0.0.0:8080&quot;, &quot;-t 30&quot;]</pre><p>Now let’s build our docker container tagged to whatever you want:</p><pre>docker build -t logicshare-backend .</pre><p>We can test this works by running the following. The -p maps port 8080 of the docker container to port 8080 on your computer.</p><pre>docker run -p 8080:8080 logicshare-backend</pre><p>Press Control-C to stop the process when ready.</p><h3>AWS Setup</h3><p>Create or login to <a href="https://aws.amazon.com/">https://aws.amazon.com/</a> . I selected my region to be Oregon, but you can select whatever works for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UoiL3d_ewh0OqyzhjUm9iw.png" /></figure><p>You’ll need to install the aws command line interface (CLI), I did this by downloading this package on mac: <a href="https://awscli.amazonaws.com/AWSCLIV2.pkg">https://awscli.amazonaws.com/AWSCLIV2.pkg</a> but you can view full install guide here: <a href="https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html">https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html</a> . You should now see:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nThvCBJwOFwx8JcTEpprQQ.png" /></figure><p>Next before configuring the CLI you’ll want to create a new AWS user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4EszHe9KyzcoswdlptzWWA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*12VMon3oMm-nA0-Yct4YGA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ejANpatUYneLtUfkgMXCTw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ADIpzsVHYgrXISTjGDTCFw.png" /></figure><h4><strong>STOP AT THIS PAGE</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4KSU3Y99YAvuves3K1FChg.png" /></figure><p>Now, go back to your terminal and type aws configure and follow the instructions copying your access key ID and secret access key from that page.</p><h3>Deploy Frontend</h3><p>First we need to create a bucket in S3 to store our frontend files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dbb-QYLQqfO0VwY-q5Zl-w.png" /></figure><p>For now make everything in your bucket public, but we can change this later once our domain is setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*89GuK7F4WBiQaX5-r5i7Dg.png" /></figure><p>Now we need to actually build the frontend and push to our bucket:</p><pre>cd frontend<br>export REACT_APP_API_URL=/api<br>npm run build<br>aws s3 sync build/ s3://logicshare-frontend --acl public-read</pre><p>NOTE: You need the --acl public-read because running s3 sync changes the permissions to not be public by default .You’ll now see stuff in your bucket:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ycaj8z6joNz9WOeHdDy-KA.png" /></figure><p>Make sure for now all the files are public:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NWoOf8spiApRwawcrgBwNQ.png" /></figure><p>Next we want to create a cloud front CDN deployment that will improve the performance of our frontend loading times, allow us to easily use https, and route requests to the backend.</p><p>Create a Distribution in CloudFront and click Get Started under Web</p><p>Link to your S3 bucket and set the origin path to /index.html . For now ensure Restrict Bucket Access = No until we setup our domain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fXF3aP1TrSks7uzelGNPTg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1E2jWWwuUY8jnhGptKUijA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yXeZw7wPrLhfofCONIKKdQ.png" /></figure><p>After your distribution is done processing (which can take a couple minutes) you can now confirm everything works by clicking on the domain name. Notice it redirects to your bucket and then adds index.html . Once we add our custom domain name later we can restrict permissions and it will not redirect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JVoFyWFG4AumAZyYhWqP-w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gEjuivbc3nO_60Zhu29vHw.png" /><figcaption>YAYYY progress!!!</figcaption></figure><p>To automate the deployment of the frontend you can create a script called deploy_frontend.sh with the following content and then run sudo chmod 777 deploy_frontend.sh to make it executable. Now run ./deploy_frontend.sh</p><pre>echo &quot;Deploying Frontend...&quot;<br>cd frontend<br>export REACT_APP_API_URL=/api<br>npm run build<br>aws s3 sync build/ s3://logicshare-frontend</pre><p>(NOTE: This script assumes no public buckets which needs the domain name to be fixed)</p><h3>Deploy Backend</h3><p>First let’s setup a repo in the Elastic Container Registry on AWS so we can push our docker container there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X0gdTTW-xbJ4MPvQa5z7oA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yJlFIkaMqGEtC5PfMmsqyw.png" /></figure><p>Now we can run the push commands. Note: They will be different for you</p><pre>cd backend</pre><pre>aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin 184952363101.dkr.ecr.us-west-2.amazonaws.com</pre><pre>docker build -t logicshare-backend .</pre><pre>docker tag logicshare-backend:latest 184952363101.dkr.ecr.us-west-2.amazonaws.com/logicshare-backend:latest</pre><pre>docker push 184952363101.dkr.ecr.us-west-2.amazonaws.com/logicshare-backend:latest</pre><p>Next let’s set up the Elastic Beanstalk instance:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*088b30_I7EmxG4BSGzHSww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VfQ9cuyb5_EyRo3nZLlzxA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EgYH-E5kWLPqNi7v56FcsQ.png" /></figure><p>Here you can configure elastic beanstalk to use only spot instances. If you do not need 100% guaranteed reliability, then you will save up to 90% by selecting these options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cmaN0MICQ-K0qe5AK8z-hw.png" /></figure><p>NOTE: If your docker image is large, you may need to select a large instance type like t3 medium. But you could just see if your deployment fails first.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2i6WeM7g01hO9IUjKy47Qg.png" /></figure><p>Next we need to make sure that ECR can talk to EB! Otherwise you’ll get this error: <em>Instance deployment: The ECR service failed to authenticate your private repository.</em> Go back to IAM and select the aws-elasticbeanstalk-ec2-role under Roles and attach the AmazonEC2ContainerRegistryReadOnly policy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uqYr8NbfSWMd4t2-2BAcng.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j-WomoIwcj0NpcUEZzHTrg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eMGMOEAgUxIrYMD5sFIQTw.png" /></figure><p>Create a folder in backend called aws_deploy and then a file called Dockerrun.aws.json. Now AWS knows what docker image to use.</p><pre>{<br>  &quot;AWSEBDockerrunVersion&quot;: &quot;1&quot;,<br>  &quot;Image&quot;: {<br>    &quot;Name&quot;: &quot;184952363101.dkr.ecr.us-west-2.amazonaws.com/logicshare-backend&quot;,<br>    &quot;Update&quot;: &quot;true&quot;<br>  },<br>  &quot;Ports&quot;: [<br>    {<br>      &quot;ContainerPort&quot;: 8080,<br>      &quot;HostPort&quot;: 8080<br>    }<br>  ]<br>}</pre><p>Next you’ll need the aws EB CLI to deploy your latest docker image</p><pre>pip install awsebcli<br>cd backend/aws_deploy<br>eb init<br>eb deploy</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ia_I27DUVx86Bt0SMJ8vJQ.png" /></figure><p>Looks like everything works!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Pkws70iHr3UdjIPF289JQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4JgQQNkv4XG3EVZk4bIOrw.png" /><figcaption>Yayy!!!</figcaption></figure><p>If you made a mistake like for example make a typo in the docker name then you can click on logs and that should help you understand what happened.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kmJCUYJ2Q2us4BdHUH4IRA.png" /></figure><p>If you want to be able to deploy just by typing ./deploy_backed.sh then create a file called deploy_backend.sh with the following content and then run sudo chmod 777 deploy_backend.sh to allow it to be executable.</p><pre>echo &quot;Deploying Backend...&quot;<br>aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin 184952363101.dkr.ecr.us-west-2.amazonaws.com<br>docker build -t logicshare-backend .<br>docker tag logicshare-backend:latest 184952363101.dkr.ecr.us-west-2.amazonaws.com/logicshare-backend:latest<br>docker push 184952363101.dkr.ecr.us-west-2.amazonaws.com/logicshare-backend:latest<br>cd aws_deploy<br>eb deploy</pre><h3>Routing Frontend to Backend</h3><p>Back in cloudfront we now want to make it so anytime the frontend requests /api/* that request is routed to our new EB backend. First create new origin:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H2u86ivHoMGv4SSCg8Pchg.png" /></figure><p>When you create this origin ensure you select the Elastic Load Balancer (NOT S3). Also do NOT select HTTPS. That will come later when we add a domain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H446So9V29riWW2t4jSz0g.png" /></figure><p>Next we need to route requests from /api/* to the backend. Do this by creating a behavior that points to the new origin we just added.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E_xd4Qd5nQf6IX3HfY-Uaw.png" /></figure><p>Make sure to select Managed Caching Policy Disabled otherwise any stateful api will be messed up. Check redirect http to https. You’ll also want to ensure you check allow POST method otherwise your POST methods won’t work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8663u728GbtZTV1dFOYFIA.png" /></figure><p><strong>EDIT: </strong>Ensure that you also set Origin Request Policy to <strong>Managed-AllViewer. </strong>Otherwise, requests with parameters in your url like ?id=2 will not work!!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KVMzwhE0y8VfS5PgMeg2rQ.png" /></figure><p>Now our website is fully functional!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xPGCy6WbeGYmsgZtjm5-qw.png" /><figcaption>Yayyy!!!</figcaption></figure><p>Adding the second origin and behavior allows us to now restrict access to our frontend S3 bucket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ksFDItFbtjSsmkWQFTqb-w.png" /><figcaption>NOTE: One reader said they needed to check “Yes, Update Bucket Policy”. I did not verify this, so maybe try both if you encounter problems.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*obkEuxJzM-Kbqiboo0cgIw.png" /></figure><p>Now you’ll notice cloudfront works but s3 directly does not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oKWG9xTTAUKipekMhSd55g.png" /></figure><h3>Link domain from Godaddy to AWS</h3><p>First create a hosted zone in AWS Route 53:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FuwJtf28f7ul_FCga24zAw.png" /></figure><p>Next click on <strong>Hosted Zone Details</strong> to view the name servers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*go9CzfqV4Ml41mP4Aftzgg.png" /></figure><p>In a new tab, log into your Godaddy account and view the DNS page. Then copy over YOUR name servers from aws above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*muEDR0vaRqQLCxT3PVRQcw.png" /></figure><p>NOTE: If you tried now to go to Route 53 click create record, simple record, and connect to Cloudfront you’ll notice it doesn’t show up. We need to setup Cloudfront first.</p><p>Go to Cloudfront, add your domain name and www and and other sub domains you want under Alternate Domain Names and then click request or import a certificate with ACM as the field will initially be blank. Follow the instructions and then wait for your certificate to be validated. I chose use CNAME record to validate as AWS make it really easy with Route 53 for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kDW80r_G6FoDXHIQRKLLzg.png" /></figure><p>When you create a certificate remember to make both *.yourdomain.com and yourdomain.com</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vE1jdzcSzwly3vvFhVV7rA.png" /></figure><p>Now you should be able to see the certificate as a dropdown in the edit distribution page.</p><p>Now let’s go back to Route 53 and create a new record:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KeEtkPEkb6WASMcgCZQRNA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M3EkGBRF7jY7kgf5eKwdNA.png" /></figure><p>Next create a CNAME record for www.logicshare.io</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m60Q77LaehAdJ5wCV1NBSw.png" /></figure><p>Now <a href="https://logicshare.io/">https://logicshare.io</a> and <a href="https://www.logicshare.io/">https://www.logicshare.io</a> both work!!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*86KEW8290ryggqcEZZ5MdA.png" /></figure><p>Reminder that all the code for this little website is here: <a href="https://github.com/adamraudonis/logicshare">https://github.com/adamraudonis/logicshare</a></p><h3>Enjoy!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*n1SUqw-szRQWLb3g" /><figcaption>Photo by <a href="https://unsplash.com/@elishavision?utm_source=medium&amp;utm_medium=referral">Elizeu Dias</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0845ebd9da4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ways to waste less time on the web]]></title>
            <link>https://adamraudonis.medium.com/ways-to-waste-less-time-on-the-web-e113c8e5e9bc?source=rss-9165d51189e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/e113c8e5e9bc</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[internet-addiction]]></category>
            <category><![CDATA[social-media]]></category>
            <category><![CDATA[internet]]></category>
            <category><![CDATA[phone-addiction]]></category>
            <dc:creator><![CDATA[Adam Raudonis]]></dc:creator>
            <pubDate>Sun, 22 Jul 2018 06:26:27 GMT</pubDate>
            <atom:updated>2018-07-23T04:54:18.900Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*HOdC2RlovvuKEczPtVJpbQ.gif" /><figcaption>Unknown source for gif of endless scrolling</figcaption></figure><p>I’ve exercised almost every day for several years now. I don’t mean going to the gym: I’ve been training my mind to seek out content that keeps me in a semi-paralyzed procrastinating state. I’ll stay up watching YouTube, scrolling Reddit, Facebook, browsing news and go back to YouTube. It’s not entertainment, it’s a trap. This nightly screen time perpetuates a vicious cycle. The next day you’re tired again and all you want to do is scroll. I miss out on full alertness and the time to work on a passion project, connect with others or learn more. Wasting hours on one’s online vice of choice has sadly become a fact of modern life for many. This problem represents the cumulative loss of billions of hours of time that leave people unfulfilled. I’m still working to break this addiction, but here are some tips I hope can help:</p><h4><strong>Download the free Android app </strong><a href="http://www.qualitytimeapp.com/"><strong>QualityTime</strong></a><strong> or iPhone app </strong><a href="https://inthemoment.io/"><strong>Moment</strong></a></h4><p>I use it to set all fun apps to turn off after 11pm during weeknights and 1am for weekends. So far it’s worked really well and I’m often thankful when I get redirected to the app (This is how it blocks you using apps). They have a brilliant monetization scheme of forcing you to watch an ad after a set amount of time if you want to use your banned apps. There are usage statistics for each of your apps and you can see trends overtime. There’s a pro version but I’ve not tried it. This app does drain your battery at times though.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*lKL6OV9K9xpweNBQBzYn0g.png" /><figcaption>QualityTime: Set the times you want certain apps off</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9UCsYfdI4yLUd19QzdUqKg.png" /><figcaption>QualityTime: View your usage</figcaption></figure><p>Once the next version of Android comes out, all of this functionality will be included natively in the OS. This represents a very important change that will help <a href="https://en.wikipedia.org/wiki/Mobile_phone_overuse">Mobile Phone Overuse </a>syndrome.</p><p><a href="https://www.androidcentral.com/googles-digital-wellbeing">Google&#39;s Digital Wellbeing initiative: Everything you need to know</a></p><p>If you have an iPhone it may be worth switching just for this app, but one alternative is the app called Moment. It shows you basic statistics about how much you use your phone per day. That may provide motivation enough, but they also have pro features I’ve not used such as programs and would be curious to hear if anyone has used them</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hevrJ_DjBW30ZnhAwFBRyA.png" /><figcaption>Moment: View your usage</figcaption></figure><p>iOS 12 will include similar features and the ability to limit time on apps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UUi0ocDLUP-Wbu6Ken9GIQ.png" /><figcaption><a href="https://www.apple.com/ios/ios-12-preview/">https://www.apple.com/ios/ios-12-preview/</a></figcaption></figure><p>You’ll need enough mental will power to not delete the app. There may be some side effects of a dependency as well. When I went on vacation in another time zone the app didn’t work properly so I turned it off and reverted back to using YouTube and Reddit for several hours per day. Hopefully though with enough usage, my brain can be trained to not need these adult parental controls.</p><h4><strong>Use the </strong><a href="https://chrome.google.com/webstore/detail/stayfocusd/laankejkbhbdhmipfmgcngdelahlfoji"><strong>StayFocusd</strong></a><strong> chrome plugin</strong></h4><p>There are two ways I use this app on my laptop.</p><ul><li>Settings specific windows of time to not be distracted. For example, for the next hour I’ll block a list of websites. It’s amazing how much after completing a small chunk of work I will find myself instinctively opening the browser and typing f or r. Using a limited amount of time helps me, because I can reward myself with mindless browsing after finishing. It also made me actually use the feature instead of just getting frustrating by blocking websites permanently and deleting the plugin.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dsZnsTz7hpSiVBfP84ON6A.png" /></figure><ul><li>I’ve set a daily timer of total time per day of Facebook, Reddit, YouTube, news usage. If I’ve used more than that then it’s nice to get some extra motivation to do something else with my time.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dDw_Ai8XqN2Y4_AHpiOAIA.png" /><figcaption>Not sure if there is a post on r/spacex I haven’t read…</figcaption></figure><h4><strong>Read a physical book before bed</strong></h4><p>This has proved a great substitute for my futile efforts to scroll till the end of time. It’s far more rewarding to get lost in a novel or deeply absorb some nonfiction text. Having a physical book helps improve sleep by not exposing you to blue light right before bed. There’s additional motivation because each book costs money (assuming you’re like me and too lazy to make the trips to the library). Now my problem is that if the book is too good then I’ll stay up reading that…</p><h4><strong>Read the book Mind Hacking</strong></h4><p>While the book is super corny and seems written with a nerdy male audience in mind, if you look past those shortcomings, it offers simple yet powerful advice to build up mental fortitude to make the changes you want. Part of the book comes from Ray Dalio’s <em>Principles</em> which suggests imagining yourself as both a machine and the designer behind the machine. This framework empowers you to proactively and methodically work towards your personal and professional goals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vbqPb1NWUQixj01iOE0qEg.png" /></figure><h4><strong>Track your progress</strong></h4><p>One action I took after reading Mind Hacking was I created a google doc to hold me accountable for improvement in these habits and others. We formalize most other important aspects of our lives and work, so why not take the same approach to utilizing many hours per week better? You can view my sheet here. As you can see, I’m nowhere close to perfect and don’t have a linear improvement trajectory but at least it’s a start. <a href="https://docs.google.com/spreadsheets/d/1TBRhRumc29meVeoLhUG3yXuBq0ak1_5niioCE23-pR0/edit?usp=sharing">Link</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0t1mumZOZSHqXVsK2G2iVQ.png" /></figure><h4><strong>Understand the tactics developers use to engage you</strong></h4><p><a href="http://observer.com/2016/06/how-technology-hijacks-peoples-minds%E2%80%8A-%E2%80%8Afrom-a-magician-and-googles-design-ethicist/">This article</a> efficiently describes the various methods developers use to gain your attention and train your brain to ensure engagement. Our internet addiction is partly by design and it helps to notice these time monopolizing tactics so you can better resist them.</p><p><a href="http://observer.com/2016/06/how-technology-hijacks-peoples-minds%E2%80%8A-%E2%80%8Afrom-a-magician-and-googles-design-ethicist/">How Technology Hijacks People&#39;s Minds - From a Magician and Google&#39;s Design Ethicist</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*M16El2VSL7JUFAHpb58S9w.png" /></figure><h4><strong>Use the mobile web versions of Facebook and Reddit</strong></h4><p>Personally I think Facebook is super useful for keeping in touch with people so I haven’t deactivated completely. Getting rid of the mobile app raises the activation energy for use because the mobile web app sucks. I’m still guilty of going on reddit way too much I so haven’t figured out what to do there but the web only version has reduced usage slightly.</p><h4><strong>Go where there’s no Wi-Fi or turn it off</strong></h4><p>Some of my most productive hours have been in areas where wifi is absent. If you actively seek out these places you’ll gain motivation from seeing how productive you’ve been. Turning off Wi-Fi can help to a lesser extent by making it slightly harder to open the browser and instinctively type f for Facebook.</p><h4><strong>Leave your phone in the locker</strong></h4><p>If you’re at the gym, it’s incredibly refreshing to leave your phone in your car or locker. You’re ensuring your entire time there is dedicated to yourself free from of any distractions in the outside world. You’ll find yourself reflecting more, often solving problems in your head and get a better work out too.</p><h4><strong>Get the </strong><a href="https://www.thelightphone.com/"><strong>Light Phone</strong></a><strong> </strong><a href="https://www.indiegogo.com/projects/light-phone-2-design#/"><strong>(Version 2 coming)</strong></a></h4><p>While I’ve not tried this, and I think has too limited of a feature set, if you’re looking to significantly reduce your screen time, there’s Light Phone which will allow only simple use functions such as calls. Text and navigation will come in the second version. See the kickstarter link above for version 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bzJbVG-WiHjygpDFQbOZJQ.png" /></figure><h4><strong>What didn’t work: Giving someone $100 if I stayed up too late online</strong></h4><p>Just lost $100</p><p>I hope this list helps. Please let me know what works for you so I can improve the post.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e113c8e5e9bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>